changeset 4543:544679a8a444

Commiting a patch from Noya to fix user creation notifications.
author Karol 'grzywacz' Nowak <grywacz@gmail.com>
date Tue, 03 Feb 2009 02:30:27 +0100
parents 9a3e85b44c25
children 776cc7f6f6c6
files jabberbot/xmppbot.py
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jabberbot/xmppbot.py	Tue Feb 03 02:15:31 2009 +0100
+++ b/jabberbot/xmppbot.py	Tue Feb 03 02:30:27 2009 +0100
@@ -417,8 +417,9 @@
         @type contact: Contact
 
         """
-        pass
-
+        # TODO: send as form if user-client supports it
+        self.send_user_created_text(jid.as_unicode(), cmd_data)
+        
     def ask_for_subscription(self, jid):
         """Sends a <presence/> stanza with type="subscribe"
 
@@ -815,6 +816,21 @@
         data = {'text': message, 'subject': msg_data['subject']}
         self.send_message(jid, data, u"normal")
 
+    def send_user_created_text(self, jid, msg_data):
+        """Sends a simple, text page user-created-notification
+
+        @param jid: a Jabber ID to send the notification to
+        @type jid: unicode
+        @param msg_data: dictionary with notification data
+        @type msg_data: dict
+
+        """
+        _ = self.get_text(jid)
+        message = _("%(text)s") % {'text': msg_data['text']}
+
+        data = {'text': message, 'subject': msg_data['subject']}
+        self.send_message(jid, data, u"normal")
+
     def handle_page_info(self, command):
         """Handles GetPageInfo commands