18 event_chat_buddy_join,
19 event_chat_buddy_leave,
24 event_new_conversation,
27 event_im_displayed_sent,
28 event_im_displayed_rcvd,
29 event_chat_send_invite
32 To add a signal handler, call the fuction gaim_signal_connect with the
35 void *, enum gaim_event, void *, void *
37 The first arg is the handle that was passed to gaim_signal_init. You did
39 The second arg is hopefully obvious.
40 The third arg is a pointer to a function that takes various args
41 depending on which event you're dealing with.
42 The fourth arg is any data you want to send to your function, as a final
45 To remove a signal handler, call the function gaim_signal_disconnect with the
48 void *, enum gaim_event, void *
50 The first arg is the handle that was passed to gaim_signal_init.
51 The second arg is hopefully obvious.
52 The third arg is a pointer to the function you attached.
54 Note that it deletes *all* functions matching the function you pass, not just
55 one. Sorry, that's just the way it works.
57 So here are the args that get passed to your functions in various events:
60 struct gaim_connection *gc
62 'gc' is the new connection.
65 struct gaim_connection *gc
67 'gc' is the connection that is about to go offline. This is called before
68 serv_close is, so you still have a chance to get one last message out.
71 struct gaim_connection *gc, char *state, char *message
73 'gc' is the connection. Duh.
74 'state' is confusing. We'll save that for now.
75 'message' is the away message to be used.
77 Each protocol sets up what away states it can have. These are all char *,
78 and when the connection goes away it uses one of those. That's what state
81 There's no way of telling from state and message whether you're actually
82 away; it only gives state information, and a possible message.
84 However, the protocols also are very nice (usually) and will set gc->away
85 if they're in an away-like state (e.g. Away or N/A for ICQ, etc). You can
86 use that for a more rigid (read "boolean") way of checking away-ness.
91 This is deprecated and will not be called again. It will probably be
95 struct gaim_connection *gc, char **who, char **text, guint32 flags
97 'gc' is the connection that received the message.
98 'who' is the username of the person who sent the message.
99 'text' is the actual strict text (with HTML tags and all) of the
101 'flags' is message flags.
103 Note that you can modify these values. (You are encouraged to do so!)
104 Note that *other* plugins can also modify these values, so you should
105 check that they are not NULL, and try not to leave them as NULL.
107 gc was placed as the first arg as opposed to the third for intuitiveness.
108 Unfortunately, it means that most plugins that use this event need to be
109 slightly modified and then recompiled.
111 flags is actually a bit mask. AND with IM_FLAG_AWAY to see if they were
115 struct gaim_connection *gc, char *who, char **text
117 'gc' is the connection that you are about to send the message through.
118 'who' is the username of the person you're sending the message to.
119 'text' is the actual strict text (with HTML tags and all) of the
120 message you're sending.
122 Note that you can modify outgoing text. The **text points to a g_malloc'd
123 data chunk that contains the text. If your plugin changes it, it should
124 either not add length to the string, or g_free *text and g_malloc a new
125 segment. Since plugins can modify this, you should not try and remember it
129 struct gaim_connection *gc, char *who
131 'who' is who signed on. (There is currently no way to see which connection
132 reported that the buddy came online. Hopefully this will happen soon.)
135 struct gaim_connection *gc, char *who
137 'who' is who signed off.
140 struct gaim_connection *gc, char *who
142 'who' is who went away.
145 struct gaim_connection *gc, char *who
147 'who' is who is no longer away.
150 struct gaim_connection *gc, char *who
152 'who' is who went idle.
155 struct gaim_connection *gc, char *who
157 'who' is who is no longer idle.
162 called when the idle times are updated in the buddy list
165 struct gaim_connection *gc, char *who, char *room, char *message
167 'gc' is the connection that received the invitation.
168 'who' is who invited you to a chat room.
169 'room' is the room they invited you to.
170 'message' is the (optional) message they sent to invite you, and may be
174 struct gaim_connection *gc, int id, char *room
176 'gc' is the connection that joined the room.
177 'id' is the id of the room. See, each room is given an id unique
178 within the connection. The struct conversation*'s in gc->buddy_chats
179 have an 'id' field that's only used if it's is_chat member is TRUE.
180 'id' is the *only* way to detect which chat room you actually mean,
181 because the name of the chat room is not always unique (for example,
182 MSN always uses "MSN Chat" as its name, since group chats in MSN
183 don't actually have names).
184 'room' is the chat room that you have just joined.
187 struct gaim_connection *gc, int
189 'gc' is the connection that joined the room.
190 'id' is the id of the chat room that you have just left.
192 event_chat_buddy_join:
193 struct gaim_connection *gc, int id, char *who
195 'gc' is the connection that the chat room is attached to.
196 'id' is the id of the room the person joined.
197 'who' is the screenname of the person who joined.
199 This is also triggered upon entering the room for every person in the
200 room, including yourself. (E.g. if you join a room that already had 3
201 people in it this will be called 4 times, once for each of them and
202 once again for you. You will not always be the last one this is called
205 event_chat_buddy_leave:
206 struct gaim_connection *gc, int id, char *who
208 'gc' is the connection that the chat room is attached to.
209 'id' is the id of the room the person left.
210 'who' is the screenname of the person who left.
213 struct gaim_connection *gc, int id, char *who, char *text
215 'gc' is the connection that received the message.
217 'text' is the message that got sent.
218 'id' is the id of the room that received the message (see
221 Note that because of the bizarre way chat works, you also receive
222 messages that you send. I didn't design it, AOL did.
225 struct gaim_connection *gc, int id, char **text
227 'gc' is the connection that the message is about to be sent on.
228 'id' is the id of the room to which you're sending the message.
229 'text' is what you're about to say, linkified/HTML-ized, but not
232 Be aware that you receive messages you send (as noted above). This
233 event will be called before you actually send the message though.
234 The **text pointer behaves the same as the **text pointer for the
235 event_im_send event above; so read the note about it there.
238 struct gaim_connection *gc, char *who, int level
240 'gc' is the account that got warned.
241 'who' is who warned you. Note that this can be NULL, indicating either
242 an anonymous warning, or your warning level has dropped.
243 'level' is your new warning level.
248 Called when gaim quits normally. This can be called from either the
249 signed on state or the signed off state (from either the Cancel button
250 in the login window or the Quit option in the File menu on the buddy
251 list). If gaim dies or is murdered, this won't be called. It's not my
254 event_new_conversation:
257 'who' is who the conversation is with. This gets called when a new
258 conversation window is created. You can use find_conversation(char *)
259 to then find the struct conversation * and modify those values.
262 struct gaim_connection *gc, char *info
264 Called when the user sends his profile to the server. 'info' is the
268 GtkWidget *menu, char *name
270 Called when you right-click on a buddy.
272 'menu' is the menu that is about to be displayed.
273 'name' is the name of the buddy that was clicked.
275 event_im_displayed_sent:
276 struct gaim_connection *gc, char *who, char **what
278 This is called after what you send is displayed but before it's
279 actually sent. That is, when the user clicks the "send" button
280 in an IM window, first it gets passed to event_im_send handlers,
281 then it gets displayed, then it gets passed to these handlers, and
282 then it gets sent over the wire. This is useful for when you want
283 to encrypt something on the way out.
285 'gc' is the connection the message is sent on.
286 'who' is who the message is for.
287 'what' is what was sent. It's expected that you modify this. If
288 you set *what to NULL the message won't be sent, but the preferred
289 way of doing this is to attach to event_im_send so that it really
290 won't be displayed at all.
292 event_im_displayed_rcvd:
293 struct gaim_connection *gc, char *who, char *what, guint32 flags
295 This is called after what you receive is displayed. This is useful
296 for displaying an autoresponse after the message that triggered it.
297 There are a bunch of things that are odd about this, especially
298 when dealing with being away, so be careful.
300 'gc' is the connection the message was received on.
301 'who' is who sent the message.
302 'what' is what was sent.
303 'flags' is flags on the message.
305 event_chat_send_invite:
306 struct gaim_connection *gc, int id, char *who, char **msg
308 This is called just before you're about to invite someone. It's
309 useful for if you want to pass someone a key so that they can
310 participate in a group encrypted chat (ahem).
312 'gc' is the connection the invite is sent on.
313 'id' is the id of the room you're inviting them to.
314 'who' is who you're inviting.
315 'msg' is the message they'll receive when they're invited. It may be
316 NULL. Setting this to NULL won't stop the invitation from going thru.