]> jfr.im git - irc/evilnet/x3.git/commitdiff
mod-python: rename C extension module from svc to _svc
authorhstuart <redacted>
Mon, 5 Oct 2009 11:42:44 +0000 (11:42 +0000)
committerhstuart <redacted>
Mon, 5 Oct 2009 11:42:44 +0000 (11:42 +0000)
ChangeLog
src/mod-python.c
src/modpython.py
src/plugins/annoy/plugin.py
src/plugins/hangman/plugin.py

index bf954b2fd4c302d54229bc62ae29d2e720eca260..67832da0a28692969b536249cd9793e3e4dd6fd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 /***********************************************************************
 X3 ChangeLog
 
+2009-10-05  Henrik Stuart <evilnet@hstuart.dk>
+
+       * src/mod-python.c: Expose Python services module as _svc to follow normal
+       Python naming conventions for C extensions.
+
 2009-10-05  Henrik Stuart <evilnet@hstuart.dk>
 
        * src/mod-python.c: Remove unused function.
index 78e15b7e0c8cb27ddc2ac8a1cd0c560943b0e151..04c7d3a0e7828205f4b2d783a2a0fbc556421c2a 100644 (file)
@@ -72,7 +72,7 @@ extern struct userNode *global, *chanserv, *opserv, *nickserv, *spamserv;
 
 /* ---------------------------------------------------------------------- * 
     Some hooks you can call from modpython.py to interact with the   
-    service, and IRC.  These emb_* functions are available as svc.*
+    service, and IRC.  These emb_* functions are available as _svc.*
     in python.
  */
 
@@ -80,7 +80,7 @@ static PyObject*
 emb_dump(UNUSED_ARG(PyObject *self), PyObject *args)
 {
     /* Dump a raw string into the socket 
-        usage: svc.dump(<P10 string>)
+        usage: _svc.dump(<P10 string>)
     */
     char *buf;
     int ret = 0;
@@ -101,7 +101,7 @@ static PyObject*
 emb_send_target_privmsg(UNUSED_ARG(PyObject *self), PyObject *args)
 {
     /* Send a privmsg 
-        usage: svc.send_target_privmsg(<servicenick_from>, <nick_to>, <message>)
+        usage: _svc.send_target_privmsg(<servicenick_from>, <nick_to>, <message>)
     */
     int ret = 0;
     char *servicenick;
@@ -125,7 +125,7 @@ static PyObject*
 emb_send_target_notice(UNUSED_ARG(PyObject *self), PyObject *args)
 {
     /* send a notice
-        usage: svc.send_target_notice(<servicenick_from>, <nick_to>, <message>)
+        usage: _svc.send_target_notice(<servicenick_from>, <nick_to>, <message>)
     */
     int ret = 0;
     char *servicenick;
@@ -149,7 +149,7 @@ static PyObject*
 emb_get_user(UNUSED_ARG(PyObject *self), PyObject *args)
 {
     /* Get a python object containing everything x3 knows about a user, by nick.
-        usage: svc.get_user(<nick>)
+        usage: _svc.get_user(<nick>)
     */
     char *nick;
     struct userNode *user;
@@ -198,7 +198,7 @@ static PyObject*
 emb_get_channel(UNUSED_ARG(PyObject *self), PyObject *args)
 {
     /* Returns a python dict object with all sorts of info about a channel.
-          usage: svc.get_channel(<name>)
+          usage: _svc.get_channel(<name>)
     */
     char *name;
     struct chanNode *channel;
@@ -266,7 +266,7 @@ static PyObject*
 emb_get_account(UNUSED_ARG(PyObject *self), PyObject *args)
 {
     /* Returns a python dict object with all sorts of info about an account.
-        usage: svc.get_account(<account name>)
+        usage: _svc.get_account(<account name>)
     */
     char *name;
     struct handle_info *hi;
@@ -702,7 +702,7 @@ int python_load() {
     }
 
     Py_Initialize();
-    Py_InitModule("svc", EmbMethods);
+    Py_InitModule("_svc", EmbMethods);
     /* TODO: get "modpython" from x3.conf */
     pName = PyString_FromString("modpython");
     base_module = PyImport_Import(pName);
index 34fdbf6821bb2bdac65e10ee7f5159ce6ec12524..892322de8f1c12ad023c654d91aa02967be6458b 100644 (file)
@@ -11,7 +11,7 @@
 # - provide helper functions for scripts to do common things like msg a person or a channel,
 #   reply, etc.
 
-import svc
+import _svc
 
 import math
 
@@ -33,7 +33,7 @@ class irc:
         self.target = target   #the channel message was in (if public)
 
     def send_target_privmsg(self, source, target, message):
-        svc.send_target_privmsg(source, target,  "%s "%(message))
+        _svc.send_target_privmsg(source, target,  "%s "%(message))
 
     def reply(self, message):
         """ Send a private reply to the user using convenience values"""
@@ -60,7 +60,7 @@ class handler:
         return 0
 
     def join(self, irc, channel, nick):
-        #user = svc.get_user(nick)
+        #user = _svc.get_user(nick)
         #print "DEBUG: handler.join()"
         return self.plugins.callhandler("join", irc, [channel, nick], [channel, nick])
 
index 26e7f13240eccfc19c39076d3d1fce6004eb5798..335611480bec06f0490b6b7b275437ccea27b3ce 100644 (file)
@@ -1,6 +1,6 @@
 # anoy module
 
-import svc
+import _svc
 
 class Annoy:
 
@@ -21,13 +21,13 @@ class Annoy:
 #        irc.send_target_privmsg("x3", channel, "%s joined %s:%s "%(nick, channel, self.test))
 
     def nick_change(self, irc, nick, old_nick):
-        svcinfo = svc.get_info()
+        svcinfo = _svc.get_info()
         # opserv pm #theops that someones nick changed
         irc.send_target_privmsg(svcinfo["opserv"], "#theops", "%s changed nick to %s"%(old_nick, nick) )
 
     def dance(self, irc, args):
         nick = irc.caller
-        user = svc.get_user(nick)
+        user = _svc.get_user(nick)
 
         reply = "Ok,"
         if(user and "account" in user):
@@ -42,7 +42,7 @@ class Annoy:
         irc.reply(reply)
 
     def nickof(self, irc, bot):
-        info = svc.get_info()
+        info = _svc.get_info()
 
         if(bot and bot in info.keys()):
             irc.reply("%s has nick %s"%(bot, info[bot]))
index 82bd5d473985b4249acd673bc29ed8845e4b9a7a..e44cfffd49bd944643c27ee5a3032cf6c8f62a4d 100644 (file)
@@ -1,6 +1,6 @@
 # anoy module
 
-import svc
+import _svc
 import re
 import fileinput
 import random
@@ -200,7 +200,7 @@ class Hangman:
 
     def dance(self, irc, args):
         nick = irc.caller
-        user = svc.get_user(nick)
+        user = _svc.get_user(nick)
 
         reply = "Ok,"
         if(user and "account" in user):
@@ -215,7 +215,7 @@ class Hangman:
         irc.reply(reply)
 
     def nickof(self, irc, bot):
-        info = svc.get_info()
+        info = _svc.get_info()
 
         if(bot and bot in info.keys()):
             irc.reply("%s has nick %s"%(bot, info[bot]))