diff sat.tac @ 67:0e50dd3a234a

message sending bug fixes + sortilege update - sortilege now use default profile. /!\ sortilege is really buggy currently, need some attention
author Goffi <goffi@goffi.org>
date Thu, 04 Feb 2010 01:06:36 +1100
parents 8147b4f40809
children 9b842086d915
line wrap: on
line diff
--- a/sat.tac	Wed Feb 03 23:35:57 2010 +1100
+++ b/sat.tac	Thu Feb 04 01:06:36 2010 +1100
@@ -125,7 +125,8 @@
       debug (u"got_message from: %s", message["from"])
       for e in message.elements():
         if e.name == "body":
-          self.host.bridge.newMessage(message["from"], e.children[0], self.parent.profile)
+          type = message['type'] if message.hasAttribute('type') else 'chat' #FIXME: check specs
+          self.host.bridge.newMessage(message["from"], e.children[0], type, profile=self.parent.profile)
           self.host.memory.addToHistory(self.parent.jid, jid.JID(message["from"]), self.parent.jid, "chat", e.children[0])
           break
     
@@ -573,6 +574,7 @@
     ## jabber methods ##
     
     def sendMessage(self,to,msg,type='chat', profile_key='@DEFAULT@'):
+        print "sendtype=", type  #gof
         #FIXME: check validity of recipient
         profile = self.memory.getProfileName(profile_key)
         assert(profile)
@@ -585,7 +587,7 @@
         message.addElement("body", "jabber:client", msg)
         self.profiles[profile].xmlstream.send(message)
         self.memory.addToHistory(current_jid, current_jid, jid.JID(to), message["type"], unicode(msg))
-        self.bridge.newMessage(message['from'], unicode(msg), to=message['to'], profile=profile) #We send back the message, so all clients are aware of it
+        self.bridge.newMessage(message['from'], unicode(msg), to=message['to'], type=type, profile=profile) #We send back the message, so all clients are aware of it
 
 
     def setPresence(self, to="", show="", priority = 0, statuses={}, profile_key='@DEFAULT@'):