]> jfr.im git - irc/evilnet/x3.git/commitdiff
mod-python: add emb_kick function
authorhstuart <redacted>
Sun, 11 Oct 2009 20:42:27 +0000 (20:42 +0000)
committerhstuart <redacted>
Sun, 11 Oct 2009 20:42:27 +0000 (20:42 +0000)
ChangeLog
src/mod-python.c

index f193bd703ce7097731f2502ef074d8b203b79c3f..56deaf56f47986ca932fc82b55b2ef2d666b3248 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 /***********************************************************************
 X3 ChangeLog
 
+2009-10-11  Henrik Stuart <evilnet@hstuart.dk>
+
+       * src/mod-python.c: add emb_kick function.
+
 2009-10-11  Henrik Stuart <evilnet@hstuart.dk>
 
        * src/mod-python.c: add emb_get_config function.
index 4ffab92ddc0f511f250829f55f4ae09a39d7e327..42317dcfd3bd5ca5640394e92bbf4b8d0fe11fc9 100644 (file)
@@ -827,6 +827,36 @@ emb_get_config(UNUSED_ARG(PyObject* self), PyObject* args) {
     return dict;
 }
 
+static PyObject* emb_kick(UNUSED_ARG(PyObject* self), PyObject* args) {
+    struct userNode* who, *target;
+    struct chanNode* channel;
+    char const* msg;
+
+    char const* who_s, *target_s, *channel_s;
+
+    if (!PyArg_ParseTuple(args, "ssss", &who_s, &target_s, &channel_s, &msg))
+        return NULL;
+
+    if ((who = GetUserH(who_s)) == NULL) {
+        PyErr_SetString(PyExc_Exception, "no such user");
+        return NULL;
+    }
+
+    if ((target = GetUserH(target_s)) == NULL) {
+        PyErr_SetString(PyExc_Exception, "no such target");
+        return NULL;
+    }
+
+    if ((channel = GetChannel(channel_s)) == NULL) {
+        PyErr_SetString(PyExc_Exception, "no such channel");
+        return NULL;
+    }
+
+    irc_kick(who, target, channel, msg);
+
+    return Py_None;
+}
+
 static PyMethodDef EmbMethods[] = {
     /* Communication methods */
     {"dump", emb_dump, METH_VARARGS, "Dump raw P10 line to server"},
@@ -840,7 +870,7 @@ static PyMethodDef EmbMethods[] = {
 //TODO:    {"unshun"
 //TODO:    {"gline", emb_gline, METH_VARARGS, "gline a mask"},
 //TODO:    {"ungline", emb_ungline, METH_VARARGS, "remove a gline"},
-//TODO:    {"kick", emb_kick, METH_VARARGS, "kick someone from a channel"},
+    {"kick", emb_kick, METH_VARARGS, "kick someone from a channel"},
 //TODO:    {"channel_mode", emb_channel_mode, METH_VARARGS, "set modes on a channel"},
 //TODO:    {"user_mode", emb_user_mode, METH_VARARGS, "Have x3 set usermodes on one of its own nicks"},
 //