Tue, 23 Nov 2004 06:14:15 +0000
[gaim-migrate @ 11386]
I changed gaim_find_conversation and gaim_find_conversation_with_account
The first parameter is now one of GAIM_CONV_IM, GAIM_CONV_CHAT or
GAIM_CONV_ANY. Unfortunately, this changes a bajillion files.
Please look over this and make sure I use the correct type everywhere.
Especially in Novell and MSN, and somewhat in SILC.
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1 | #include "internal.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2 | |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3 | #include "blist.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
4 | #include "conversation.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5 | #include "debug.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
6 | #include "signals.h" |
| 9943 | 7 | #include "version.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
8 | |
| 9583 | 9 | #include "plugin.h" |
| 10 | #include "pluginpref.h" | |
| 11 | #include "prefs.h" | |
| 12 | ||
| 13 | #define STATENOTIFY_PLUGIN_ID "core-statenotify" | |
| 14 | ||
| 5267 | 15 | static void |
| 6695 | 16 | write_status(GaimBuddy *buddy, const char *message) |
| 5267 | 17 | { |
|
5676
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5587
diff
changeset
|
18 | GaimConversation *conv; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
19 | const char *who; |
| 5267 | 20 | char buf[256]; |
|
10167
3f4db9c54e04
[gaim-migrate @ 11254]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9943
diff
changeset
|
21 | char *escaped; |
| 5267 | 22 | |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10167
diff
changeset
|
23 | conv = gaim_find_conversation_with_account(GAIM_CONV_IM, |
|
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10167
diff
changeset
|
24 | buddy->name, buddy->account); |
| 5267 | 25 | |
| 26 | if (conv == NULL) | |
| 27 | return; | |
| 28 | ||
|
9620
fe99fcea5c1c
[gaim-migrate @ 10464]
Christopher O'Brien <siege@pidgin.im>
parents:
9583
diff
changeset
|
29 | who = gaim_buddy_get_alias(buddy); |
|
10167
3f4db9c54e04
[gaim-migrate @ 11254]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9943
diff
changeset
|
30 | escaped = g_markup_escape_text(who, -1); |
| 5267 | 31 | |
|
10167
3f4db9c54e04
[gaim-migrate @ 11254]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9943
diff
changeset
|
32 | g_snprintf(buf, sizeof(buf), message, escaped); |
|
3f4db9c54e04
[gaim-migrate @ 11254]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9943
diff
changeset
|
33 | g_free(escaped); |
| 5267 | 34 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6695
diff
changeset
|
35 | gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
| 5267 | 36 | } |
| 37 | ||
| 38 | static void | |
| 6695 | 39 | buddy_away_cb(GaimBuddy *buddy, void *data) |
| 5267 | 40 | { |
| 9583 | 41 | if (gaim_prefs_get_bool("/plugins/core/statenotify/notify_away")) |
| 42 | write_status(buddy, _("%s has gone away.")); | |
| 5267 | 43 | } |
| 44 | ||
| 45 | static void | |
| 6695 | 46 | buddy_unaway_cb(GaimBuddy *buddy, void *data) |
| 5267 | 47 | { |
| 9583 | 48 | if (gaim_prefs_get_bool("/plugins/core/statenotify/notify_away")) |
| 49 | write_status(buddy, _("%s is no longer away.")); | |
| 5267 | 50 | } |
| 51 | ||
| 52 | static void | |
| 6695 | 53 | buddy_idle_cb(GaimBuddy *buddy, void *data) |
| 5267 | 54 | { |
| 9583 | 55 | if (gaim_prefs_get_bool("/plugins/core/statenotify/notify_idle")) |
| 56 | write_status(buddy, _("%s has become idle.")); | |
| 5267 | 57 | } |
| 58 | ||
| 59 | static void | |
| 6695 | 60 | buddy_unidle_cb(GaimBuddy *buddy, void *data) |
| 5267 | 61 | { |
| 9583 | 62 | if (gaim_prefs_get_bool("/plugins/core/statenotify/notify_idle")) |
| 63 | write_status(buddy, _("%s is no longer idle.")); | |
| 64 | } | |
| 65 | ||
| 66 | static GaimPluginPrefFrame * | |
| 67 | get_plugin_pref_frame(GaimPlugin *plugin) | |
| 68 | { | |
| 69 | GaimPluginPrefFrame *frame; | |
| 70 | GaimPluginPref *ppref; | |
| 71 | ||
| 72 | frame = gaim_plugin_pref_frame_new(); | |
| 73 | ||
|
9648
34a457599c78
[gaim-migrate @ 10496]
Mark Doliner <markdoliner@pidgin.im>
parents:
9620
diff
changeset
|
74 | ppref = gaim_plugin_pref_new_with_label(_("Notify When")); |
| 9583 | 75 | gaim_plugin_pref_frame_add(frame, ppref); |
| 76 | ||
|
9648
34a457599c78
[gaim-migrate @ 10496]
Mark Doliner <markdoliner@pidgin.im>
parents:
9620
diff
changeset
|
77 | ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_away", _("Buddy Goes _Away")); |
| 9583 | 78 | gaim_plugin_pref_frame_add(frame, ppref); |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10167
diff
changeset
|
79 | |
|
9648
34a457599c78
[gaim-migrate @ 10496]
Mark Doliner <markdoliner@pidgin.im>
parents:
9620
diff
changeset
|
80 | ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_idle", _("Buddy Goes _Idle")); |
| 9583 | 81 | gaim_plugin_pref_frame_add(frame, ppref); |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10167
diff
changeset
|
82 | |
| 9583 | 83 | return frame; |
| 5267 | 84 | } |
| 85 | ||
| 86 | static gboolean | |
| 87 | plugin_load(GaimPlugin *plugin) | |
| 88 | { | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
89 | void *blist_handle = gaim_blist_get_handle(); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
90 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
91 | gaim_signal_connect(blist_handle, "buddy-away", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
92 | plugin, GAIM_CALLBACK(buddy_away_cb), NULL); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
93 | gaim_signal_connect(blist_handle, "buddy-back", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
94 | plugin, GAIM_CALLBACK(buddy_unaway_cb), NULL); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
95 | gaim_signal_connect(blist_handle, "buddy-idle", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
96 | plugin, GAIM_CALLBACK(buddy_idle_cb), NULL); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
97 | gaim_signal_connect(blist_handle, "buddy-unidle", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
98 | plugin, GAIM_CALLBACK(buddy_unidle_cb), NULL); |
| 5267 | 99 | |
| 100 | return TRUE; | |
| 101 | } | |
| 102 | ||
| 9583 | 103 | static GaimPluginUiInfo prefs_info = |
| 104 | { | |
| 105 | get_plugin_pref_frame | |
| 106 | }; | |
| 107 | ||
| 5267 | 108 | static GaimPluginInfo info = |
| 109 | { | |
| 9943 | 110 | GAIM_PLUGIN_MAGIC, |
| 111 | GAIM_MAJOR_VERSION, | |
| 112 | GAIM_MINOR_VERSION, | |
| 5267 | 113 | GAIM_PLUGIN_STANDARD, /**< type */ |
| 114 | NULL, /**< ui_requirement */ | |
| 115 | 0, /**< flags */ | |
| 116 | NULL, /**< dependencies */ | |
| 117 | GAIM_PRIORITY_DEFAULT, /**< priority */ | |
| 118 | ||
| 9583 | 119 | STATENOTIFY_PLUGIN_ID, /**< id */ |
| 5267 | 120 | N_("Buddy State Notification"), /**< name */ |
| 121 | VERSION, /**< version */ | |
| 122 | /** summary */ | |
| 123 | N_("Notifies in a conversation window when a buddy goes or returns from " | |
| 124 | "away or idle."), | |
| 125 | /** description */ | |
| 126 | N_("Notifies in a conversation window when a buddy goes or returns from " | |
| 127 | "away or idle."), | |
| 128 | "Christian Hammond <chipx86@gnupdate.org>", /**< author */ | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
129 | GAIM_WEBSITE, /**< homepage */ |
| 5267 | 130 | |
| 131 | plugin_load, /**< load */ | |
| 132 | NULL, /**< unload */ | |
| 133 | NULL, /**< destroy */ | |
| 134 | ||
| 135 | NULL, /**< ui_info */ | |
| 8993 | 136 | NULL, /**< extra_info */ |
| 9583 | 137 | &prefs_info, /**< prefs_info */ |
| 8993 | 138 | NULL |
| 5267 | 139 | }; |
| 140 | ||
| 141 | static void | |
|
5920
963bfdefee02
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5873
diff
changeset
|
142 | init_plugin(GaimPlugin *plugin) |
| 5267 | 143 | { |
| 9583 | 144 | gaim_prefs_add_none("/plugins/core/statenotify"); |
| 145 | gaim_prefs_add_bool("/plugins/core/statenotify/notify_away", TRUE); | |
| 146 | gaim_prefs_add_bool("/plugins/core/statenotify/notify_idle", TRUE); | |
| 5267 | 147 | } |
| 148 | ||
| 6063 | 149 | GAIM_INIT_PLUGIN(statenotify, init_plugin, info) |