changeset 2099:ab5e7026413a

Move shared commands to a separate file, to make imports cleaner.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Tue, 05 Jun 2007 23:18:26 +0200
parents da36e7cc80a3
children 0dbf808a6e42
files MoinMoin/jabber/commands.py MoinMoin/jabber/xmlrpcbot.py MoinMoin/jabber/xmppbot.py
diffstat 3 files changed, 29 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/jabber/commands.py	Tue Jun 05 23:18:26 2007 +0200
@@ -0,0 +1,27 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - inter-thread communication commands
+
+    This file defines command objects used by notification
+    bot's threads to communicate among each other.
+
+    @copyright: 2007 by Karol Nowak <grywacz@gmail.com>
+    @license: GNU GPL, see COPYING for details.
+"""
+
+# First, XML RPC -> XMPP commands
+class NotificationCommand:
+    """Class representing a notification request"""
+    def __init__(self, jid, text):
+        self.jid = jid
+        self.text = text
+        
+class AddJIDToRosterCommand:
+    """Class representing a request to add a new jid to roster"""
+    def __init__(self, jid):
+        self.jid = jid
+        
+class RemoveJIDFromRosterCommand:
+    """Class representing a request to remove a jid from roster"""
+    def __init__(self, jid):
+        self.jid = jid
--- a/MoinMoin/jabber/xmlrpcbot.py	Tue Jun 05 23:08:22 2007 +0200
+++ b/MoinMoin/jabber/xmlrpcbot.py	Tue Jun 05 23:18:26 2007 +0200
@@ -14,22 +14,7 @@
 from threading import Thread
 from SimpleXMLRPCServer import SimpleXMLRPCServer
 
-
-class NotificationCommand:
-    """Class representing a notification request"""
-    def __init__(self, jid, text):
-        self.jid = jid
-        self.text = text
-        
-class AddJIDToRosterCommand:
-    """Class representing a request to add a new jid to roster"""
-    def __init__(self, jid):
-        self.jid = jid
-        
-class RemoveJIDFromRosterCommand:
-    """Class representing a request to remove a jid from roster"""
-    def __init__(self, jid):
-        self.jid = jid
+from commands import *
 
 
 class XMLRPCClient(Thread):
--- a/MoinMoin/jabber/xmppbot.py	Tue Jun 05 23:08:22 2007 +0200
+++ b/MoinMoin/jabber/xmppbot.py	Tue Jun 05 23:18:26 2007 +0200
@@ -19,7 +19,7 @@
 from pyxmpp.streamtls import TLSSettings
 from pyxmpp.message import Message
 
-from xmlrpcbot import NotificationCommand
+from commands import *
 
 
 class Contact: