summaryrefslogtreecommitdiffstats
path: root/pymodule.c
diff options
context:
space:
mode:
authorChristopher Davis <loafier@gmail.com>2006-06-21 00:22:03 +0000
committerChristopher Davis <loafier@gmail.com>2006-06-21 00:22:03 +0000
commit7ddcc3b268c8c55b2d6fe80e87e090181fbc1bf7 (patch)
treecc0ceff989c10739bcb18ae0743579bfb5074c3a /pymodule.c
parentbb48c914c6239ed1dbcb29eb62d33d3ab91e7215 (diff)
downloadirssi-python-7ddcc3b268c8c55b2d6fe80e87e090181fbc1bf7.tar.gz
irssi-python-7ddcc3b268c8c55b2d6fe80e87e090181fbc1bf7.tar.xz
irssi-python-7ddcc3b268c8c55b2d6fe80e87e090181fbc1bf7.zip
Added a lot of object wrappers. Most are untested.
Will finish up the rest of the object wrappers perhaps tonight or tomorrow. Signal handling will need to be addressed ASAP. There are quite a lot of other global module functions remaining to be wraped, as well. git-svn-id: http://svn.irssi.org/repos/irssi-python@4286 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'pymodule.c')
-rw-r--r--pymodule.c102
1 files changed, 102 insertions, 0 deletions
diff --git a/pymodule.c b/pymodule.c
index c29940b..308772e 100644
--- a/pymodule.c
+++ b/pymodule.c
@@ -686,6 +686,98 @@ static PyObject *py_dcc_get_download_path(PyObject *self, PyObject *args, PyObje
return pypath;
}
+PyDoc_STRVAR(py_notifies_doc,
+ "Return list of notifies"
+);
+static PyObject *py_notifies(PyObject *self, PyObject *args)
+{
+ return py_irssi_objlist_new(notifies, 1, (InitFunc)pynotifylist_new);
+}
+
+PyDoc_STRVAR(py_notifylist_add_doc,
+ "notifylist_add(mask, ircnets=None, away_check=0, idle_time_check=0) -> Notifylist object\n"
+ "\n"
+ "Add new item to notify list\n"
+);
+static PyObject *py_notifylist_add(PyObject *self, PyObject *args, PyObject *kwds)
+{
+ static char *kwlist[] = {"mask", "ircnets", "away_check", "idle_check_time", NULL};
+ char *mask = "";
+ char *ircnets = NULL;
+ int away_check = 0;
+ int idle_check_time = 0;
+ NOTIFYLIST_REC *rec;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|zii", kwlist,
+ &mask, &ircnets, &away_check, &idle_check_time))
+ return NULL;
+
+ rec = notifylist_add(mask, ircnets, away_check, idle_check_time);
+ if (rec)
+ return pynotifylist_new(rec);
+
+ Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(py_notifylist_remove_doc,
+ "Remove notify item from notify list"
+);
+static PyObject *py_notifylist_remove(PyObject *self, PyObject *args, PyObject *kwds)
+{
+ static char *kwlist[] = {"mask", NULL};
+ char *mask = "";
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist,
+ &mask))
+ return NULL;
+
+ notifylist_remove(mask);
+
+ Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(py_notifylist_ison_doc,
+ "notifylist_ison(nick, serverlist="") -> IrcServer object\n"
+ "\n"
+ "Check if nick is in IRC. serverlist is a space separated list of server tags.\n"
+ "If it's empty string, all servers will be checked\n"
+);
+static PyObject *py_notifylist_ison(PyObject *self, PyObject *args, PyObject *kwds)
+{
+ static char *kwlist[] = {"nick", "serverlist", NULL};
+ char *nick = "";
+ char *serverlist = "";
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|s", kwlist,
+ &nick, &serverlist))
+ return NULL;
+
+ return py_irssi_chat_new(notifylist_ison(nick, serverlist), 1);
+}
+
+PyDoc_STRVAR(py_notifylist_find_doc,
+ "notifylist_find(mask, ircnet=None) -> Notifylist object\n"
+ "\n"
+ "Find notify\n"
+);
+static PyObject *py_notifylist_find(PyObject *self, PyObject *args, PyObject *kwds)
+{
+ static char *kwlist[] = {"mask", "ircnet", NULL};
+ char *mask = "";
+ char *ircnet = NULL;
+ NOTIFYLIST_REC *rec;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|z", kwlist,
+ &mask, &ircnet))
+ return NULL;
+
+ rec = notifylist_find(mask, ircnet);
+ if (rec)
+ pynotifylist_new(rec);
+
+ Py_RETURN_NONE;
+}
+
static PyMethodDef ModuleMethods[] = {
{"prnt", (PyCFunction)py_prnt, METH_VARARGS|METH_KEYWORDS, py_prnt_doc},
{"get_script", (PyCFunction)py_get_script, METH_NOARGS, py_get_script_doc},
@@ -771,6 +863,16 @@ static PyMethodDef ModuleMethods[] = {
py_dcc_type2str_doc},
{"dcc_get_download_path", (PyCFunction)py_dcc_get_download_path, METH_VARARGS | METH_KEYWORDS,
py_dcc_get_download_path_doc},
+ {"notifies", (PyCFunction)py_notifies, METH_NOARGS,
+ py_notifies_doc},
+ {"notifylist_add", (PyCFunction)py_notifylist_add, METH_VARARGS | METH_KEYWORDS,
+ py_notifylist_add_doc},
+ {"notifylist_remove", (PyCFunction)py_notifylist_remove, METH_VARARGS | METH_KEYWORDS,
+ py_notifylist_remove_doc},
+ {"notifylist_ison", (PyCFunction)py_notifylist_ison, METH_VARARGS | METH_KEYWORDS,
+ py_notifylist_ison_doc},
+ {"notifylist_find", (PyCFunction)py_notifylist_find, METH_VARARGS | METH_KEYWORDS,
+ py_notifylist_find_doc},
{NULL, NULL, 0, NULL} /* Sentinel */
};