comparison src/away.c @ 5205:fefad67de2c7

[gaim-migrate @ 5573] I had a damn good commit message, but it was eaten. Let's try it again. Announcing, Gaim Plugin API version 2.0, or GPAPIV2.0 for short. There are lots'a cool thingies here. Okay now, this isn't as cool as the previous message, but: 1) There's now a single entry function for all plugin types. It returns a detailed information structure on the plugin. This removes a lot of the ugliness from old plugins. Oh yeah, libicq wasn't converted to this, so if you use it, well, you shouldn't have used it anyway, but now you can't! bwahahaha. Use AIM/ICQ. 2) There are now 3 types of plugins: Standard, Loader, and Protocol plugins. Standard plugins are, well, standard, compiled plugins. Loader plugins load other plugins. For example, the perl support is now a loader plugin. It loads perl scripts. In the future, we'll have Ruby and Python loader plugins. Protocol plugins are, well, protocol plugins... yeah... 3) Plugins have unique IDs, so they can be referred to or automatically updated from a plugin database in the future. Neat, huh? 4) Plugins will have dependency support in the future, and can be hidden, so if you have, say, a logging core plugin, it won't have to show up, but then you load the GTK+ logging plugin and it'll auto-load the core plugin. Core/UI split plugins! 5) There will eventually be custom plugin signals and RPC of some sort, for the core/ui split plugins. So, okay, back up .gaimrc. I'd like to thank my parents for their support, javabsp for helping convert a bunch of protocol plugins, and Etan for helping convert a bunch of standard plugins. Have fun. If you have any problems, please let me know, but you probably won't have anything major happen. You will have to convert your plugins, though, and I'm not guaranteeing that all perl scripts will still work. I'll end up changing the perl script API eventually, so I know they won't down the road. Don't worry, though. It'll be mass cool. faceprint wants me to just commit the damn code already. So, here we go!!! .. .. I need a massage. From a young, cute girl. Are there any young, cute girls in the audience? IM me plz k thx. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 25 Apr 2003 06:47:33 +0000
parents 777f56b95a92
children 1cf4eb75e3ee
comparison
equal deleted inserted replaced
5204:44de70702205 5205:fefad67de2c7
30 #include <gtk/gtk.h> 30 #include <gtk/gtk.h>
31 #include "gaim.h" 31 #include "gaim.h"
32 #include "prpl.h" 32 #include "prpl.h"
33 #include "gtkimhtml.h" 33 #include "gtkimhtml.h"
34 #include "gtklist.h" 34 #include "gtklist.h"
35 #include "plugin.h"
35 36
36 GtkWidget *imaway = NULL; 37 GtkWidget *imaway = NULL;
37 38
38 GtkWidget *awaymenu = NULL; 39 GtkWidget *awaymenu = NULL;
39 GtkWidget *awayqueue = NULL; 40 GtkWidget *awayqueue = NULL;
347 GList *l; 348 GList *l;
348 GSList *awy = away_messages; 349 GSList *awy = away_messages;
349 struct away_message *a; 350 struct away_message *a;
350 GSList *con = connections; 351 GSList *con = connections;
351 struct gaim_connection *gc = NULL; 352 struct gaim_connection *gc = NULL;
353 GaimPluginProtocolInfo *prpl_info = NULL;
354
352 int count = 0; 355 int count = 0;
353 356
354 if (prefs_away_store != NULL) { 357 if (prefs_away_store != NULL) {
355 gtk_list_store_clear(prefs_away_store); 358 gtk_list_store_clear(prefs_away_store);
356 while (awy) { 359 while (awy) {
404 407
405 gaim_separator(awaymenu); 408 gaim_separator(awaymenu);
406 409
407 while (con) { 410 while (con) {
408 gc = con->data; 411 gc = con->data;
409 if (gc->prpl->away_states &&gc->prpl->set_away) 412
413 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
414
415 if (prpl_info->away_states != NULL && prpl_info->set_away != NULL)
410 count++; 416 count++;
411 con = g_slist_next(con); 417 con = g_slist_next(con);
412 } 418 }
413 con = connections; 419 con = connections;
414 420
415 if (count == 0) { 421 if (count == 0) {
416 } else if (count == 1) { 422 } else if (count == 1) {
417 GList *msgs, *tmp; 423 GList *msgs, *tmp;
418 while (con) { 424 while (con) {
419 gc = con->data; 425 gc = con->data;
420 if (gc->prpl->away_states &&gc->prpl->set_away) 426
427 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
428
429 if (prpl_info->away_states && prpl_info->set_away)
421 break; 430 break;
422 con = g_slist_next(con); 431 con = g_slist_next(con);
423 } 432 }
424 433
425 tmp = msgs = gc->prpl->away_states(gc); 434 tmp = msgs = prpl_info->away_states(gc);
426 435
427 if ((g_list_length(msgs) == 1) && !strcmp(msgs->data, GAIM_AWAY_CUSTOM)) { 436 if ((g_list_length(msgs) == 1) && !strcmp(msgs->data, GAIM_AWAY_CUSTOM)) {
428 awy = away_messages; 437 awy = away_messages;
429 438
430 while (awy) { 439 while (awy) {
482 while (con) { 491 while (con) {
483 char buf[256]; 492 char buf[256];
484 GList *msgs, *tmp; 493 GList *msgs, *tmp;
485 gc = con->data; 494 gc = con->data;
486 495
487 if (!gc->prpl->away_states ||!gc->prpl->set_away) { 496 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
497
498 if (!prpl_info->away_states || !prpl_info->set_away) {
488 con = con->next; 499 con = con->next;
489 continue; 500 continue;
490 } 501 }
491 502
492 g_snprintf(buf, sizeof(buf), "%s (%s)", 503 g_snprintf(buf, sizeof(buf), "%s (%s)",
493 gc->username, gc->prpl->name); 504 gc->username, gc->prpl->info->name);
494 menuitem = gtk_image_menu_item_new_with_label(buf); 505 menuitem = gtk_image_menu_item_new_with_label(buf);
495 506
496 pixbuf = create_prpl_icon(gc->account); 507 pixbuf = create_prpl_icon(gc->account);
497 if (pixbuf) { 508 if (pixbuf) {
498 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); 509 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
509 520
510 submenu = gtk_menu_new(); 521 submenu = gtk_menu_new();
511 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); 522 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
512 gtk_widget_show(submenu); 523 gtk_widget_show(submenu);
513 524
514 tmp = msgs = gc->prpl->away_states(gc); 525 tmp = msgs = prpl_info->away_states(gc);
515 526
516 if ((g_list_length(msgs) == 1) && 527 if ((g_list_length(msgs) == 1) &&
517 (!strcmp(msgs->data, GAIM_AWAY_CUSTOM))) { 528 (!strcmp(msgs->data, GAIM_AWAY_CUSTOM))) {
518 menuitem = gtk_menu_item_new_with_label(_("Back")); 529 menuitem = gtk_menu_item_new_with_label(_("Back"));
519 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); 530 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);