Mercurial > libervia-backend
annotate src/plugins/plugin_xep_0045.py @ 657:09bbd5c00244
jp: profiles management
author | Dal <kedals0@gmail.com> |
---|---|
date | Mon, 07 Oct 2013 14:56:09 +0200 |
parents | 84a6e83157c2 |
children | f610864eb7a5 |
rev | line source |
---|---|
72 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
4 # SAT plugin for managing xep-0045 |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
5 # Copyright (C) 2009, 2010, 2011, 2012, 2013 Jérôme Poisson (goffi@goffi.org) |
72 | 6 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
10 # (at your option) any later version. |
72 | 11 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
15 # GNU Affero General Public License for more details. |
72 | 16 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
599
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
72 | 19 |
20 from logging import debug, info, warning, error | |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
21 from twisted.internet import defer |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
22 from twisted.words.protocols.jabber import jid |
505
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
23 |
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
24 from sat.core import exceptions |
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
25 |
319 | 26 import uuid |
72 | 27 |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
28 from wokkel import muc |
72 | 29 |
30 | |
31 try: | |
32 from twisted.words.protocols.xmlstream import XMPPHandler | |
33 except ImportError: | |
34 from wokkel.subprotocols import XMPPHandler | |
35 | |
36 PLUGIN_INFO = { | |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
37 "name": "XEP 0045 Plugin", |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
38 "import_name": "XEP-0045", |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
39 "type": "XEP", |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
40 "protocols": ["XEP-0045"], |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
41 "dependencies": [], |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
42 "main": "XEP_0045", |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
43 "handler": "yes", |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
44 "description": _("""Implementation of Multi-User Chat""") |
72 | 45 } |
46 | |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
47 |
505
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
48 class UnknownRoom(Exception): |
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
49 pass |
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
50 |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
51 |
588
beaf6bec2fcd
Remove every old-style class.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
587
diff
changeset
|
52 class XEP_0045(object): |
72 | 53 |
54 def __init__(self, host): | |
55 info(_("Plugin XEP_0045 initialization")) | |
56 self.host = host | |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
57 self.clients = {} |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
58 host.bridge.addMethod("joinMUC", ".plugin", in_sign='ssa{ss}s', out_sign='', method=self._join) |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
59 host.bridge.addMethod("mucNick", ".plugin", in_sign='sss', out_sign='', method=self.mucNick) |
596
98a962d0b23c
plugin XEP-0045: fixed mucLeave bridge method
Goffi <goffi@goffi.org>
parents:
594
diff
changeset
|
60 host.bridge.addMethod("mucLeave", ".plugin", in_sign='ss', out_sign='', method=self.mucLeave, async = True) |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
61 host.bridge.addMethod("getRoomsJoined", ".plugin", in_sign='s', out_sign='a(sass)', method=self.getRoomsJoined) |
450
afe9cfd2ddbb
plugins: radio collective first draft
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
62 host.bridge.addMethod("getRoomsSubjects", ".plugin", in_sign='s', out_sign='a(ss)', method=self.getRoomsSubjects) |
372
f964dcec1611
core: plugins refactored according to bridge + updatedValue now use profile
Goffi <goffi@goffi.org>
parents:
350
diff
changeset
|
63 host.bridge.addMethod("getUniqueRoomName", ".plugin", in_sign='s', out_sign='s', method=self.getUniqueName) |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
64 host.bridge.addSignal("roomJoined", ".plugin", signature='sasss') # args: room_jid, room_nicks, user_nick, profile |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
65 host.bridge.addSignal("roomLeft", ".plugin", signature='ss') # args: room_jid, profile |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
66 host.bridge.addSignal("roomUserJoined", ".plugin", signature='ssa{ss}s') # args: room_jid, user_nick, user_data, profile |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
67 host.bridge.addSignal("roomUserLeft", ".plugin", signature='ssa{ss}s') # args: room_jid, user_nick, user_data, profile |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
68 host.bridge.addSignal("roomUserChangedNick", ".plugin", signature='ssss') # args: room_jid, old_nick, new_nick, profile |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
69 host.bridge.addSignal("roomNewSubject", ".plugin", signature='sss') # args: room_jid, subject, profile |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
70 |
72 | 71 def __check_profile(self, profile): |
75 | 72 """check if profile is used and connected |
73 if profile known but disconnected, remove it from known profiles | |
74 @param profile: profile to check | |
75 @return: True if the profile is known and connected, else False""" | |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
76 if not profile or profile not in self.clients or not self.host.isConnected(profile): |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
77 error(_('Unknown or disconnected profile (%s)') % profile) |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
78 if profile in self.clients: |
72 | 79 del self.clients[profile] |
80 return False | |
81 return True | |
82 | |
83 def __room_joined(self, room, profile): | |
84 """Called when the user is in the requested room""" | |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
85 |
319 | 86 def _sendBridgeSignal(ignore=None): |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
87 self.host.bridge.roomJoined(room.roomJID.userhost(), [user.nick for user in room.roster.values()], room.nick, profile) |
319 | 88 |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
89 room_jid_s = room.roomJID.userhost() |
488
6edb4219fcf7
plugin xep-0045: entity type is changer to chatroom for room joined
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
90 self.host.memory.updateEntityData(room.roomJID, "type", "chatroom", profile) |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
91 self.clients[profile].joined_rooms[room_jid_s] = room |
452
fd455b3ca6d4
plugin XEP-0045: room unlocking fix
Goffi <goffi@goffi.org>
parents:
451
diff
changeset
|
92 if room.locked: |
319 | 93 #FIXME: the current behaviour is to create an instant room |
94 #and send the signal only when the room is unlocked | |
95 #a proper configuration management should be done | |
452
fd455b3ca6d4
plugin XEP-0045: room unlocking fix
Goffi <goffi@goffi.org>
parents:
451
diff
changeset
|
96 print "room locked !" |
fd455b3ca6d4
plugin XEP-0045: room unlocking fix
Goffi <goffi@goffi.org>
parents:
451
diff
changeset
|
97 self.clients[profile].configure(room.roomJID, {}).addCallbacks(_sendBridgeSignal, lambda x: error(_('Error while configuring the room'))) |
319 | 98 else: |
99 _sendBridgeSignal() | |
100 return room | |
101 | |
528
f899f6e2a9d1
plugin XEP-0045: in case of nickname conflict when entering a room, a new one is automaticaly assigned
Goffi <goffi@goffi.org>
parents:
522
diff
changeset
|
102 def __err_joining_room(self, failure, room_jid, nick, history_options, password, profile): |
72 | 103 """Called when something is going wrong when joining the room""" |
528
f899f6e2a9d1
plugin XEP-0045: in case of nickname conflict when entering a room, a new one is automaticaly assigned
Goffi <goffi@goffi.org>
parents:
522
diff
changeset
|
104 if failure.value.condition == 'conflict': |
f899f6e2a9d1
plugin XEP-0045: in case of nickname conflict when entering a room, a new one is automaticaly assigned
Goffi <goffi@goffi.org>
parents:
522
diff
changeset
|
105 # we have a nickname conflict, we try again with "_" suffixed to current nickname |
f899f6e2a9d1
plugin XEP-0045: in case of nickname conflict when entering a room, a new one is automaticaly assigned
Goffi <goffi@goffi.org>
parents:
522
diff
changeset
|
106 nick += '_' |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
107 return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile': profile}, errbackArgs=[room_jid, nick, history_options, password, profile]) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
108 |
183
9ee4a1d0d7fb
Added auto(dis)connect params + misc
Goffi <goffi@goffi.org>
parents:
134
diff
changeset
|
109 mess = _("Error when joining the room") |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
110 error(mess) |
183
9ee4a1d0d7fb
Added auto(dis)connect params + misc
Goffi <goffi@goffi.org>
parents:
134
diff
changeset
|
111 self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile) |
450
afe9cfd2ddbb
plugins: radio collective first draft
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
112 raise failure |
72 | 113 |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
114 def getRoomsJoined(self, profile_key='@DEFAULT@'): |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
115 """Return room where user is""" |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
116 profile = self.host.memory.getProfileName(profile_key) |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
117 result = [] |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
118 if not self.__check_profile(profile): |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
119 return result |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
120 for room in self.clients[profile].joined_rooms.values(): |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
121 result.append((room.roomJID.userhost(), [user.nick for user in room.roster.values()], room.nick)) |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
122 return result |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
123 |
509
64ff046dc201
plugin text commands: added /join command
Goffi <goffi@goffi.org>
parents:
507
diff
changeset
|
124 def getRoomNick(self, room_jid_s, profile_key='@DEFAULT@'): |
93 | 125 """return nick used in room by user |
509
64ff046dc201
plugin text commands: added /join command
Goffi <goffi@goffi.org>
parents:
507
diff
changeset
|
126 @param room_jid_s: unicode room id |
93 | 127 @profile_key: profile |
128 @return: nick or empty string in case of error""" | |
129 profile = self.host.memory.getProfileName(profile_key) | |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
130 if not self.__check_profile(profile) or room_jid_s not in self.clients[profile].joined_rooms: |
93 | 131 return '' |
509
64ff046dc201
plugin text commands: added /join command
Goffi <goffi@goffi.org>
parents:
507
diff
changeset
|
132 return self.clients[profile].joined_rooms[room_jid_s].nick |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
133 |
522
3446ce33247d
plugin XEP-0045: added isNickInRoom method
Goffi <goffi@goffi.org>
parents:
519
diff
changeset
|
134 def isNickInRoom(self, room_jid, nick, profile): |
3446ce33247d
plugin XEP-0045: added isNickInRoom method
Goffi <goffi@goffi.org>
parents:
519
diff
changeset
|
135 """Tell if a nick is currently present in a room""" |
528
f899f6e2a9d1
plugin XEP-0045: in case of nickname conflict when entering a room, a new one is automaticaly assigned
Goffi <goffi@goffi.org>
parents:
522
diff
changeset
|
136 profile = self.host.memory.getProfileName(profile) |
522
3446ce33247d
plugin XEP-0045: added isNickInRoom method
Goffi <goffi@goffi.org>
parents:
519
diff
changeset
|
137 if not self.__check_profile(profile): |
3446ce33247d
plugin XEP-0045: added isNickInRoom method
Goffi <goffi@goffi.org>
parents:
519
diff
changeset
|
138 raise exceptions.UnknownProfileError("Unknown or disconnected profile") |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
139 if room_jid.userhost() not in self.clients[profile].joined_rooms: |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
140 raise UnknownRoom("This room has not been joined") |
599
8d8a2ad163e2
plugin XEP-0045: fixed isNickInRoom
Goffi <goffi@goffi.org>
parents:
596
diff
changeset
|
141 return self.clients[profile].joined_rooms[room_jid.userhost()].inRoster(muc.User(nick)) |
93 | 142 |
450
afe9cfd2ddbb
plugins: radio collective first draft
Goffi <goffi@goffi.org>
parents:
409
diff
changeset
|
143 def getRoomsSubjects(self, profile_key='@DEFAULT@'): |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
144 """Return received subjects of rooms""" |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
145 profile = self.host.memory.getProfileName(profile_key) |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
146 if not self.__check_profile(profile): |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
147 return [] |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
148 return self.clients[profile].rec_subjects.values() |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
149 |
319 | 150 def getUniqueName(self, profile_key='@DEFAULT@'): |
151 """Return unique name for room, avoiding collision""" | |
152 #TODO: we should use #RFC-0045 10.1.4 when available here | |
153 #TODO: we should be able to select the MUC service here | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
154 return uuid.uuid1() |
319 | 155 |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
156 def join(self, room_jid, nick, options, profile_key='@DEFAULT@'): |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
157 def _errDeferred(exc_obj=Exception, txt='Error while joining room'): |
350
abe08fcb42d7
plugin XEP-0045: added error callback to join's deferred, and a callback is created if join fail before calling MUCClient's join
Goffi <goffi@goffi.org>
parents:
319
diff
changeset
|
158 d = defer.Deferred() |
abe08fcb42d7
plugin XEP-0045: added error callback to join's deferred, and a callback is created if join fail before calling MUCClient's join
Goffi <goffi@goffi.org>
parents:
319
diff
changeset
|
159 d.errback(exc_obj(txt)) |
451
4f196e2d3781
plugin xep-0045: fixed missing return deferred
Goffi <goffi@goffi.org>
parents:
450
diff
changeset
|
160 return d |
350
abe08fcb42d7
plugin XEP-0045: added error callback to join's deferred, and a callback is created if join fail before calling MUCClient's join
Goffi <goffi@goffi.org>
parents:
319
diff
changeset
|
161 |
72 | 162 profile = self.host.memory.getProfileName(profile_key) |
163 if not self.__check_profile(profile): | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
164 return _errDeferred() |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
165 if room_jid.userhost() in self.clients[profile].joined_rooms: |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
166 warning(_('%(profile)s is already in room %(room_jid)s') % {'profile': profile, 'room_jid': room_jid.userhost()}) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
167 return _errDeferred() |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
168 info(_("[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile': profile, 'room': room_jid.userhost(), 'nick': nick}) |
72 | 169 |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
170 history_options = options["history"] == "True" if "history" in options else None |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
171 password = options["password"] if "password" in options else None |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
172 |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
173 return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile': profile}, errbackArgs=[room_jid, nick, history_options, password, profile]) |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
174 |
406
b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
175 def _join(self, room_jid_s, nick, options={}, profile_key='@DEFAULT@'): |
319 | 176 """join method used by bridge: use the _join method, but doesn't return any deferred""" |
406
b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
177 profile = self.host.memory.getProfileName(profile_key) |
b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
178 if not self.__check_profile(profile): |
b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
179 return |
b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
180 try: |
b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
181 room_jid = jid.JID(room_jid_s) |
b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
182 except: |
b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
183 mess = _("Invalid room jid: %s") % room_jid_s |
b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
184 warning(mess) |
b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
185 self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile) |
b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
Goffi <goffi@goffi.org>
parents:
405
diff
changeset
|
186 return |
407 | 187 d = self.join(room_jid, nick, options, profile) |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
188 d.addErrback(lambda x: warning(_('Error while joining room'))) # TODO: error management + signal in bridge |
505
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
189 |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
190 def nick(self, room_jid, nick, profile_key): |
505
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
191 profile = self.host.memory.getProfileName(profile_key) |
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
192 if not self.__check_profile(profile): |
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
193 raise exceptions.UnknownProfileError("Unknown or disconnected profile") |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
194 if room_jid.userhost() not in self.clients[profile].joined_rooms: |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
195 raise UnknownRoom("This room has not been joined") |
505
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
196 return self.clients[profile].nick(room_jid, nick) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
197 |
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
198 def leave(self, room_jid, profile_key): |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
199 profile = self.host.memory.getProfileName(profile_key) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
200 if not self.__check_profile(profile): |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
201 raise exceptions.UnknownProfileError("Unknown or disconnected profile") |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
202 if room_jid.userhost() not in self.clients[profile].joined_rooms: |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
203 raise UnknownRoom("This room has not been joined") |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
204 return self.clients[profile].leave(room_jid) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
205 |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
206 def subject(self, room_jid, subject, profile_key): |
515
29b5ef129488
plugin XEP-0045, plugin text commands: added '/title' command
Goffi <goffi@goffi.org>
parents:
509
diff
changeset
|
207 profile = self.host.memory.getProfileName(profile_key) |
29b5ef129488
plugin XEP-0045, plugin text commands: added '/title' command
Goffi <goffi@goffi.org>
parents:
509
diff
changeset
|
208 if not self.__check_profile(profile): |
29b5ef129488
plugin XEP-0045, plugin text commands: added '/title' command
Goffi <goffi@goffi.org>
parents:
509
diff
changeset
|
209 raise exceptions.UnknownProfileError("Unknown or disconnected profile") |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
210 if room_jid.userhost() not in self.clients[profile].joined_rooms: |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
211 raise UnknownRoom("This room has not been joined") |
515
29b5ef129488
plugin XEP-0045, plugin text commands: added '/title' command
Goffi <goffi@goffi.org>
parents:
509
diff
changeset
|
212 return self.clients[profile].subject(room_jid, subject) |
29b5ef129488
plugin XEP-0045, plugin text commands: added '/title' command
Goffi <goffi@goffi.org>
parents:
509
diff
changeset
|
213 |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
214 def mucNick(self, room_jid_s, nick, profile_key='@DEFAULT@'): |
505
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
215 """Change nickname in a room""" |
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
216 return self.nick(jid.JID(room_jid_s), nick, profile_key) |
2402668b5d05
plugin xep-0045: nick change management
Goffi <goffi@goffi.org>
parents:
488
diff
changeset
|
217 |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
218 def mucLeave(self, room_jid_s, profile_key='@DEFAULT@'): |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
219 """Leave a room""" |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
220 return self.leave(jid.JID(room_jid_s), profile_key) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
221 |
72 | 222 def getHandler(self, profile): |
223 self.clients[profile] = SatMUCClient(self) | |
224 return self.clients[profile] | |
225 | |
226 | |
227 class SatMUCClient (muc.MUCClient): | |
228 #implements(iwokkel.IDisco) | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
229 |
72 | 230 def __init__(self, plugin_parent): |
231 self.plugin_parent = plugin_parent | |
232 self.host = plugin_parent.host | |
233 muc.MUCClient.__init__(self) | |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
234 self.joined_rooms = {} # FIXME: seem to do the same thing as MUCClient's _rooms attribute, must be removed |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
235 self.rec_subjects = {} |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
236 self.__changing_nicks = set() # used to keep trace of who is changing nick, |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
237 # and to discard userJoinedRoom signal in this case |
72 | 238 print "init SatMUCClient OK" |
515
29b5ef129488
plugin XEP-0045, plugin text commands: added '/title' command
Goffi <goffi@goffi.org>
parents:
509
diff
changeset
|
239 |
29b5ef129488
plugin XEP-0045, plugin text commands: added '/title' command
Goffi <goffi@goffi.org>
parents:
509
diff
changeset
|
240 def subject(self, room, subject): |
29b5ef129488
plugin XEP-0045, plugin text commands: added '/title' command
Goffi <goffi@goffi.org>
parents:
509
diff
changeset
|
241 return muc.MUCClientProtocol.subject(self, room, subject) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
242 |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
243 def unavailableReceived(self, presence): |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
244 #XXX: we override this method to manage nickname change |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
245 #TODO: feed this back to Wokkel |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
246 """ |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
247 Unavailable presence was received. |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
248 |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
249 If this was received from a MUC room occupant JID, that occupant has |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
250 left the room. |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
251 """ |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
252 room, user = self._getRoomUser(presence) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
253 |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
254 if room is None or user is None: |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
255 return |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
256 |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
257 room.removeUser(user) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
258 |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
259 if muc.STATUS_CODE.NEW_NICK in presence.mucStatuses: |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
260 self.__changing_nicks.add(presence.nick) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
261 self.userChangedNick(room, user, presence.nick) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
262 else: |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
263 self.__changing_nicks.discard(presence.nick) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
264 self.userLeftRoom(room, user) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
265 |
72 | 266 def receivedGroupChat(self, room, user, body): |
267 debug('receivedGroupChat: room=%s user=%s body=%s', room, user, body) | |
268 | |
74
6e3a06b4dd36
plugin xep-0045: added roomUserJoined and roomUserLeft signals
Goffi <goffi@goffi.org>
parents:
73
diff
changeset
|
269 def userJoinedRoom(self, room, user): |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
270 if user.nick in self.__changing_nicks: |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
271 self.__changing_nicks.remove(user.nick) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
272 else: |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
273 debug(_("user %(nick)s has joined room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()}) |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
274 if not self.host.trigger.point("MUC user joined", room, user, self.parent.profile): |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
275 return |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
276 user_data = {'entity': user.entity.full() if user.entity else '', 'affiliation': user.affiliation, 'role': user.role} |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
277 self.host.bridge.roomUserJoined(room.roomJID.userhost(), user.nick, user_data, self.parent.profile) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
278 |
74
6e3a06b4dd36
plugin xep-0045: added roomUserJoined and roomUserLeft signals
Goffi <goffi@goffi.org>
parents:
73
diff
changeset
|
279 def userLeftRoom(self, room, user): |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
280 if user.nick == room.nick: |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
281 # we left the room |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
282 room_jid_s = room.roomJID.userhost() |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
283 info(_("Room [%(room)s] left (%(profile)s))") % {"room": room_jid_s, |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
284 "profile": self.parent.profile}) |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
285 self.host.memory.delEntityCache(room.roomJID, self.parent.profile) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
286 del self.plugin_parent.clients[self.parent.profile].joined_rooms[room_jid_s] |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
287 self.host.bridge.roomLeft(room.roomJID.userhost(), self.parent.profile) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
288 else: |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
289 debug(_("user %(nick)s left room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()}) |
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
290 user_data = {'entity': user.entity.full() if user.entity else '', 'affiliation': user.affiliation, 'role': user.role} |
507
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
291 self.host.bridge.roomUserLeft(room.roomJID.userhost(), user.nick, user_data, self.parent.profile) |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
292 |
f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents:
505
diff
changeset
|
293 def userChangedNick(self, room, user, new_nick): |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
294 self.host.bridge.roomUserChangedNick(room.roomJID.userhost(), user.nick, new_nick, self.parent.profile) |
72 | 295 |
77
1ae680f9682e
wix: MUC groupchat management + short nick shown in chat window instead of full jid when possible
Goffi <goffi@goffi.org>
parents:
76
diff
changeset
|
296 def userUpdatedStatus(self, room, user, show, status): |
1ae680f9682e
wix: MUC groupchat management + short nick shown in chat window instead of full jid when possible
Goffi <goffi@goffi.org>
parents:
76
diff
changeset
|
297 print("FIXME: MUC status not managed yet") |
522
3446ce33247d
plugin XEP-0045: added isNickInRoom method
Goffi <goffi@goffi.org>
parents:
519
diff
changeset
|
298 #FIXME: |
77
1ae680f9682e
wix: MUC groupchat management + short nick shown in chat window instead of full jid when possible
Goffi <goffi@goffi.org>
parents:
76
diff
changeset
|
299 |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
300 def receivedSubject(self, room, user, subject): |
594
e629371a28d3
Fix pep8 support in src/plugins.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
588
diff
changeset
|
301 debug(_("New subject for room (%(room_id)s): %(subject)s") % {'room_id': room.roomJID.full(), 'subject': subject}) |
405
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
302 self.rec_subjects[room.roomJID.userhost()] = (room.roomJID.userhost(), subject) |
10b4f577d0c0
MUC update to follow wokkel's MUC branch update
Goffi <goffi@goffi.org>
parents:
372
diff
changeset
|
303 self.host.bridge.roomNewSubject(room.roomJID.userhost(), subject, self.parent.profile) |
76 | 304 |
72 | 305 #def connectionInitialized(self): |
306 #pass | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
307 |
72 | 308 #def getDiscoInfo(self, requestor, target, nodeIdentifier=''): |
309 #return [disco.DiscoFeature(NS_VCARD)] | |
310 | |
311 #def getDiscoItems(self, requestor, target, nodeIdentifier=''): | |
312 #return [] |