comparison src/plugins/plugin_misc_text_commands.py @ 509:64ff046dc201

plugin text commands: added /join command
author Goffi <goffi@goffi.org>
date Fri, 28 Sep 2012 00:48:52 +0200
parents 7c6609dddb2c
children 29b5ef129488
comparison
equal deleted inserted replaced
508:7c6609dddb2c 509:64ff046dc201
88 88
89 self.host.plugins["XEP-0045"].nick(room,nick,profile) 89 self.host.plugins["XEP-0045"].nick(room,nick,profile)
90 90
91 return False 91 return False
92 92
93 def cmd_join(self, mess_data, profile):
94 debug("Catched join command")
95
96 if mess_data['type'] != "groupchat":
97 #/leave command does nothing if we are not on a group chat
98 info("Ignoring /join command on a non groupchat message")
99 return True
100
101 if mess_data["unparsed"].strip():
102 room = self._getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host)
103 nick = (self.host.plugins["XEP-0045"].getRoomNick(mess_data["to"].userhost(), profile) or
104 self.host.getClient(profile).jid.user)
105 self.host.plugins["XEP-0045"].join(room, nick, {}, profile)
106
107 return False
108
93 def cmd_leave(self, mess_data, profile): 109 def cmd_leave(self, mess_data, profile):
94 debug("Catched leave command") 110 debug("Catched leave command")
95 111
96 if mess_data['type'] != "groupchat": 112 if mess_data['type'] != "groupchat":
97 #/leave command does nothing if we are not on a group chat 113 #/leave command does nothing if we are not on a group chat