| 201 toast->timer = g_timeout_add(4000, (GSourceFunc)remove_toaster, toast); |
201 toast->timer = g_timeout_add(4000, (GSourceFunc)remove_toaster, toast); |
| 202 toasters = g_list_prepend(toasters, toast); |
202 toasters = g_list_prepend(toasters, toast); |
| 203 } |
203 } |
| 204 |
204 |
| 205 static void |
205 static void |
| 206 buddy_signed_on(GaimBuddy *buddy, gpointer null) |
206 buddy_signed_on(PurpleBuddy *buddy, gpointer null) |
| 207 { |
207 { |
| 208 if (gaim_prefs_get_bool(PREFS_EVENT_SIGNONF)) |
208 if (purple_prefs_get_bool(PREFS_EVENT_SIGNONF)) |
| 209 notify(_("%s just signed on"), gaim_buddy_get_alias(buddy)); |
209 notify(_("%s just signed on"), purple_buddy_get_alias(buddy)); |
| 210 } |
210 } |
| 211 |
211 |
| 212 static void |
212 static void |
| 213 buddy_signed_off(GaimBuddy *buddy, gpointer null) |
213 buddy_signed_off(PurpleBuddy *buddy, gpointer null) |
| 214 { |
214 { |
| 215 if (gaim_prefs_get_bool(PREFS_EVENT_SIGNONF)) |
215 if (purple_prefs_get_bool(PREFS_EVENT_SIGNONF)) |
| 216 notify(_("%s just signed off"), gaim_buddy_get_alias(buddy)); |
216 notify(_("%s just signed off"), purple_buddy_get_alias(buddy)); |
| 217 } |
217 } |
| 218 |
218 |
| 219 static void |
219 static void |
| 220 received_im_msg(GaimAccount *account, const char *sender, const char *msg, |
220 received_im_msg(PurpleAccount *account, const char *sender, const char *msg, |
| 221 GaimConversation *conv, GaimMessageFlags flags, gpointer null) |
221 PurpleConversation *conv, PurpleMessageFlags flags, gpointer null) |
| 222 { |
222 { |
| 223 if (gaim_prefs_get_bool(PREFS_EVENT_IM_MSG)) |
223 if (purple_prefs_get_bool(PREFS_EVENT_IM_MSG)) |
| 224 notify(_("%s sent you a message"), sender); |
224 notify(_("%s sent you a message"), sender); |
| 225 } |
225 } |
| 226 |
226 |
| 227 static void |
227 static void |
| 228 received_chat_msg(GaimAccount *account, const char *sender, const char *msg, |
228 received_chat_msg(PurpleAccount *account, const char *sender, const char *msg, |
| 229 GaimConversation *conv, GaimMessageFlags flags, gpointer null) |
229 PurpleConversation *conv, PurpleMessageFlags flags, gpointer null) |
| 230 { |
230 { |
| 231 const char *nick; |
231 const char *nick; |
| 232 |
232 |
| 233 if (flags & GAIM_MESSAGE_WHISPER) |
233 if (flags & PURPLE_MESSAGE_WHISPER) |
| 234 return; |
234 return; |
| 235 |
235 |
| 236 nick = GAIM_CONV_CHAT(conv)->nick; |
236 nick = PURPLE_CONV_CHAT(conv)->nick; |
| 237 |
237 |
| 238 if (g_utf8_collate(sender, nick) == 0) |
238 if (g_utf8_collate(sender, nick) == 0) |
| 239 return; |
239 return; |
| 240 |
240 |
| 241 if (gaim_prefs_get_bool(PREFS_EVENT_CHAT_NICK) && |
241 if (purple_prefs_get_bool(PREFS_EVENT_CHAT_NICK) && |
| 242 (gaim_utf8_has_word(msg, nick))) |
242 (purple_utf8_has_word(msg, nick))) |
| 243 notify(_("%s said your nick in %s"), sender, gaim_conversation_get_name(conv)); |
243 notify(_("%s said your nick in %s"), sender, purple_conversation_get_name(conv)); |
| 244 else if (gaim_prefs_get_bool(PREFS_EVENT_CHAT_MSG)) |
244 else if (purple_prefs_get_bool(PREFS_EVENT_CHAT_MSG)) |
| 245 notify(_("%s sent a message in %s"), sender, gaim_conversation_get_name(conv)); |
245 notify(_("%s sent a message in %s"), sender, purple_conversation_get_name(conv)); |
| 246 } |
246 } |
| 247 |
247 |
| 248 static gboolean |
248 static gboolean |
| 249 plugin_load(GaimPlugin *plugin) |
249 plugin_load(PurplePlugin *plugin) |
| 250 { |
250 { |
| 251 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", plugin, |
251 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", plugin, |
| 252 GAIM_CALLBACK(buddy_signed_on), NULL); |
252 PURPLE_CALLBACK(buddy_signed_on), NULL); |
| 253 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off", plugin, |
253 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", plugin, |
| 254 GAIM_CALLBACK(buddy_signed_off), NULL); |
254 PURPLE_CALLBACK(buddy_signed_off), NULL); |
| 255 gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg", plugin, |
255 purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", plugin, |
| 256 GAIM_CALLBACK(received_im_msg), NULL); |
256 PURPLE_CALLBACK(received_im_msg), NULL); |
| 257 gaim_signal_connect(gaim_conversations_get_handle(), "received-chat-msg", plugin, |
257 purple_signal_connect(purple_conversations_get_handle(), "received-chat-msg", plugin, |
| 258 GAIM_CALLBACK(received_chat_msg), NULL); |
258 PURPLE_CALLBACK(received_chat_msg), NULL); |
| 259 |
259 |
| 260 memset(&gpsy, 0, sizeof(gpsy)); |
260 memset(&gpsy, 0, sizeof(gpsy)); |
| 261 memset(&gpsw, 0, sizeof(gpsw)); |
261 memset(&gpsw, 0, sizeof(gpsw)); |
| 262 |
262 |
| 263 return TRUE; |
263 return TRUE; |
| 264 } |
264 } |
| 265 |
265 |
| 266 static gboolean |
266 static gboolean |
| 267 plugin_unload(GaimPlugin *plugin) |
267 plugin_unload(PurplePlugin *plugin) |
| 268 { |
268 { |
| 269 while (toasters) |
269 while (toasters) |
| 270 { |
270 { |
| 271 GntToast *toast = toasters->data; |
271 GntToast *toast = toasters->data; |
| 272 destroy_toaster(toast); |
272 destroy_toaster(toast); |
| 319 for (i = 0; prefs[i].pref; i++) |
319 for (i = 0; prefs[i].pref; i++) |
| 320 { |
320 { |
| 321 gnt_tree_add_choice(GNT_TREE(tree), prefs[i].pref, |
321 gnt_tree_add_choice(GNT_TREE(tree), prefs[i].pref, |
| 322 gnt_tree_create_row(GNT_TREE(tree), prefs[i].display), NULL, NULL); |
322 gnt_tree_create_row(GNT_TREE(tree), prefs[i].display), NULL, NULL); |
| 323 gnt_tree_set_choice(GNT_TREE(tree), prefs[i].pref, |
323 gnt_tree_set_choice(GNT_TREE(tree), prefs[i].pref, |
| 324 gaim_prefs_get_bool(prefs[i].pref)); |
324 purple_prefs_get_bool(prefs[i].pref)); |
| 325 } |
325 } |
| 326 gnt_tree_set_col_width(GNT_TREE(tree), 0, 40); |
326 gnt_tree_set_col_width(GNT_TREE(tree), 0, 40); |
| 327 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(pref_toggled), NULL); |
327 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(pref_toggled), NULL); |
| 328 |
328 |
| 329 check = gnt_check_box_new(_("Beep too!")); |
329 check = gnt_check_box_new(_("Beep too!")); |
| 330 gnt_check_box_set_checked(GNT_CHECK_BOX(check), gaim_prefs_get_bool(PREFS_BEEP)); |
330 gnt_check_box_set_checked(GNT_CHECK_BOX(check), purple_prefs_get_bool(PREFS_BEEP)); |
| 331 g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(toggle_option), PREFS_BEEP); |
331 g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(toggle_option), PREFS_BEEP); |
| 332 gnt_box_add_widget(GNT_BOX(window), check); |
332 gnt_box_add_widget(GNT_BOX(window), check); |
| 333 |
333 |
| 334 #ifdef HAVE_X11 |
334 #ifdef HAVE_X11 |
| 335 check = gnt_check_box_new(_("Set URGENT for the terminal window.")); |
335 check = gnt_check_box_new(_("Set URGENT for the terminal window.")); |
| 336 gnt_check_box_set_checked(GNT_CHECK_BOX(check), gaim_prefs_get_bool(PREFS_URGENT)); |
336 gnt_check_box_set_checked(GNT_CHECK_BOX(check), purple_prefs_get_bool(PREFS_URGENT)); |
| 337 g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(toggle_option), PREFS_URGENT); |
337 g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(toggle_option), PREFS_URGENT); |
| 338 gnt_box_add_widget(GNT_BOX(window), check); |
338 gnt_box_add_widget(GNT_BOX(window), check); |
| 339 #endif |
339 #endif |
| 340 |
340 |
| 341 return window; |
341 return window; |
| 342 } |
342 } |
| 343 |
343 |
| 344 static GaimPluginInfo info = |
344 static PurplePluginInfo info = |
| 345 { |
345 { |
| 346 GAIM_PLUGIN_MAGIC, |
346 PURPLE_PLUGIN_MAGIC, |
| 347 GAIM_MAJOR_VERSION, |
347 PURPLE_MAJOR_VERSION, |
| 348 GAIM_MINOR_VERSION, |
348 PURPLE_MINOR_VERSION, |
| 349 GAIM_PLUGIN_STANDARD, |
349 PURPLE_PLUGIN_STANDARD, |
| 350 GAIM_GNT_PLUGIN_TYPE, |
350 FINCH_PLUGIN_TYPE, |
| 351 0, |
351 0, |
| 352 NULL, |
352 NULL, |
| 353 GAIM_PRIORITY_DEFAULT, |
353 PURPLE_PRIORITY_DEFAULT, |
| 354 "gntgf", |
354 "gntgf", |
| 355 N_("GntGf"), |
355 N_("GntGf"), |
| 356 VERSION, |
356 VERSION, |
| 357 N_("Toaster plugin"), |
357 N_("Toaster plugin"), |
| 358 N_("Toaster plugin"), |
358 N_("Toaster plugin"), |
| 359 "Sadrul H Chowdhury <sadrul@users.sourceforge.net>", |
359 "Sadrul H Chowdhury <sadrul@users.sourceforge.net>", |
| 360 "http://gaim.sourceforge.net", |
360 "http://purple.sourceforge.net", |
| 361 plugin_load, |
361 plugin_load, |
| 362 plugin_unload, |
362 plugin_unload, |
| 363 NULL, |
363 NULL, |
| 364 config_frame, |
364 config_frame, |
| 365 NULL, |
365 NULL, |
| 366 NULL, |
366 NULL, |
| 367 NULL |
367 NULL |
| 368 }; |
368 }; |
| 369 |
369 |
| 370 static void |
370 static void |
| 371 init_plugin(GaimPlugin *plugin) |
371 init_plugin(PurplePlugin *plugin) |
| 372 { |
372 { |
| 373 gaim_prefs_add_none("/plugins"); |
373 purple_prefs_add_none("/plugins"); |
| 374 gaim_prefs_add_none("/plugins/gnt"); |
374 purple_prefs_add_none("/plugins/gnt"); |
| 375 |
375 |
| 376 gaim_prefs_add_none("/plugins/gnt/gntgf"); |
376 purple_prefs_add_none("/plugins/gnt/gntgf"); |
| 377 gaim_prefs_add_none(PREFS_EVENT); |
377 purple_prefs_add_none(PREFS_EVENT); |
| 378 |
378 |
| 379 gaim_prefs_add_bool(PREFS_EVENT_SIGNONF, TRUE); |
379 purple_prefs_add_bool(PREFS_EVENT_SIGNONF, TRUE); |
| 380 gaim_prefs_add_bool(PREFS_EVENT_IM_MSG, TRUE); |
380 purple_prefs_add_bool(PREFS_EVENT_IM_MSG, TRUE); |
| 381 gaim_prefs_add_bool(PREFS_EVENT_CHAT_MSG, TRUE); |
381 purple_prefs_add_bool(PREFS_EVENT_CHAT_MSG, TRUE); |
| 382 gaim_prefs_add_bool(PREFS_EVENT_CHAT_NICK, TRUE); |
382 purple_prefs_add_bool(PREFS_EVENT_CHAT_NICK, TRUE); |
| 383 |
383 |
| 384 gaim_prefs_add_bool(PREFS_BEEP, TRUE); |
384 purple_prefs_add_bool(PREFS_BEEP, TRUE); |
| 385 #ifdef HAVE_X11 |
385 #ifdef HAVE_X11 |
| 386 gaim_prefs_add_bool(PREFS_URGENT, FALSE); |
386 purple_prefs_add_bool(PREFS_URGENT, FALSE); |
| 387 #endif |
387 #endif |
| 388 } |
388 } |
| 389 |
389 |
| 390 GAIM_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) |
390 PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) |