Mercurial > pidgin
annotate plugins/statenotify.c @ 5943:a4f2aba0848d
[gaim-migrate @ 6384]
This should fix corruption in the blist, accounts, and pounces when some
protocol plugins cannot load. Some parts of gaim now use the new unique
Plugin or Protocol Plugin IDs, while some still use the old protocol
numbers. Accounts kind of used both, and when prpls were missing, it had
trouble finding accounts. It would find the names, even without mapping the
protocol numbers to IDs, and any duplicate accounts would get nuked. That
would then affect pounce saving. Anyhow, long story short (well, it's
already long, too late for that), this should fix all that mess. And
introduce new mess, but hopefully temporary mess.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Mon, 23 Jun 2003 02:00:15 +0000 |
| parents | 7d385de2f9cd |
| children | 5239a3b4ab33 |
| rev | line source |
|---|---|
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1 #include "internal.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2 |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3 #include "blist.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
4 #include "conversation.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5 #include "debug.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
6 |
| 5267 | 7 static void |
|
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
8 write_status(GaimConnection *gc, char *who, const char *message) |
| 5267 | 9 { |
|
5676
dae79aefac8d
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5587
diff
changeset
|
10 GaimConversation *conv; |
| 5267 | 11 struct buddy *b; |
| 12 char buf[256]; | |
| 13 | |
| 14 conv = gaim_find_conversation_with_account(who, gc->account); | |
| 15 | |
| 16 if (conv == NULL) | |
| 17 return; | |
| 18 | |
| 19 if ((b = gaim_find_buddy(gc->account, who)) != NULL) | |
| 20 who = gaim_get_buddy_alias(b); | |
| 21 | |
| 22 g_snprintf(buf, sizeof(buf), "%s %s", who, message); | |
| 23 | |
| 24 gaim_conversation_write(conv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); | |
| 25 } | |
| 26 | |
| 27 static void | |
|
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
28 buddy_away_cb(GaimConnection *gc, char *who, void *data) |
| 5267 | 29 { |
| 30 write_status(gc, who, "has gone away."); | |
| 31 } | |
| 32 | |
| 33 static void | |
|
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
34 buddy_unaway_cb(GaimConnection *gc, char *who, void *data) |
| 5267 | 35 { |
| 36 write_status(gc, who, "is no longer away."); | |
| 37 } | |
| 38 | |
| 39 static void | |
|
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
40 buddy_idle_cb(GaimConnection *gc, char *who, void *data) |
| 5267 | 41 { |
| 42 write_status(gc, who, "has become idle."); | |
| 43 } | |
| 44 | |
| 45 static void | |
|
5587
1c55b1540e18
[gaim-migrate @ 5991]
Christian Hammond <chipx86@chipx86.com>
parents:
5267
diff
changeset
|
46 buddy_unidle_cb(GaimConnection *gc, char *who, void *data) |
| 5267 | 47 { |
| 48 write_status(gc, who, "is no longer idle."); | |
| 49 } | |
| 50 | |
| 51 static gboolean | |
| 52 plugin_load(GaimPlugin *plugin) | |
| 53 { | |
| 54 gaim_signal_connect(plugin, event_buddy_away, buddy_away_cb, NULL); | |
| 55 gaim_signal_connect(plugin, event_buddy_back, buddy_unaway_cb, NULL); | |
| 56 gaim_signal_connect(plugin, event_buddy_idle, buddy_idle_cb, NULL); | |
| 57 gaim_signal_connect(plugin, event_buddy_unidle, buddy_unidle_cb, NULL); | |
| 58 | |
| 59 return TRUE; | |
| 60 } | |
| 61 | |
| 62 static GaimPluginInfo info = | |
| 63 { | |
| 64 2, /**< api_version */ | |
| 65 GAIM_PLUGIN_STANDARD, /**< type */ | |
| 66 NULL, /**< ui_requirement */ | |
| 67 0, /**< flags */ | |
| 68 NULL, /**< dependencies */ | |
| 69 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
| 70 | |
| 71 NULL, /**< id */ | |
| 72 N_("Buddy State Notification"), /**< name */ | |
| 73 VERSION, /**< version */ | |
| 74 /** summary */ | |
| 75 N_("Notifies in a conversation window when a buddy goes or returns from " | |
| 76 "away or idle."), | |
| 77 /** description */ | |
| 78 N_("Notifies in a conversation window when a buddy goes or returns from " | |
| 79 "away or idle."), | |
| 80 "Christian Hammond <chipx86@gnupdate.org>", /**< author */ | |
| 81 WEBSITE, /**< homepage */ | |
| 82 | |
| 83 plugin_load, /**< load */ | |
| 84 NULL, /**< unload */ | |
| 85 NULL, /**< destroy */ | |
| 86 | |
| 87 NULL, /**< ui_info */ | |
| 88 NULL /**< extra_info */ | |
| 89 }; | |
| 90 | |
| 91 static void | |
|
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5873
diff
changeset
|
92 init_plugin(GaimPlugin *plugin) |
| 5267 | 93 { |
| 94 } | |
| 95 | |
|
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5873
diff
changeset
|
96 GAIM_INIT_PLUGIN(statenotify, init_plugin, info); |
