Thu, 16 Jul 2015 16:32:40 -0400
Remove call to the deprecated and stubbed gnutls_global_set_mem_functions(). Fixes #16702
| 12859 | 1 | |
| 2 | ||
| 3 | #include "internal.h" | |
| 4 | ||
|
12924
ed6ed1510bb1
[gaim-migrate @ 15277]
Christopher O'Brien <siege@pidgin.im>
parents:
12895
diff
changeset
|
5 | #include "account.h" |
| 12859 | 6 | #include "blist.h" |
| 7 | #include "conversation.h" | |
| 8 | #include "debug.h" | |
| 9 | #include "signals.h" | |
|
12924
ed6ed1510bb1
[gaim-migrate @ 15277]
Christopher O'Brien <siege@pidgin.im>
parents:
12895
diff
changeset
|
10 | #include "status.h" |
| 12859 | 11 | #include "version.h" |
|
16733
97cc23596b8a
Cause Psychic Mode to obey privacy settings when apprpriate. Thanks
Ethan Blanton <elb@pidgin.im>
parents:
16481
diff
changeset
|
12 | #include "privacy.h" |
| 12859 | 13 | |
| 14 | #include "plugin.h" | |
| 15 | #include "pluginpref.h" | |
| 16 | #include "prefs.h" | |
| 17 | ||
| 18 | ||
| 19 | #define PLUGIN_ID "core-psychic" | |
| 20 | #define PLUGIN_NAME N_("Psychic Mode") | |
| 21 | #define PLUGIN_SUMMARY N_("Psychic mode for incoming conversation") | |
| 22 | #define PLUGIN_DESC N_("Causes conversation windows to appear as other" \ | |
|
13248
fffad481d1ad
[gaim-migrate @ 15613]
Mark Doliner <markdoliner@pidgin.im>
parents:
12925
diff
changeset
|
23 | " users begin to message you. This works for" \ |
|
38089
da90fe7312d3
yahoo: Remove protocol plugin from tree
Mike Ruprecht <cmaiku@gmail.com>
parents:
31294
diff
changeset
|
24 | " AIM, ICQ, XMPP, and Sametime") |
| 12859 | 25 | #define PLUGIN_AUTHOR "Christopher O'Brien <siege@preoccupied.net>" |
| 26 | ||
| 27 | ||
| 16481 | 28 | #define PREFS_BASE "/plugins/core/psychic" |
| 12859 | 29 | #define PREF_BUDDIES PREFS_BASE "/buddies_only" |
| 30 | #define PREF_NOTICE PREFS_BASE "/show_notice" | |
|
12924
ed6ed1510bb1
[gaim-migrate @ 15277]
Christopher O'Brien <siege@pidgin.im>
parents:
12895
diff
changeset
|
31 | #define PREF_STATUS PREFS_BASE "/activate_online" |
| 14977 | 32 | #define PREF_RAISE PREFS_BASE "/raise_conv" |
| 12859 | 33 | |
| 34 | ||
| 35 | static void | |
| 15884 | 36 | buddy_typing_cb(PurpleAccount *acct, const char *name, void *data) { |
| 37 | PurpleConversation *gconv; | |
| 12859 | 38 | |
| 15884 | 39 | if(purple_prefs_get_bool(PREF_STATUS) && |
| 40 | ! purple_status_is_available(purple_account_get_active_status(acct))) { | |
| 41 | purple_debug_info("psychic", "not available, doing nothing\n"); | |
|
12924
ed6ed1510bb1
[gaim-migrate @ 15277]
Christopher O'Brien <siege@pidgin.im>
parents:
12895
diff
changeset
|
42 | return; |
|
ed6ed1510bb1
[gaim-migrate @ 15277]
Christopher O'Brien <siege@pidgin.im>
parents:
12895
diff
changeset
|
43 | } |
|
ed6ed1510bb1
[gaim-migrate @ 15277]
Christopher O'Brien <siege@pidgin.im>
parents:
12895
diff
changeset
|
44 | |
| 15884 | 45 | if(purple_prefs_get_bool(PREF_BUDDIES) && |
| 46 | ! purple_find_buddy(acct, name)) { | |
| 47 | purple_debug_info("psychic", "not in blist, doing nothing\n"); | |
|
12924
ed6ed1510bb1
[gaim-migrate @ 15277]
Christopher O'Brien <siege@pidgin.im>
parents:
12895
diff
changeset
|
48 | return; |
| 12859 | 49 | } |
| 50 | ||
|
16733
97cc23596b8a
Cause Psychic Mode to obey privacy settings when apprpriate. Thanks
Ethan Blanton <elb@pidgin.im>
parents:
16481
diff
changeset
|
51 | if(FALSE == purple_privacy_check(acct, name)) { |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16961
diff
changeset
|
52 | purple_debug_info("psychic", "user %s is blocked\n", name); |
|
16733
97cc23596b8a
Cause Psychic Mode to obey privacy settings when apprpriate. Thanks
Ethan Blanton <elb@pidgin.im>
parents:
16481
diff
changeset
|
53 | return; |
|
97cc23596b8a
Cause Psychic Mode to obey privacy settings when apprpriate. Thanks
Ethan Blanton <elb@pidgin.im>
parents:
16481
diff
changeset
|
54 | } |
|
97cc23596b8a
Cause Psychic Mode to obey privacy settings when apprpriate. Thanks
Ethan Blanton <elb@pidgin.im>
parents:
16481
diff
changeset
|
55 | |
| 15884 | 56 | gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, acct); |
| 12859 | 57 | if(! gconv) { |
| 15884 | 58 | purple_debug_info("psychic", "no previous conversation exists\n"); |
| 59 | gconv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, name); | |
| 14977 | 60 | |
| 15884 | 61 | if(purple_prefs_get_bool(PREF_RAISE)) { |
| 62 | purple_conversation_present(gconv); | |
| 14977 | 63 | } |
| 12859 | 64 | |
| 15884 | 65 | if(purple_prefs_get_bool(PREF_NOTICE)) { |
| 14977 | 66 | |
| 67 | /* This is a quote from Star Wars. You should probably not | |
| 68 | translate it literally. If you can't find a fitting cultural | |
| 69 | reference in your language, consider translating something | |
| 70 | like this instead: "You feel a new message coming." */ | |
| 15884 | 71 | purple_conversation_write(gconv, NULL, |
|
12861
60c0456f1fff
[gaim-migrate @ 15212]
Christopher O'Brien <siege@pidgin.im>
parents:
12859
diff
changeset
|
72 | _("You feel a disturbance in the force..."), |
| 15884 | 73 | PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_ACTIVE_ONLY, |
|
12895
e075f4a4bcb3
[gaim-migrate @ 15248]
Richard Laager <rlaager@pidgin.im>
parents:
12861
diff
changeset
|
74 | time(NULL)); |
| 12859 | 75 | } |
|
13248
fffad481d1ad
[gaim-migrate @ 15613]
Mark Doliner <markdoliner@pidgin.im>
parents:
12925
diff
changeset
|
76 | |
|
27250
47fc0f87ce94
Consistently emit conversation-updated for typing state changes.
Florian Quèze <florian@instantbird.org>
parents:
20288
diff
changeset
|
77 | /* Necessary because we may be creating a new conversation window. */ |
| 15884 | 78 | purple_conv_im_set_typing_state(PURPLE_CONV_IM(gconv), PURPLE_TYPING); |
| 12859 | 79 | } |
| 80 | } | |
| 81 | ||
| 82 | ||
| 15884 | 83 | static PurplePluginPrefFrame * |
| 84 | get_plugin_pref_frame(PurplePlugin *plugin) { | |
| 12859 | 85 | |
| 15884 | 86 | PurplePluginPrefFrame *frame; |
| 87 | PurplePluginPref *pref; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27250
diff
changeset
|
88 | |
| 15884 | 89 | frame = purple_plugin_pref_frame_new(); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27250
diff
changeset
|
90 | |
| 15884 | 91 | pref = purple_plugin_pref_new_with_name(PREF_BUDDIES); |
| 92 | purple_plugin_pref_set_label(pref, _("Only enable for users on" | |
|
12924
ed6ed1510bb1
[gaim-migrate @ 15277]
Christopher O'Brien <siege@pidgin.im>
parents:
12895
diff
changeset
|
93 | " the buddy list")); |
| 15884 | 94 | purple_plugin_pref_frame_add(frame, pref); |
|
12924
ed6ed1510bb1
[gaim-migrate @ 15277]
Christopher O'Brien <siege@pidgin.im>
parents:
12895
diff
changeset
|
95 | |
| 15884 | 96 | pref = purple_plugin_pref_new_with_name(PREF_STATUS); |
| 97 | purple_plugin_pref_set_label(pref, _("Disable when away")); | |
| 98 | purple_plugin_pref_frame_add(frame, pref); | |
| 12859 | 99 | |
| 15884 | 100 | pref = purple_plugin_pref_new_with_name(PREF_NOTICE); |
| 101 | purple_plugin_pref_set_label(pref, _("Display notification message in" | |
| 12859 | 102 | " conversations")); |
| 15884 | 103 | purple_plugin_pref_frame_add(frame, pref); |
| 12859 | 104 | |
| 15884 | 105 | pref = purple_plugin_pref_new_with_name(PREF_RAISE); |
| 106 | purple_plugin_pref_set_label(pref, _("Raise psychic conversations")); | |
| 107 | purple_plugin_pref_frame_add(frame, pref); | |
| 14977 | 108 | |
| 12859 | 109 | return frame; |
| 110 | } | |
| 111 | ||
| 112 | ||
| 113 | static gboolean | |
| 15884 | 114 | plugin_load(PurplePlugin *plugin) { |
| 12859 | 115 | |
| 116 | void *convs_handle; | |
| 15884 | 117 | convs_handle = purple_conversations_get_handle(); |
| 12859 | 118 | |
| 15884 | 119 | purple_signal_connect(convs_handle, "buddy-typing", plugin, |
| 120 | PURPLE_CALLBACK(buddy_typing_cb), NULL); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27250
diff
changeset
|
121 | |
| 12859 | 122 | return TRUE; |
| 123 | } | |
| 124 | ||
| 125 | ||
| 15884 | 126 | static PurplePluginUiInfo prefs_info = { |
| 12859 | 127 | get_plugin_pref_frame, |
| 128 | 0, /* page_num (Reserved) */ | |
| 129 | NULL, /* frame (Reserved) */ | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27250
diff
changeset
|
130 | |
|
16745
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
131 | /* padding */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
132 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
133 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
134 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
135 | NULL |
| 12859 | 136 | }; |
| 137 | ||
| 138 | ||
| 15884 | 139 | static PurplePluginInfo info = { |
| 140 | PURPLE_PLUGIN_MAGIC, | |
| 141 | PURPLE_MAJOR_VERSION, | |
| 142 | PURPLE_MINOR_VERSION, | |
| 143 | PURPLE_PLUGIN_STANDARD, /**< type */ | |
| 12859 | 144 | NULL, /**< ui_requirement */ |
| 145 | 0, /**< flags */ | |
| 146 | NULL, /**< dependencies */ | |
| 15884 | 147 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27250
diff
changeset
|
148 | |
| 12859 | 149 | PLUGIN_ID, /**< id */ |
| 150 | PLUGIN_NAME, /**< name */ | |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
151 | DISPLAY_VERSION, /**< version */ |
| 12859 | 152 | PLUGIN_SUMMARY, /**< summary */ |
| 153 | PLUGIN_DESC, /**< description */ | |
| 154 | PLUGIN_AUTHOR, /**< author */ | |
| 15884 | 155 | PURPLE_WEBSITE, /**< homepage */ |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27250
diff
changeset
|
156 | |
| 12859 | 157 | plugin_load, /**< load */ |
| 158 | NULL, /**< unload */ | |
| 159 | NULL, /**< destroy */ | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27250
diff
changeset
|
160 | |
| 12859 | 161 | NULL, /**< ui_info */ |
| 162 | NULL, /**< extra_info */ | |
| 163 | &prefs_info, /**< prefs_info */ | |
| 164 | NULL, /**< actions */ | |
|
16745
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
165 | |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
166 | /* padding */ |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
167 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
168 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
169 | NULL, |
|
df2c3d6b609a
And the rest of the plugins that are compiling for me by default...
Gary Kramlich <grim@reaperworld.com>
parents:
16481
diff
changeset
|
170 | NULL |
| 12859 | 171 | }; |
| 172 | ||
| 173 | ||
| 174 | static void | |
| 15884 | 175 | init_plugin(PurplePlugin *plugin) { |
| 176 | purple_prefs_add_none(PREFS_BASE); | |
| 177 | purple_prefs_add_bool(PREF_BUDDIES, FALSE); | |
| 178 | purple_prefs_add_bool(PREF_NOTICE, TRUE); | |
| 179 | purple_prefs_add_bool(PREF_STATUS, TRUE); | |
| 12859 | 180 | } |
| 181 | ||
| 182 | ||
| 15884 | 183 | PURPLE_INIT_PLUGIN(psychic, init_plugin, info) |