summaryrefslogtreecommitdiff
path: root/src/handler.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-01-21 01:54:50 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-01-21 01:54:50 +0000
commitf36fefdce5d9369516a7d88528902b5081080876 (patch)
treee9f017cf7f2f7bd92cc134874cc907fe056d944a /src/handler.py
parent6a2917fca8d2c15ac63967a033f001b021623510 (diff)
downloadpoezio-f36fefdce5d9369516a7d88528902b5081080876.tar.gz
poezio-f36fefdce5d9369516a7d88528902b5081080876.tar.bz2
poezio-f36fefdce5d9369516a7d88528902b5081080876.tar.xz
poezio-f36fefdce5d9369516a7d88528902b5081080876.zip
on peut parler, recevoir des messages, rejoindre des salons (/join), changer de tab (/next, /prev), mais ca blink et c'est nul
Diffstat (limited to 'src/handler.py')
-rw-r--r--src/handler.py140
1 files changed, 75 insertions, 65 deletions
diff --git a/src/handler.py b/src/handler.py
index b08280a0..5d7831e7 100644
--- a/src/handler.py
+++ b/src/handler.py
@@ -18,7 +18,9 @@
from singleton import Singleton
class Handler(Singleton):
- """This class is the global handler for the software's signals."""
+ """
+ This class is the global handler for the software's signals.
+ """
__is_first_instance = True
def __init__(self):
@@ -26,96 +28,104 @@ class Handler(Singleton):
Handler.__is_first_instance = False
self.__signals__ = {
- # - XMPP's core handlers (don't use outside of src/jabber/*.py)
- 'xmpp-presence-handler': list(),
- # A presence is received
- # Args: the stanza object
+ 'on-connected': list(),
+ # At the end of a successful connection process.
+ # emitted when presence confirmation is received
- 'xmpp-iq-handler': list(),
- # An iq is received
+ 'join-room': list(),
+ # Join a room.
+ # Args: room, nick
+
+ 'room-presence': list(),
+ # A presence is received
# Args: the stanza object
- 'xmpp-message-handler': list(),
+ 'room-message': list(),
# A message is received
# Args: the stanza object
- # - GUI event
+ # 'xmpp-presence-handler': list(),
+ # # A presence is received
+ # # Args: the stanza object
- 'on-quit': list(),
- # When the user wants to quit.
+ # 'xmpp-iq-handler': list(),
+ # # An iq is received
+ # # Args: the stanza object
- # - Roster and presence
+ # 'xmpp-message-handler': list(),
+ # # A message is received
+ # # Args: the stanza object
- 'on-connected': list(),
- # At the end of a successful connection process.
+ # # - GUI event
- 'on-disconnected': list(),
- # When the user is disconnected from the server.
+ # 'on-quit': list(),
+ # # When the user wants to quit.
- 'on-message-received': list(),
- # When a message is received.
- # Args: jid, msg, subject, typ
+ # # - Roster and presence
- 'send-message': list(),
- # Send a message to someone.
- # Args: jid, msg, subj, typ
+ # 'on-disconnected': list(),
+ # # When the user is disconnected from the server.
- # - vCard (XEP-0054)
+ # 'on-message-received': list(),
+ # # When a message is received.
+ # # Args: jid, msg, subject, typ
- 'vcard-request': list(),
- # Request a vcard.
- # Args: jid
+ # 'send-message': list(),
+ # # Send a message to someone.
+ # # Args: jid, msg, subj, typ
- 'on-vcard-received': list(),
- # When a vcard is received.
- # Args: jid, vcard
+ # # - vCard (XEP-0054)
- # - Multi-User Chat (XEP-0045)
+ # 'vcard-request': list(),
+ # # Request a vcard.
+ # # Args: jid
- 'gui-join-room': list(),
- # Join a room inside the GUI (call `join-room`).
- # Args: room, nickname
+ # 'on-vcard-received': list(),
+ # # When a vcard is received.
+ # # Args: jid, vcard
- 'join-room': list(),
- # Join a room.
- # Args: room, nick
+ # # - Multi-User Chat (XEP-0045)
- 'quit-room': list(),
- # Quit a room.
- # Args: room, nick
+ # 'gui-join-room': list(),
+ # # Join a room inside the GUI (call `join-room`).
+ # # Args: room, nickname
- 'on-muc-message-received': list(),
- # When a message is received.
- # Args: jid, msg, subject, typ, stanza
+ # 'quit-room': list(),
+ # # Quit a room.
+ # # Args: room, nick
- 'on-muc-presence-changed': list(),
- # When someone in the roster changes his presence.
- # Args: jid, priority, show, status, stanza
+ # 'on-muc-message-received': list(),
+ # # When a message is received.
+ # # Args: jid, msg, subject, typ, stanza
- 'on-muc-error': list(),
- # When the MUC composant sends an error
- # Args: room, code, msg
+ # 'on-muc-presence-changed': list(),
+ # # When someone in the roster changes his presence.
+ # # Args: jid, priority, show, status, stanza
- 'eject-user': list(),
- # When the user try to eject another one.
- # Args: room, action, nick, reason
+ # 'on-muc-error': list(),
+ # # When the MUC composant sends an error
+ # # Args: room, code, msg
- 'change-user-role': list(),
- # When the user try to change the role of someone.
- # Args: room, nick, role
+ # 'eject-user': list(),
+ # # When the user try to eject another one.
+ # # Args: room, action, nick, reason
- 'change-user-affiliation': list(),
- # When the user try to change the affiliation of someone.
- # Args: room, jid, aff
+ # 'change-user-role': list(),
+ # # When the user try to change the role of someone.
+ # # Args: room, nick, role
- 'change-subject': list(),
- # When the user try to change the topic.
- # Args: room, subject
+ # 'change-user-affiliation': list(),
+ # # When the user try to change the affiliation of someone.
+ # # Args: room, jid, aff
- 'change-nick': list()
- # When the user try to change his nick.
- # Args: room, nick
+ # 'change-subject': list(),
+ # # When the user try to change the topic.
+ # # Args: room, subject
+
+ # 'change-nick': list()
+ # # When the user try to change his nick.
+ # # Args: room, nick
}
def connect(self, signal, func):
@@ -123,7 +133,7 @@ class Handler(Singleton):
if func not in self.__signals__[signal]:
self.__signals__[signal].append(func)
else:
- print "%s doesn't exist." % signal
+ print "signal %s doesn't exist." % signal
def emit(self, signal, **kwargs):
"""Emit a signal."""
@@ -131,4 +141,4 @@ class Handler(Singleton):
for func in self.__signals__[signal]:
func(**kwargs)
else:
- print "%s doesn't exist." % signal
+ print "signal %s doesn't exist." % signal