Mercurial > pidgin.yaz
comparison plugins/psychic.c @ 12924:e841e23a334c
[gaim-migrate @ 15277]
patch #1408512 Psychic popups: disable when away
committer: Tailor Script <tailor@pidgin.im>
author | Christopher O'Brien <siege@pidgin.im> |
---|---|
date | Wed, 18 Jan 2006 03:04:25 +0000 |
parents | a355472257f4 |
children | fd734d1fb2f4 |
comparison
equal
deleted
inserted
replaced
12923:f50a99d5ba9b | 12924:e841e23a334c |
---|---|
1 | 1 |
2 | 2 |
3 #include "internal.h" | 3 #include "internal.h" |
4 | 4 |
5 #include "account.h" | |
5 #include "blist.h" | 6 #include "blist.h" |
6 #include "conversation.h" | 7 #include "conversation.h" |
7 #include "debug.h" | 8 #include "debug.h" |
8 #include "signals.h" | 9 #include "signals.h" |
10 #include "status.h" | |
9 #include "version.h" | 11 #include "version.h" |
10 | 12 |
11 #include "plugin.h" | 13 #include "plugin.h" |
12 #include "pluginpref.h" | 14 #include "pluginpref.h" |
13 #include "prefs.h" | 15 #include "prefs.h" |
25 | 27 |
26 | 28 |
27 #define PREFS_BASE "/plugins/core/psychic" | 29 #define PREFS_BASE "/plugins/core/psychic" |
28 #define PREF_BUDDIES PREFS_BASE "/buddies_only" | 30 #define PREF_BUDDIES PREFS_BASE "/buddies_only" |
29 #define PREF_NOTICE PREFS_BASE "/show_notice" | 31 #define PREF_NOTICE PREFS_BASE "/show_notice" |
32 #define PREF_STATUS PREFS_BASE "/activate_online" | |
30 | 33 |
31 | 34 |
32 static void | 35 static void |
33 buddy_typing_cb(GaimAccount *acct, const char *name, void *data) { | 36 buddy_typing_cb(GaimAccount *acct, const char *name, void *data) { |
34 GaimConversation *gconv; | 37 GaimConversation *gconv; |
35 | 38 |
36 if(gaim_prefs_get_bool(PREF_BUDDIES)) { | 39 if(gaim_prefs_get_bool(PREF_STATUS) && |
37 if(! gaim_find_buddy(acct, name)) { | 40 gaim_status_is_available(gaim_account_get_active_status(acct))) { |
38 DEBUG_INFO("not in blist, doing nothing\n"); | 41 DEBUG_INFO("not available, doing nothing\n"); |
39 return; | 42 return; |
40 } | 43 } |
44 | |
45 if(gaim_prefs_get_bool(PREF_BUDDIES) && | |
46 ! gaim_find_buddy(acct, name)) { | |
47 DEBUG_INFO("not in blist, doing nothing\n"); | |
48 return; | |
41 } | 49 } |
42 | 50 |
43 gconv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, acct); | 51 gconv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, acct); |
44 if(! gconv) { | 52 if(! gconv) { |
45 DEBUG_INFO("no previous conversation exists\n"); | 53 DEBUG_INFO("no previous conversation exists\n"); |
63 GaimPluginPref *pref; | 71 GaimPluginPref *pref; |
64 | 72 |
65 frame = gaim_plugin_pref_frame_new(); | 73 frame = gaim_plugin_pref_frame_new(); |
66 | 74 |
67 pref = gaim_plugin_pref_new_with_name(PREF_BUDDIES); | 75 pref = gaim_plugin_pref_new_with_name(PREF_BUDDIES); |
68 gaim_plugin_pref_set_label(pref, _("Only enable for users on the buddy list")); | 76 gaim_plugin_pref_set_label(pref, _("Only enable for users on" |
77 " the buddy list")); | |
78 gaim_plugin_pref_frame_add(frame, pref); | |
79 | |
80 pref = gaim_plugin_pref_new_with_name(PREF_STATUS); | |
81 gaim_plugin_pref_set_label(pref, _("Disable when away")); | |
69 gaim_plugin_pref_frame_add(frame, pref); | 82 gaim_plugin_pref_frame_add(frame, pref); |
70 | 83 |
71 pref = gaim_plugin_pref_new_with_name(PREF_NOTICE); | 84 pref = gaim_plugin_pref_new_with_name(PREF_NOTICE); |
72 gaim_plugin_pref_set_label(pref, _("Display notification message in" | 85 gaim_plugin_pref_set_label(pref, _("Display notification message in" |
73 " conversations")); | 86 " conversations")); |
129 static void | 142 static void |
130 init_plugin(GaimPlugin *plugin) { | 143 init_plugin(GaimPlugin *plugin) { |
131 gaim_prefs_add_none(PREFS_BASE); | 144 gaim_prefs_add_none(PREFS_BASE); |
132 gaim_prefs_add_bool(PREF_BUDDIES, FALSE); | 145 gaim_prefs_add_bool(PREF_BUDDIES, FALSE); |
133 gaim_prefs_add_bool(PREF_NOTICE, TRUE); | 146 gaim_prefs_add_bool(PREF_NOTICE, TRUE); |
147 gaim_prefs_add_bool(PREF_STATUS, TRUE); | |
134 } | 148 } |
135 | 149 |
136 | 150 |
137 GAIM_INIT_PLUGIN(psychic, init_plugin, info) | 151 GAIM_INIT_PLUGIN(psychic, init_plugin, info) |