Mercurial > pidgin
comparison plugins/notify.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 | 00b6af528964 |
children | ad445074d239 |
comparison
equal
deleted
inserted
replaced
5204:44de70702205 | 5205:fefad67de2c7 |
---|---|
18 * for count of new messages option | 18 * for count of new messages option |
19 */ | 19 */ |
20 | 20 |
21 #include "config.h" | 21 #include "config.h" |
22 | 22 |
23 #ifndef GAIM_PLUGINS | |
24 #define GAIM_PLUGINS | |
25 #endif | |
26 | |
27 #include "gaim.h" | 23 #include "gaim.h" |
28 #include <string.h> | 24 #include <string.h> |
29 #include <ctype.h> | 25 #include <ctype.h> |
30 #include <stdlib.h> | 26 #include <stdlib.h> |
31 #include <gtk/gtk.h> | 27 #include <gtk/gtk.h> |
32 #include <X11/Xlib.h> | 28 #include <X11/Xlib.h> |
33 #include <X11/Xutil.h> | 29 #include <X11/Xutil.h> |
34 #include <X11/Xatom.h> | 30 #include <X11/Xatom.h> |
35 #include <gdk/gdkx.h> | 31 #include <gdk/gdkx.h> |
32 #include "gtkplugin.h" | |
33 | |
34 #define NOTIFY_PLUGIN_ID "gtk-notify" | |
36 | 35 |
37 guint type = 1; | 36 guint type = 1; |
38 #define TYPE_IM 0x00000001 | 37 #define TYPE_IM 0x00000001 |
39 #define TYPE_CHAT 0x00000002 | 38 #define TYPE_CHAT 0x00000002 |
40 | 39 |
556 | 555 |
557 cnv = cnv->next; | 556 cnv = cnv->next; |
558 } | 557 } |
559 } | 558 } |
560 | 559 |
561 char *gaim_plugin_init(GModule *hndl) { | 560 static GtkWidget * |
562 handle = hndl; | 561 get_config_frame(GaimPlugin *plugin) |
563 title_string = g_strdup("(*) "); | 562 { |
564 | |
565 load_notify_prefs(); | |
566 | |
567 gaim_signal_connect(handle, event_im_recv, im_recv_im, NULL); | |
568 gaim_signal_connect(handle, event_chat_recv, chat_recv_im, NULL); | |
569 gaim_signal_connect(handle, event_im_send, im_sent_im, NULL); | |
570 gaim_signal_connect(handle, event_chat_send, chat_sent_im, NULL); | |
571 gaim_signal_connect(handle, event_new_conversation, new_conv, NULL); | |
572 gaim_signal_connect(handle, event_chat_join, chat_join, NULL); | |
573 return NULL; | |
574 } | |
575 | |
576 void gaim_plugin_remove() { | |
577 GList *c = gaim_get_conversations(); | |
578 | |
579 while (c) { | |
580 struct gaim_conversation *cnv = (struct gaim_conversation *)c->data; | |
581 struct gaim_gtk_window *gtkwin; | |
582 | |
583 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(cnv)); | |
584 | |
585 detach_signals(cnv); | |
586 un_star(gtkwin->window, NULL); | |
587 | |
588 c = c->next; | |
589 } | |
590 | |
591 /* this might be a hack I'm not sure, I don't think so but... */ | |
592 g_free(title_string); | |
593 } | |
594 | |
595 struct gaim_plugin_description desc; | |
596 struct gaim_plugin_description *gaim_plugin_desc() { | |
597 desc.api_version = PLUGIN_API_VERSION; | |
598 desc.name = g_strdup(_("Message Notification")); | |
599 desc.version = g_strdup(VERSION); | |
600 desc.description = g_strdup(_("Provides a variety of ways of notifying you of unread messages.")); | |
601 desc.authors = g_strdup("Etan Reisner <deryni@eden.rutgers.edu>"); | |
602 desc.url = g_strdup(WEBSITE); | |
603 return &desc; | |
604 } | |
605 | |
606 char *name() { | |
607 return _("Message Notification"); | |
608 } | |
609 | |
610 char *description() { | |
611 return _("Provides a variety of ways of notifying you of unread messages."); | |
612 } | |
613 | |
614 GtkWidget *gaim_plugin_config_gtk() { | |
615 GtkWidget *ret; | 563 GtkWidget *ret; |
616 GtkWidget *vbox, *hbox; | 564 GtkWidget *vbox, *hbox; |
617 GtkWidget *toggle, *button; | 565 GtkWidget *toggle, *button; |
618 ret = gtk_vbox_new(FALSE, 18); | 566 ret = gtk_vbox_new(FALSE, 18); |
619 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | 567 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
686 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(apply_options), NULL); | 634 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(apply_options), NULL); |
687 | 635 |
688 gtk_widget_show_all(ret); | 636 gtk_widget_show_all(ret); |
689 return ret; | 637 return ret; |
690 } | 638 } |
639 | |
640 static gboolean | |
641 plugin_load(GaimPlugin *plugin) | |
642 { | |
643 title_string = g_strdup("(*) "); | |
644 | |
645 load_notify_prefs(); | |
646 | |
647 gaim_signal_connect(plugin, event_im_recv, im_recv_im, NULL); | |
648 gaim_signal_connect(plugin, event_chat_recv, chat_recv_im, NULL); | |
649 gaim_signal_connect(plugin, event_im_send, im_sent_im, NULL); | |
650 gaim_signal_connect(plugin, event_chat_send, chat_sent_im, NULL); | |
651 gaim_signal_connect(plugin, event_new_conversation, new_conv, NULL); | |
652 gaim_signal_connect(plugin, event_chat_join, chat_join, NULL); | |
653 | |
654 return TRUE; | |
655 } | |
656 | |
657 static gboolean | |
658 plugin_unload(GaimPlugin *plugin) | |
659 { | |
660 GList *c = gaim_get_conversations(); | |
661 | |
662 while (c) { | |
663 struct gaim_conversation *cnv = (struct gaim_conversation *)c->data; | |
664 struct gaim_gtk_window *gtkwin; | |
665 | |
666 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(cnv)); | |
667 | |
668 detach_signals(cnv); | |
669 un_star(gtkwin->window, NULL); | |
670 | |
671 c = c->next; | |
672 } | |
673 | |
674 /* this might be a hack I'm not sure, I don't think so but... */ | |
675 g_free(title_string); | |
676 | |
677 return TRUE; | |
678 } | |
679 | |
680 static GaimGtkPluginUiInfo ui_info = | |
681 { | |
682 get_config_frame | |
683 }; | |
684 | |
685 static GaimPluginInfo info = | |
686 { | |
687 2, /**< api_version */ | |
688 GAIM_PLUGIN_STANDARD, /**< type */ | |
689 GAIM_GTK_PLUGIN_TYPE, /**< ui_requirement */ | |
690 0, /**< flags */ | |
691 NULL, /**< dependencies */ | |
692 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
693 | |
694 NOTIFY_PLUGIN_ID, /**< id */ | |
695 N_("Message Notification"), /**< name */ | |
696 VERSION, /**< version */ | |
697 /** summary */ | |
698 N_("Provides a variety of ways of notifying you of unread messages."), | |
699 /** description */ | |
700 N_("Provides a variety of ways of notifying you of unread messages."), | |
701 "Etan Reisner <deryni@eden.rutgers.edu>", /**< author */ | |
702 WEBSITE, /**< homepage */ | |
703 | |
704 plugin_load, /**< load */ | |
705 plugin_unload, /**< unload */ | |
706 NULL, /**< destroy */ | |
707 | |
708 &ui_info, /**< ui_info */ | |
709 NULL /**< extra_info */ | |
710 }; | |
711 | |
712 static void | |
713 __init_plugin(GaimPlugin *plugin) | |
714 { | |
715 } | |
716 | |
717 GAIM_INIT_PLUGIN(notify, __init_plugin, info); |