Mercurial > pidgin-twitter
comparison pidgin-twitter.c @ 31:312a745dece6
added letter counter
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Sat, 10 May 2008 18:10:58 +0900 |
parents | e740ceed9337 |
children | 92715b489de6 |
comparison
equal
deleted
inserted
replaced
30:e740ceed9337 | 31:312a745dece6 |
---|---|
27 #include "util.h" | 27 #include "util.h" |
28 #include "debug.h" | 28 #include "debug.h" |
29 #include "connection.h" | 29 #include "connection.h" |
30 #include "version.h" | 30 #include "version.h" |
31 #include "sound.h" | 31 #include "sound.h" |
32 #include "gtkconv.h" | |
32 | 33 |
33 #define RECIPIENT 0 | 34 #define RECIPIENT 0 |
34 #define SENDER 1 | 35 #define SENDER 1 |
35 #define COMMAND 2 | 36 #define COMMAND 2 |
36 #define PSEUDO 3 | 37 #define PSEUDO 3 |
37 | 38 |
38 #define PIDGINTWITTER_PLUGIN_ID "pidgin_twitter" | 39 #define PLUGIN_ID "gtk-honeyplanet-pidgin_twitter" |
40 #define PLUGIN_NAME "pidgin-twitter" | |
41 | |
39 #define OPT_PIDGINTWITTER "/plugins/pidgin_twitter" | 42 #define OPT_PIDGINTWITTER "/plugins/pidgin_twitter" |
40 #define OPT_TRANSLATE_RECIPIENT OPT_PIDGINTWITTER "/translate_recipient" | 43 #define OPT_TRANSLATE_RECIPIENT OPT_PIDGINTWITTER "/translate_recipient" |
41 #define OPT_TRANSLATE_SENDER OPT_PIDGINTWITTER "/translate_sender" | 44 #define OPT_TRANSLATE_SENDER OPT_PIDGINTWITTER "/translate_sender" |
42 #define OPT_PLAYSOUND_RECIPIENT OPT_PIDGINTWITTER "/playsound_recipient" | 45 #define OPT_PLAYSOUND_RECIPIENT OPT_PIDGINTWITTER "/playsound_recipient" |
43 #define OPT_PLAYSOUND_SENDER OPT_PIDGINTWITTER "/playsound_sender" | 46 #define OPT_PLAYSOUND_SENDER OPT_PIDGINTWITTER "/playsound_sender" |
44 #define OPT_SOUNDID_RECIPIENT OPT_PIDGINTWITTER "/soundid_recipient" | 47 #define OPT_SOUNDID_RECIPIENT OPT_PIDGINTWITTER "/soundid_recipient" |
45 #define OPT_SOUNDID_SENDER OPT_PIDGINTWITTER "/soundid_sender" | 48 #define OPT_SOUNDID_SENDER OPT_PIDGINTWITTER "/soundid_sender" |
46 #define OPT_ESCAPE_PSEUDO OPT_PIDGINTWITTER "/escape_pseudo" | 49 #define OPT_ESCAPE_PSEUDO OPT_PIDGINTWITTER "/escape_pseudo" |
47 #define OPT_USERLIST_RECIPIENT OPT_PIDGINTWITTER "/userlist_recipient" | 50 #define OPT_USERLIST_RECIPIENT OPT_PIDGINTWITTER "/userlist_recipient" |
48 #define OPT_USERLIST_SENDER OPT_PIDGINTWITTER "/userlist_sender" | 51 #define OPT_USERLIST_SENDER OPT_PIDGINTWITTER "/userlist_sender" |
52 #define OPT_COUNTER OPT_PIDGINTWITTER "/counter" | |
53 | |
49 #define RECIPIENT_FORMAT "@<a href='http://twitter.com/%s'>%s</a>" | 54 #define RECIPIENT_FORMAT "@<a href='http://twitter.com/%s'>%s</a>" |
50 #define SENDER_FORMAT "<a href='http://twitter.com/%s'>%s</a>: " | 55 #define SENDER_FORMAT "<a href='http://twitter.com/%s'>%s</a>: " |
51 #define DEFAULT_LIST "(list of users: separated with ' ,:;')" | 56 #define DEFAULT_LIST "(list of users: separated with ' ,:;')" |
52 | 57 |
53 #define twitter_debug(fmt, ...) purple_debug(PURPLE_DEBUG_INFO, PIDGINTWITTER_PLUGIN_ID, \ | 58 |
59 #define twitter_debug(fmt, ...) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, \ | |
54 fmt, ## __VA_ARGS__); | 60 fmt, ## __VA_ARGS__); |
55 #define twitter_error(fmt, ...) purple_debug(PURPLE_DEBUG_ERROR, PIDGINTWITTER_PLUGIN_ID, \ | 61 #define twitter_error(fmt, ...) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, \ |
56 | 62 |
57 /* globals */ | 63 /* globals */ |
58 static GRegex *regp[4]; | 64 static GRegex *regp[4]; |
65 | |
66 /* prototypes */ | |
67 static gboolean is_twitter_conv(PurpleConversation *conv); | |
68 static void attach_to_gtkconv(PidginConversation *gtkconv, gpointer null); | |
69 static void detach_from_gtkconv(PidginConversation *gtkconv, gpointer null); | |
70 static void escape(gchar **str); | |
71 | |
59 | 72 |
60 static void | 73 static void |
61 escape(gchar **str) | 74 escape(gchar **str) |
62 { | 75 { |
63 GMatchInfo *match_info = NULL; | 76 GMatchInfo *match_info = NULL; |
113 proto = purple_account_get_protocol_id(account); | 126 proto = purple_account_get_protocol_id(account); |
114 twitter_debug("sending_im_cb\n"); | 127 twitter_debug("sending_im_cb\n"); |
115 twitter_debug("proto = %s\n", proto); | 128 twitter_debug("proto = %s\n", proto); |
116 twitter_debug("recipient = %s\n", recipient); | 129 twitter_debug("recipient = %s\n", recipient); |
117 | 130 |
118 if(!strcmp(proto, "prpl-jabber") && !strcmp(recipient, "twitter@twitter.com")) { | 131 if(!strcmp(proto, "prpl-jabber") && |
132 !strcmp(recipient, "twitter@twitter.com")) { | |
119 /* escape */ | 133 /* escape */ |
120 if(purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { | 134 if(purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) { |
121 escape(buffer); | 135 escape(buffer); |
122 } | 136 } |
123 } | 137 } |
167 { | 181 { |
168 GMatchInfo *match_info; | 182 GMatchInfo *match_info; |
169 const gchar *list; | 183 const gchar *list; |
170 gchar **candidates = NULL, **candidate = NULL; | 184 gchar **candidates = NULL, **candidate = NULL; |
171 | 185 |
172 list = purple_prefs_get_string(which ? OPT_USERLIST_SENDER : OPT_USERLIST_RECIPIENT); | 186 list = purple_prefs_get_string(which ? OPT_USERLIST_SENDER : |
187 OPT_USERLIST_RECIPIENT); | |
173 g_return_if_fail(list != NULL); | 188 g_return_if_fail(list != NULL); |
174 if(!strcmp(list, DEFAULT_LIST)) | 189 if(!strcmp(list, DEFAULT_LIST)) |
175 return; | 190 return; |
176 | 191 |
177 candidates = g_strsplit_set(list, " ,:;", 0); | 192 candidates = g_strsplit_set(list, " ,:;", 0); |
236 } | 251 } |
237 } | 252 } |
238 return FALSE; | 253 return FALSE; |
239 } | 254 } |
240 | 255 |
256 static void | |
257 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | |
258 gchar *new_text, gint new_text_length, gpointer user_data) | |
259 { | |
260 PidginConversation *gtkconv = (PidginConversation *)user_data; | |
261 GtkWidget *box, *counter = NULL; | |
262 gchar *markup = NULL; | |
263 | |
264 g_return_if_fail(gtkconv != NULL); | |
265 | |
266 guint count = gtk_text_buffer_get_char_count(textbuffer) + | |
267 (unsigned int)g_utf8_strlen(new_text, -1); | |
268 | |
269 twitter_debug("new_text = %s utf8_strlen = %ld new_text_length = %d\n", | |
270 new_text, g_utf8_strlen(new_text, -1), new_text_length); | |
271 | |
272 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", | |
273 count<=140 ? "black" : "red", | |
274 count); | |
275 | |
276 box = gtkconv->toolbar; | |
277 counter = g_object_get_data(G_OBJECT(box), | |
278 PLUGIN_ID "-counter"); | |
279 if (counter) | |
280 gtk_label_set_markup(GTK_LABEL(counter), markup); | |
281 | |
282 g_free(markup); | |
283 } | |
284 | |
285 static void | |
286 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | |
287 GtkTextIter *end_pos, gpointer user_data) | |
288 { | |
289 PidginConversation *gtkconv = (PidginConversation *)user_data; | |
290 GtkWidget *box, *counter = NULL; | |
291 gchar *markup = NULL; | |
292 | |
293 g_return_if_fail(gtkconv != NULL); | |
294 | |
295 guint count = gtk_text_buffer_get_char_count(textbuffer) - | |
296 (gtk_text_iter_get_offset(end_pos) - | |
297 gtk_text_iter_get_offset(start_pos)); | |
298 | |
299 markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>", | |
300 count<=140 ? "black" : "red", | |
301 count); | |
302 | |
303 box = gtkconv->toolbar; | |
304 counter = g_object_get_data(G_OBJECT(box), | |
305 PLUGIN_ID "-counter"); | |
306 if (counter) | |
307 gtk_label_set_markup(GTK_LABEL(counter), markup); | |
308 | |
309 g_free(markup); | |
310 } | |
311 | |
312 | |
313 static void | |
314 detach_from_window(void) | |
315 { | |
316 GList *list; | |
317 | |
318 for (list = pidgin_conv_windows_get_list(); list; list = list->next) { | |
319 PidginWindow *win = list->data; | |
320 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); | |
321 if(is_twitter_conv(conv)) | |
322 detach_from_gtkconv(PIDGIN_CONVERSATION(conv), NULL); | |
323 } | |
324 } | |
325 | |
326 static void | |
327 detach_from_gtkconv(PidginConversation *gtkconv, gpointer null) | |
328 { | |
329 GtkWidget *box, *counter = NULL, *sep = NULL; | |
330 | |
331 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry_buffer), | |
332 (GFunc)insert_text_cb, gtkconv); | |
333 g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->entry_buffer), | |
334 (GFunc)delete_text_cb, gtkconv); | |
335 | |
336 box = gtkconv->toolbar; | |
337 | |
338 /* remove counter */ | |
339 counter = g_object_get_data(G_OBJECT(box), | |
340 PLUGIN_ID "-counter"); | |
341 if (counter) { | |
342 gtk_container_remove(GTK_CONTAINER(box), counter); | |
343 g_object_unref(counter); | |
344 g_object_set_data(G_OBJECT(box), | |
345 PLUGIN_ID "-counter", NULL); | |
346 } | |
347 /* remove separator */ | |
348 sep = g_object_get_data(G_OBJECT(box), PLUGIN_ID "-sep"); | |
349 if (sep) { | |
350 gtk_container_remove(GTK_CONTAINER(box), sep); | |
351 g_object_unref(sep); | |
352 g_object_set_data(G_OBJECT(box), | |
353 PLUGIN_ID "-sep", NULL); | |
354 } | |
355 | |
356 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window); | |
357 } | |
358 | |
359 static void | |
360 attach_to_window(void) | |
361 { | |
362 GList *list; | |
363 | |
364 for (list = pidgin_conv_windows_get_list(); list; list = list->next) { | |
365 PidginWindow *win = list->data; | |
366 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); | |
367 if(is_twitter_conv(conv)) | |
368 attach_to_gtkconv(PIDGIN_CONVERSATION(conv), NULL); | |
369 } | |
370 } | |
371 | |
372 static void | |
373 attach_to_gtkconv(PidginConversation *gtkconv, gpointer null) | |
374 { | |
375 GtkWidget *box, *sep, *counter; | |
376 | |
377 box = gtkconv->toolbar; | |
378 counter = g_object_get_data(G_OBJECT(box), | |
379 PLUGIN_ID "-counter"); | |
380 g_return_if_fail(counter == NULL); | |
381 | |
382 /* make counter object */ | |
383 counter = gtk_label_new(NULL); | |
384 gtk_widget_set_name(counter, "counter_label"); | |
385 gtk_label_set_text(GTK_LABEL(counter), "0"); | |
386 gtk_box_pack_end(GTK_BOX(box), counter, FALSE, FALSE, 0); | |
387 gtk_widget_show_all(counter); | |
388 g_object_set_data(G_OBJECT(box), | |
389 PLUGIN_ID "-counter", counter); | |
390 | |
391 /* make separator object */ | |
392 sep = gtk_vseparator_new(); | |
393 gtk_box_pack_end(GTK_BOX(box), sep, FALSE, FALSE, 0); | |
394 gtk_widget_show_all(sep); | |
395 g_object_set_data(G_OBJECT(box), | |
396 PLUGIN_ID "-sep", sep); | |
397 | |
398 /* connect signals, etc. */ | |
399 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | |
400 G_CALLBACK(insert_text_cb), gtkconv); | |
401 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | |
402 G_CALLBACK(delete_text_cb), gtkconv); | |
403 | |
404 /* redraw window */ | |
405 gtk_widget_queue_draw(pidgin_conv_get_window(gtkconv)->window); | |
406 } | |
407 | |
408 static gboolean | |
409 is_twitter_conv(PurpleConversation *conv) | |
410 { | |
411 const char *name = purple_conversation_get_name(conv); | |
412 PurpleAccount *account = purple_conversation_get_account(conv); | |
413 const gchar *proto = purple_account_get_protocol_id(account); | |
414 | |
415 twitter_debug("is_twitter_conv\n"); | |
416 twitter_debug("name = %s\n", name); | |
417 twitter_debug("proto = %s\n", proto); | |
418 | |
419 if(!strcmp(name, "twitter@twitter.com") && | |
420 !strcmp(proto, "prpl-jabber")) { | |
421 return TRUE; | |
422 } | |
423 | |
424 return FALSE; | |
425 } | |
426 | |
427 static void | |
428 conv_created_cb(PurpleConversation *conv, gpointer null) | |
429 { | |
430 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); | |
431 g_return_if_fail(gtkconv != NULL); | |
432 | |
433 /* only attach to twitter conversation window */ | |
434 if(is_twitter_conv(conv)) { | |
435 gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); | |
436 if(enabled) { | |
437 attach_to_gtkconv(gtkconv, NULL); | |
438 } | |
439 } | |
440 } | |
441 | |
241 static gboolean | 442 static gboolean |
242 load_plugin(PurplePlugin * plugin) | 443 load_plugin(PurplePlugin * plugin) |
243 { | 444 { |
244 /* connect to signal */ | 445 /* connect to signal */ |
245 purple_signal_connect(purple_conversations_get_handle(), "writing-im-msg", | 446 purple_signal_connect(purple_conversations_get_handle(), "writing-im-msg", |
246 plugin, PURPLE_CALLBACK(writing_im_cb), NULL); | 447 plugin, PURPLE_CALLBACK(writing_im_cb), NULL); |
247 purple_signal_connect(purple_conversations_get_handle(), "sending-im-msg", | 448 purple_signal_connect(purple_conversations_get_handle(), "sending-im-msg", |
248 plugin, PURPLE_CALLBACK(sending_im_cb), NULL); | 449 plugin, PURPLE_CALLBACK(sending_im_cb), NULL); |
450 purple_signal_connect(purple_conversations_get_handle(), | |
451 "conversation-created", | |
452 plugin, PURPLE_CALLBACK(conv_created_cb), NULL); | |
249 | 453 |
250 /* compile regex */ | 454 /* compile regex */ |
251 regp[RECIPIENT] = g_regex_new("@([A-Za-z0-9_]+)", 0, 0, NULL); | 455 regp[RECIPIENT] = g_regex_new("@([A-Za-z0-9_]+)", 0, 0, NULL); |
252 regp[SENDER] = g_regex_new("<body>([A-Za-z0-9_]+): ", 0, 0, NULL); | 456 regp[SENDER] = g_regex_new("<body>([A-Za-z0-9_]+): ", 0, 0, NULL); |
253 regp[COMMAND] = g_regex_new( | 457 regp[COMMAND] = g_regex_new( |
255 G_REGEX_RAW, 0, NULL); | 459 G_REGEX_RAW, 0, NULL); |
256 regp[PSEUDO] = g_regex_new( | 460 regp[PSEUDO] = g_regex_new( |
257 "^\\s*(?:[\"#$%&'()*+,\\-./:;<=>?\\[\\\\\\]_`{|}~]|[^\\s\\x21-\\x7E])*([dDfFgGlLmMnNtTwW]{1})(?:\\Z|\\s+|[^\\x21-\\x7E]+\\Z)", | 461 "^\\s*(?:[\"#$%&'()*+,\\-./:;<=>?\\[\\\\\\]_`{|}~]|[^\\s\\x21-\\x7E])*([dDfFgGlLmMnNtTwW]{1})(?:\\Z|\\s+|[^\\x21-\\x7E]+\\Z)", |
258 G_REGEX_RAW, 0, NULL); | 462 G_REGEX_RAW, 0, NULL); |
259 | 463 |
464 /* attach counter to the existing twitter window*/ | |
465 gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); | |
466 if(enabled) { | |
467 attach_to_window(); | |
468 } | |
469 | |
260 return TRUE; | 470 return TRUE; |
261 } | 471 } |
262 | 472 |
263 static gboolean | 473 static gboolean |
264 unload_plugin(PurplePlugin * plugin) | 474 unload_plugin(PurplePlugin * plugin) |
265 { | 475 { |
266 twitter_debug("pidgin-twitter unload called\n"); | 476 twitter_debug("pidgin-twitter unload called\n"); |
267 | 477 |
478 /* disconnect from signal */ | |
479 purple_signal_disconnect(purple_conversations_get_handle(), | |
480 "writing-im-msg", | |
481 plugin, PURPLE_CALLBACK(writing_im_cb)); | |
482 purple_signal_disconnect(purple_conversations_get_handle(), | |
483 "sending-im-msg", | |
484 plugin, PURPLE_CALLBACK(sending_im_cb)); | |
485 purple_signal_disconnect(purple_conversations_get_handle(), | |
486 "conversation-created", | |
487 plugin, PURPLE_CALLBACK(conv_created_cb)); | |
488 | |
489 /* unreference regp */ | |
268 g_regex_unref(regp[RECIPIENT]); | 490 g_regex_unref(regp[RECIPIENT]); |
269 g_regex_unref(regp[SENDER]); | 491 g_regex_unref(regp[SENDER]); |
270 g_regex_unref(regp[COMMAND]); | 492 g_regex_unref(regp[COMMAND]); |
271 g_regex_unref(regp[PSEUDO]); | 493 g_regex_unref(regp[PSEUDO]); |
272 | 494 |
495 /* detach from twitter window */ | |
496 detach_from_window(); | |
497 | |
273 return TRUE; | 498 return TRUE; |
499 } | |
500 | |
501 static void | |
502 counter_prefs_cb(const char *name, PurplePrefType type, | |
503 gconstpointer val, gpointer data) | |
504 { | |
505 gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); | |
506 if(enabled) { | |
507 attach_to_window(); //xxx shoud check whether already attached or not. | |
508 } | |
509 else { | |
510 detach_from_window(); | |
511 } | |
274 } | 512 } |
275 | 513 |
276 static PurplePluginPrefFrame * | 514 static PurplePluginPrefFrame * |
277 get_plugin_pref_frame(PurplePlugin * plugin) | 515 get_plugin_pref_frame(PurplePlugin * plugin) |
278 { | 516 { |
280 | 518 |
281 PurplePluginPref *pref; | 519 PurplePluginPref *pref; |
282 PurplePluginPrefFrame *frame = purple_plugin_pref_frame_new(); | 520 PurplePluginPrefFrame *frame = purple_plugin_pref_frame_new(); |
283 | 521 |
284 /* frame title */ | 522 /* frame title */ |
285 pref = purple_plugin_pref_new_with_label("Pidgin-Twitter Configuration"); | 523 pref = purple_plugin_pref_new_with_label("Translation Configurations"); |
286 purple_plugin_pref_frame_add(frame, pref); | 524 purple_plugin_pref_frame_add(frame, pref); |
287 | |
288 | 525 |
289 /* translation settings */ | 526 /* translation settings */ |
290 pref = purple_plugin_pref_new_with_name_and_label( | 527 pref = purple_plugin_pref_new_with_name_and_label( |
291 OPT_TRANSLATE_RECIPIENT, | 528 OPT_TRANSLATE_RECIPIENT, |
292 "Translate @username to link"); | 529 "Translate @username to link"); |
295 pref = purple_plugin_pref_new_with_name_and_label( | 532 pref = purple_plugin_pref_new_with_name_and_label( |
296 OPT_TRANSLATE_SENDER, | 533 OPT_TRANSLATE_SENDER, |
297 "Translate sender name to link"); | 534 "Translate sender name to link"); |
298 purple_plugin_pref_frame_add(frame, pref); | 535 purple_plugin_pref_frame_add(frame, pref); |
299 | 536 |
300 /* escape pseudo command settings */ | 537 |
538 | |
539 | |
540 | |
541 /* frame title */ | |
542 pref = purple_plugin_pref_new_with_label("Miscellaneous Configurations"); | |
543 purple_plugin_pref_frame_add(frame, pref); | |
544 | |
545 /* escape pseudo command setting */ | |
301 pref = purple_plugin_pref_new_with_name_and_label( | 546 pref = purple_plugin_pref_new_with_name_and_label( |
302 OPT_ESCAPE_PSEUDO, | 547 OPT_ESCAPE_PSEUDO, |
303 "Escape pseudo command string"); | 548 "Escape pseudo command string"); |
549 purple_plugin_pref_frame_add(frame, pref); | |
550 | |
551 /* comaescape pseudo command setting */ | |
552 pref = purple_plugin_pref_new_with_name_and_label( | |
553 OPT_COUNTER, | |
554 "Show text counter"); | |
555 purple_plugin_pref_frame_add(frame, pref); | |
556 | |
557 /* xxx */ | |
558 purple_prefs_connect_callback(plugin, OPT_COUNTER, | |
559 counter_prefs_cb, NULL); | |
560 | |
561 | |
562 | |
563 | |
564 | |
565 /* frame title */ | |
566 pref = purple_plugin_pref_new_with_label("Sound Configurations"); | |
304 purple_plugin_pref_frame_add(frame, pref); | 567 purple_plugin_pref_frame_add(frame, pref); |
305 | 568 |
306 /* sound settings for recipient */ | 569 /* sound settings for recipient */ |
307 pref = purple_plugin_pref_new_with_name_and_label( | 570 pref = purple_plugin_pref_new_with_name_and_label( |
308 OPT_PLAYSOUND_RECIPIENT, | 571 OPT_PLAYSOUND_RECIPIENT, |
332 purple_plugin_pref_add_choice(pref, "Chat Nick Said", GINT_TO_POINTER(10)); | 595 purple_plugin_pref_add_choice(pref, "Chat Nick Said", GINT_TO_POINTER(10)); |
333 | 596 |
334 purple_plugin_pref_frame_add(frame, pref); | 597 purple_plugin_pref_frame_add(frame, pref); |
335 | 598 |
336 | 599 |
337 /* sound settings for sender */ | 600 /* sound setting for sender */ |
338 pref = purple_plugin_pref_new_with_name_and_label( | 601 pref = purple_plugin_pref_new_with_name_and_label( |
339 OPT_PLAYSOUND_SENDER, | 602 OPT_PLAYSOUND_SENDER, |
340 "Play sound if sender of a message is in the sender list"); | 603 "Play sound if sender of a message is in the sender list"); |
341 purple_plugin_pref_frame_add(frame, pref); | 604 purple_plugin_pref_frame_add(frame, pref); |
342 | 605 |
378 PURPLE_PLUGIN_STANDARD, /**< type */ | 641 PURPLE_PLUGIN_STANDARD, /**< type */ |
379 NULL, /**< ui_req */ | 642 NULL, /**< ui_req */ |
380 0, /**< flags */ | 643 0, /**< flags */ |
381 NULL, /**< deps */ | 644 NULL, /**< deps */ |
382 PURPLE_PRIORITY_DEFAULT, /**< priority */ | 645 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
383 PIDGINTWITTER_PLUGIN_ID, /**< id */ | 646 PLUGIN_ID, /**< id */ |
384 "Pidgin-Twitter", /**< name */ | 647 "Pidgin-Twitter", /**< name */ |
385 "0.5.2", /**< version */ | 648 "0.6.0", /**< version */ |
386 "replaces usernames with links and play sounds", /** summary */ | 649 "replaces usernames with links and play sounds", /** summary */ |
387 "replaces usernames with links and play sounds", /** desc */ | 650 "replaces usernames with links and play sounds", /** desc */ |
388 "Yoshiki Yazawa (yaz@honeyplanet.jp)", /**< author */ | 651 "Yoshiki Yazawa (yaz@honeyplanet.jp)", /**< author */ |
389 "http://www.honeyplanet.jp/", /**< homepage */ | 652 "http://www.honeyplanet.jp/", /**< homepage */ |
390 load_plugin, /**< load */ | 653 load_plugin, /**< load */ |
411 purple_prefs_add_bool(OPT_PLAYSOUND_SENDER, TRUE); | 674 purple_prefs_add_bool(OPT_PLAYSOUND_SENDER, TRUE); |
412 purple_prefs_add_int(OPT_SOUNDID_RECIPIENT, PURPLE_SOUND_POUNCE_DEFAULT); | 675 purple_prefs_add_int(OPT_SOUNDID_RECIPIENT, PURPLE_SOUND_POUNCE_DEFAULT); |
413 purple_prefs_add_string(OPT_USERLIST_RECIPIENT, DEFAULT_LIST); | 676 purple_prefs_add_string(OPT_USERLIST_RECIPIENT, DEFAULT_LIST); |
414 purple_prefs_add_int(OPT_SOUNDID_SENDER, PURPLE_SOUND_POUNCE_DEFAULT); | 677 purple_prefs_add_int(OPT_SOUNDID_SENDER, PURPLE_SOUND_POUNCE_DEFAULT); |
415 purple_prefs_add_string(OPT_USERLIST_SENDER, DEFAULT_LIST); | 678 purple_prefs_add_string(OPT_USERLIST_SENDER, DEFAULT_LIST); |
679 | |
680 purple_prefs_add_bool(OPT_COUNTER, TRUE); | |
416 } | 681 } |
417 | 682 |
418 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info) | 683 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info) |