comparison src/sat.tac @ 276:a00e87d48213

bridge, bridge constructor: fixed mix stuff
author Goffi <goffi@goffi.org>
date Sun, 30 Jan 2011 22:54:58 +0100
parents c1ad04586edf
children 05caa87196e6
comparison
equal deleted inserted replaced
275:01a0bd6e7fae 276:a00e87d48213
139 if not self.host.trigger.point("MessageReceived",message, profile=self.parent.profile): 139 if not self.host.trigger.point("MessageReceived",message, profile=self.parent.profile):
140 return 140 return
141 for e in message.elements(): 141 for e in message.elements():
142 if e.name == "body": 142 if e.name == "body":
143 mess_type = message['type'] if message.hasAttribute('type') else 'normal' 143 mess_type = message['type'] if message.hasAttribute('type') else 'normal'
144 self.host.bridge.newMessage(message["from"], e.children[0], mess_type, profile=self.parent.profile) 144 self.host.bridge.newMessage(message["from"], e.children[0], mess_type, message['to'], profile=self.parent.profile)
145 self.host.memory.addToHistory(self.parent.jid, jid.JID(message["from"]), self.parent.jid, "chat", e.children[0]) 145 self.host.memory.addToHistory(self.parent.jid, jid.JID(message["from"]), self.parent.jid, "chat", e.children[0])
146 break 146 break
147 147
148 class SatRosterProtocol(xmppim.RosterClientProtocol): 148 class SatRosterProtocol(xmppim.RosterClientProtocol):
149 149
614 message.addElement("subject", "jabber:client", subject) 614 message.addElement("subject", "jabber:client", subject)
615 message.addElement("body", "jabber:client", msg) 615 message.addElement("body", "jabber:client", msg)
616 self.profiles[profile].xmlstream.send(message) 616 self.profiles[profile].xmlstream.send(message)
617 self.memory.addToHistory(current_jid, current_jid, jid.JID(to), message["type"], unicode(msg)) 617 self.memory.addToHistory(current_jid, current_jid, jid.JID(to), message["type"], unicode(msg))
618 if type!="groupchat": 618 if type!="groupchat":
619 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 619 self.bridge.newMessage(message['from'], unicode(msg), mess_type=type, to_jid=message['to'], profile=profile) #We send back the message, so all clients are aware of it
620 620
621 621
622 def setPresence(self, to="", show="", priority = 0, statuses={}, profile_key='@DEFAULT@'): 622 def setPresence(self, to="", show="", priority = 0, statuses={}, profile_key='@DEFAULT@'):
623 """Send our presence information""" 623 """Send our presence information"""
624 profile = self.memory.getProfileName(profile_key) 624 profile = self.memory.getProfileName(profile_key)