Here are some information about the way Gajim works.
NOTE: This page is completly out of date and wrong
Global Behaviour
http://trac.gajim.org/trac/imgs/Dia_Gajim.png
- The xmpppy library manage connection with the jabber server. It parses the XML elements from the server, and helps in creating XML elements to send back to the server.
- The connection module handle incoming events once they are parsed, and send send XML elements thanks to xmpppy library.
- Packets coming from the Jabber network pass through the xmpppy module which parse XML elements, and call functions in connection module depending on what event has arrived. Then connection.py extract needed information from the stanza, and sends events to the GUI module. Finally, the GUI module shows correct information to the user.
This design provides an easy way to draw a differente GUI (in curses, in qt, ...) easily.
Jabber <-> Client events
Jabber --> Client events
Here are the different types of event we can receive from the jabber server:
- presence: the presence events can be of one of these types :
- available: when a contact connects to the jabber network.
- unavailable: when a contact disconnects from the jabber network.
- subscribe: when a contact wishes to add us to its contact list.
- unsubscribe: when a contact removed us from its contact list.
- unsubscribed: when we have removed a contact from our contact list.
- error: when we cannot know the status of a contact (server connect timeout, ...).
- message: when we receive a message from a contact. They can be of one of these types :
- normal: it's the default value if no type is given. They go to a single message window.
- chat: they go to a chat window in which we see previous messages from both contact and us.
- groupchat: they comes from a groupchat conference and go in such a window where we see messages from all occupants of the conference.
- error: they contain error messages (error while sending a message to a contcat, ...)
- vCard: when we receive a vCard from a contact or our vCard.
connection <-> GUI events
kind of message: they are described just below. account: it is the account for which the messages is for. data: data associated with the message. It is a single value if only one data is needed, or a list if several are needed.
connection --> GUI events
These messages are sent in a list that the GUI regulary scans. They is one list per connection instance in gajim.events_for_ui[account]. Events are formated as a list: [event_name, data]
account is the name of the account.
event_name are described below.
data is a list of arguments of this event.
- ROSTER: contacts and agents list for the given account. "data" contains the status of this account and a dict: {jid1: {'name': nickname we gave to the contact, 'show': connection status, 'status': message status, 'groups': list of groups in which the contact is, 'sub': the subscription status,'ask': the subscription we asked}, jid2: {...}, ...}.
- ROSTER_INFO: a contact has changed one of its field (ask or sub or so). "data" contains the new values of these fields: (jid, name, sub, ask, groups).
- WARNING: a warning message. "account" is None, and "data" is the error string to be printed.
- STATUS: confirmation that our status has changed. "data" contains the new connexion status.
- NOTIFY: a contact has changed its connection status. "data" is a python tuple: (jid, status, message, resource, priority, keyID, role, affiliation, real_jid, reason, actor, statusCode).
- MSG: A received message. "data" is a python tuple: (jid, message, time).
- MSGSENT: Confirmation that a message has been sent. "data" is a python tuple: (jid, message, keyID).
- SUBSCRIBE: Someone wants to adds us to its list. "data" contain (jid, subscribe_message).
- SUBSCRIBED: A contact has accepted our subscription request and is now in our roster. "data" contain (jid, resource).
- UNSUBSCRIBED: A contact has removed us from its contact list. "data" is the jid.
- AGENTS: List of agents available on the server. It is an answer to REQ_AGENTS message. "data" contain the list of agents.
- AGENT_INFO: Information about an agent. "data" contain (agent, identities, features, items)
- REG_AGENT_INFO: information to subscrbe to an agent. It is an answer to REG_AGENT_INFO message. "data" contain (agent, infos). info is a dictionnary with information such as {'instructions': , 'login': , 'password': } (it depends on the agent)
- ACC_OK: A new account has been succefully created. It's an answer to NEW_ACC message. "data" contains (hostname, login, password, name, resource, prio, use_proxy, proxyhost, proxyport)
- CONFIG: Gives the configuration for accounts or a plugin. "data" contains (for_who, config). for_who is the plugin for whom the config is destinated.
- GC_MSG: A message for a groupchat. "data" contains (jid, msg, time).
- GC_SUBJECT: The subject of a groupchat window has changed. "data" contains (room_jid, subject).
- BAD_PASSPHRASE: The passphrase for GPG we provided is wrong.
- GPG_SECRETE_KEYS: The list of GPG secret keys available on the machine where the Core runs. "data" is this list.
- QUIT: The Core asks the plugin to close itself.
- MYVCARD: Our Vcard. "data" is the dictionnary of Vcard information.
- VCARD: The Vcard of a contact. "data" is the dictionnary of Vcard information.
- LOG_NB_LINE: Number of line in the log file of a contact. "data" contains (jid, nb_line).
- LOG_LINE: A line of a log file. "data" contains (jid, number_of_the_line, date, type, data). If type is 'recv' or 'sent', data [log_line]. Else, it's a status message. In that case, type contains the contact jid and data contains [status, status_message].
- VISUAL: If a plugin registers to this kind of message, the Core will sent the saved messaged to it. Messages are saved if, for example, no visualisation plugin is registered (The Core run without the gtkgui plugin).
Plugins --> Core messages
- QUIT:
- ASK_ROSTER:
- ASK_CONFIG:
- CONFIG:
- STATUS:
- MSG:
- SUB:
- REQ:
- DENY:
- UNSUB:
- UNSUB_AGENT:
- UPDUSER:
- REQ_AGENTS:
- REG_AGENT_INFO:
- REG_AGENT:
- NEW_ACC:
- ACC_CHG:
- ASK_VCARD:
- VCARD:
- AGENT_LOGGING:
- LOG_NB_LINE:
- LOG_GET_RANGE:
- REG_MESSAGE:
- GC_JOIN:
- GC_MSG:
- GC_SUBJECT:
- GC_STATUS:
- GC_SET_ROLE:
- GC_SET_AFFILIATION:
- GPGPASSPHRASE:
- CHANGE_PASSWORD:
