changeset 2651:c0a85041f623

Merge devel.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Tue, 07 Aug 2007 18:34:01 +0200
parents 2b4be3be9835 (current diff) 596516ae09dd (diff)
children 0182bbf46479
files jabberbot/xmppbot.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jabberbot/xmppbot.py	Tue Aug 07 18:33:18 2007 +0200
+++ b/jabberbot/xmppbot.py	Tue Aug 07 18:34:01 2007 +0200
@@ -65,7 +65,7 @@
         @param priority: priority of the given resource
 
         """
-        self.resources[resource] = {'show': show, 'priority': priority}
+        self.resources[resource] = {'show': show, 'priority': priority, 'forms': False}
         self.last_online = None
 
     def set_supports_forms(self, resource):
@@ -507,11 +507,14 @@
         elif command[0] == "searchform":
             jid = sender.bare().as_utf8()
             resource = sender.resource
-            if self.contacts[jid].supports_forms(resource):
+
+            # Assume that outsiders know what they are doing. Clients that don't support
+            # data forms should display a warning passed in message <body>.
+            if jid not in self.contacts or self.contacts[jid].supports_forms(resource):
                 self.send_search_form(sender)
             else:
-                msg = _("This command requires a client supporting Data Forms")
-                self.send_message(sender, msg, u"Error")
+                msg = {'text': _("This command requires a client supporting Data Forms.")}
+                self.send_message(sender, msg, u"")
         else:
             # For unknown command return a generic help message
             return self.reply_help(sender)