Mercurial > pidgin
comparison libpurple/plugins/signals-test.c @ 26936:e0f6c61ba779
Add the XMPP signals to the signals-test plugin
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Fri, 22 May 2009 05:09:12 +0000 |
parents | 0924698e2362 |
children | 74c9f4f79825 |
comparison
equal
deleted
inserted
replaced
26935:31f65046b92d | 26936:e0f6c61ba779 |
---|---|
622 i, subjects[i], froms[i], tos[i], urls[i]); | 622 i, subjects[i], froms[i], tos[i], urls[i]); |
623 } | 623 } |
624 } | 624 } |
625 | 625 |
626 /************************************************************************** | 626 /************************************************************************** |
627 * Jabber signals callbacks | |
628 **************************************************************************/ | |
629 static gboolean | |
630 jabber_iq_received(PurpleConnection *pc, const char *type, const char *id, | |
631 const char *from, xmlnode *iq) | |
632 { | |
633 purple_debug_misc("signals test", "received IQ (type=%s, id=%s, from=%s) %p\n", | |
634 type, id, from, iq); | |
635 | |
636 /* We don't want the plugin to stop processing */ | |
637 return FALSE; | |
638 } | |
639 | |
640 static gboolean | |
641 jabber_message_received(PurpleConnection *pc, const char *type, const char *id, | |
642 const char *from, const char *to, xmlnode *message) | |
643 { | |
644 purple_debug_misc("signals test", "received message (type=%s, id=%s, " | |
645 "from=%s to=%s) %p\n", | |
646 type, id, from, to, message); | |
647 | |
648 /* We don't want the plugin to stop processing */ | |
649 return FALSE; | |
650 } | |
651 | |
652 static gboolean | |
653 jabber_presence_received(PurpleConnection *pc, const char *type, | |
654 const char *from, xmlnode *presence) | |
655 { | |
656 purple_debug_misc("signals test", "received presence (type=%s, from=%s) %p\n", | |
657 type, from, presence); | |
658 | |
659 /* We don't want the plugin to stop processing */ | |
660 return FALSE; | |
661 } | |
662 | |
663 /************************************************************************** | |
627 * Plugin stuff | 664 * Plugin stuff |
628 **************************************************************************/ | 665 **************************************************************************/ |
629 static gboolean | 666 static gboolean |
630 plugin_load(PurplePlugin *plugin) | 667 plugin_load(PurplePlugin *plugin) |
631 { | 668 { |
636 void *accounts_handle = purple_accounts_get_handle(); | 673 void *accounts_handle = purple_accounts_get_handle(); |
637 void *ciphers_handle = purple_ciphers_get_handle(); | 674 void *ciphers_handle = purple_ciphers_get_handle(); |
638 void *ft_handle = purple_xfers_get_handle(); | 675 void *ft_handle = purple_xfers_get_handle(); |
639 void *sound_handle = purple_sounds_get_handle(); | 676 void *sound_handle = purple_sounds_get_handle(); |
640 void *notify_handle = purple_notify_get_handle(); | 677 void *notify_handle = purple_notify_get_handle(); |
678 void *jabber_handle = purple_plugins_find_with_id("prpl-jabber"); | |
641 | 679 |
642 /* Accounts subsystem signals */ | 680 /* Accounts subsystem signals */ |
643 purple_signal_connect(accounts_handle, "account-connecting", | 681 purple_signal_connect(accounts_handle, "account-connecting", |
644 plugin, PURPLE_CALLBACK(account_connecting_cb), NULL); | 682 plugin, PURPLE_CALLBACK(account_connecting_cb), NULL); |
645 purple_signal_connect(accounts_handle, "account-setting-info", | 683 purple_signal_connect(accounts_handle, "account-setting-info", |
781 purple_signal_connect(notify_handle, "displaying-email-notification", | 819 purple_signal_connect(notify_handle, "displaying-email-notification", |
782 plugin, PURPLE_CALLBACK(notify_email_cb), NULL); | 820 plugin, PURPLE_CALLBACK(notify_email_cb), NULL); |
783 purple_signal_connect(notify_handle, "displaying-emails-notification", | 821 purple_signal_connect(notify_handle, "displaying-emails-notification", |
784 plugin, PURPLE_CALLBACK(notify_emails_cb), NULL); | 822 plugin, PURPLE_CALLBACK(notify_emails_cb), NULL); |
785 | 823 |
824 /* Jabber signals */ | |
825 if (jabber_handle) { | |
826 purple_signal_connect(jabber_handle, "jabber-receiving-iq", plugin, | |
827 PURPLE_CALLBACK(jabber_iq_received), NULL); | |
828 purple_signal_connect(jabber_handle, "jabber-receiving-message", plugin, | |
829 PURPLE_CALLBACK(jabber_message_received), NULL); | |
830 purple_signal_connect(jabber_handle, "jabber-receiving-presence", plugin, | |
831 PURPLE_CALLBACK(jabber_presence_received), NULL); | |
832 } | |
833 | |
834 return TRUE; | |
835 } | |
836 | |
837 static gboolean | |
838 plugin_unload(PurplePlugin *plugin) | |
839 { | |
840 purple_signals_disconnect_by_handle(plugin); | |
841 | |
786 return TRUE; | 842 return TRUE; |
787 } | 843 } |
788 | 844 |
789 static PurplePluginInfo info = | 845 static PurplePluginInfo info = |
790 { | 846 { |
806 N_("Test to see that all signals are working properly."), | 862 N_("Test to see that all signals are working properly."), |
807 "Christian Hammond <chipx86@gnupdate.org>", /**< author */ | 863 "Christian Hammond <chipx86@gnupdate.org>", /**< author */ |
808 PURPLE_WEBSITE, /**< homepage */ | 864 PURPLE_WEBSITE, /**< homepage */ |
809 | 865 |
810 plugin_load, /**< load */ | 866 plugin_load, /**< load */ |
811 NULL, /**< unload */ | 867 plugin_unload, /**< unload */ |
812 NULL, /**< destroy */ | 868 NULL, /**< destroy */ |
813 | 869 |
814 NULL, /**< ui_info */ | 870 NULL, /**< ui_info */ |
815 NULL, /**< extra_info */ | 871 NULL, /**< extra_info */ |
816 NULL, | 872 NULL, |