summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/en/plugins.txt27
-rw-r--r--src/events.py4
-rw-r--r--src/tabs.py5
3 files changed, 36 insertions, 0 deletions
diff --git a/doc/en/plugins.txt b/doc/en/plugins.txt
index f31086dc..9d81ad66 100644
--- a/doc/en/plugins.txt
+++ b/doc/en/plugins.txt
@@ -310,6 +310,33 @@ MUC. The parameters given to this handler are:
* _presence_: The presence about to be sent.
+The following can be deduced from the muc_presence event, but are more
+ specialized.
+
+*muc_join*:: +presence+, +tab+ +
+The handlers for this event are called when someone joins a MUC (can be you).
+
+* _presence_: Presence received.
+* _tab_: Tab of the concerned MUC.
+
+*muc_nickchange*:: +presence+, +tab+ +
+The handlers for this event are called when someone changes his nick in a MUC.
+
+* _presence_: Presence received.
+* _tab_: Tab of the concerned MUC.
+
+*muc_ban*:: +presence+, +tab+ +
+The handlers for this event are called when someone gets banned in a MUC.
+
+* _presence_: Presence received.
+* _tab_: Tab of the concerned MUC.
+
+*muc_kick*:: +presence+, +tab+ +
+The handlers for this event are called when someone gets kicked in a MUC.
+
+* _presence_: Presence received.
+* _tab_: Tab of the concerned MUC.
+
SleekXMPP events
~~~~~~~~~~~~~~~~
diff --git a/src/events.py b/src/events.py
index e94acb80..8def6cb0 100644
--- a/src/events.py
+++ b/src/events.py
@@ -35,6 +35,10 @@ class EventHandler(object):
'private_chatstate': [],
'normal_presence': [],
'muc_presence': [],
+ 'muc_join': [],
+ 'muc_kick': [],
+ 'muc_nickchange': [],
+ 'muc_ban': [],
'send_normal_presence': [],
}
diff --git a/src/tabs.py b/src/tabs.py
index 55e3154c..17d1e739 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -1123,6 +1123,7 @@ class MucTab(ChatTab):
if from_nick not in [user.nick for user in self.users] and typ != "unavailable":
new_user = User(from_nick, affiliation, show, status, role, jid)
self.users.append(new_user)
+ self.core.events.trigger('muc_join', presence, self)
if from_nick == self.own_nick:
self.joined = True
if self.get_name() in self.core.initial_joins:
@@ -1143,14 +1144,18 @@ class MucTab(ChatTab):
user = self.get_user_by_name(from_nick)
# New user
if not user:
+ self.core.events.trigger('muc_join', presence, self)
self.on_user_join(from_nick, affiliation, show, status, role, jid)
# nick change
elif change_nick:
+ self.core.events.trigger('muc_nickchange', presence, self)
self.on_user_nick_change(presence, user, from_nick, from_room)
elif ban:
+ self.core.events.trigger('muc_ban', presence, self)
self.on_user_banned(presence, user, from_nick)
# kick
elif kick:
+ self.core.events.trigger('muc_kick', presence, self)
self.on_user_kicked(presence, user, from_nick)
# user quit
elif typ == 'unavailable':