comparison src/sat.tac @ 260:c8406fe5e81e

Added SMTP server plugin, for sending messages from classic MUA \o/ - added subject managing in sendMessage
author Goffi <goffi@goffi.org>
date Tue, 18 Jan 2011 03:59:59 +0100
parents 012c38b56cdd
children af3d4f11fe43
comparison
equal deleted inserted replaced
259:11f71187d5e4 260:c8406fe5e81e
589 return "" 589 return ""
590 590
591 591
592 ## jabber methods ## 592 ## jabber methods ##
593 593
594 def sendMessage(self,to,msg,type='chat', profile_key='@DEFAULT@'): 594 def sendMessage(self, to, msg, subject=None, type='chat', profile_key='@DEFAULT@'):
595 #FIXME: check validity of recipient 595 #FIXME: check validity of recipient
596 profile = self.memory.getProfileName(profile_key) 596 profile = self.memory.getProfileName(profile_key)
597 assert(profile) 597 assert(profile)
598 current_jid = self.profiles[profile].jid 598 current_jid = self.profiles[profile].jid
599 debug(_("Sending jabber message to %s..."), to) 599 debug(_("Sending jabber message to %s..."), to)
600 message = domish.Element(('jabber:client','message')) 600 message = domish.Element(('jabber:client','message'))
601 message["to"] = jid.JID(to).full() 601 message["to"] = jid.JID(to).full()
602 message["from"] = current_jid.full() 602 message["from"] = current_jid.full()
603 message["type"] = type 603 message["type"] = type
604 if subject:
605 message.addElement("subject", "jabber:client", subject)
604 message.addElement("body", "jabber:client", msg) 606 message.addElement("body", "jabber:client", msg)
605 self.profiles[profile].xmlstream.send(message) 607 self.profiles[profile].xmlstream.send(message)
606 self.memory.addToHistory(current_jid, current_jid, jid.JID(to), message["type"], unicode(msg)) 608 self.memory.addToHistory(current_jid, current_jid, jid.JID(to), message["type"], unicode(msg))
607 if type!="groupchat": 609 if type!="groupchat":
608 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 610 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