annotate plugins/statenotify.c @ 9459:dbeca8eca296

[gaim-migrate @ 10283] (08:24:24) LSchiere: nosnilmot: https://sourceforge.net/tracker/?func=detail&atid=100235&aid=972285&group_id=235 (08:37:39) nosnilmot: LSchiere: the only way I can reproduce anything like what's reported in that bug is by having the formatting toolbar disabled in prefs, and manually enabling it each time I start a new conversation (08:38:12) LSchiere: nosnilmot: can you fix that case? ;-) (08:38:34) nosnilmot: LSchiere: I doubt it (08:38:42) LSchiere: :-/ (08:39:00) nosnilmot: that would seem to be a stupid case to support, if the user really wants the formatting toolbar then they should just enable it in prefs! (08:39:51) LSchiere: now that's not quite so true. i've got it globally disabled and i've been known to enable it just long enough to remember the code to a smiley i've forgotten (08:40:52) nosnilmot: actually... how about if I try to check if the formatting toolbar is present, and if it's presence doesn't match preferences, don't save the conv size? (08:41:10) LSchiere: that works committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 06 Jul 2004 12:58:29 +0000
parents 294ae6548d4e
children 91c9e060111b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
6 #include "signals.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
7
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 static void
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6621
diff changeset
9 write_status(GaimBuddy *buddy, const char *message)
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5587
diff changeset
11 GaimConversation *conv;
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
12 const char *who;
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 char buf[256];
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
15 conv = gaim_find_conversation_with_account(buddy->name, buddy->account);
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 if (conv == NULL)
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 return;
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
20 who = gaim_get_buddy_alias(buddy);
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21
6489
aefe4067d3a3 [gaim-migrate @ 7003]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
22 g_snprintf(buf, sizeof(buf), message, who);
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6695
diff changeset
24 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL));
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 }
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 static void
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6621
diff changeset
28 buddy_away_cb(GaimBuddy *buddy, void *data)
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 {
6489
aefe4067d3a3 [gaim-migrate @ 7003]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
30 write_status(buddy, _("%s has gone away."));
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 }
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 static void
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6621
diff changeset
34 buddy_unaway_cb(GaimBuddy *buddy, void *data)
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 {
6489
aefe4067d3a3 [gaim-migrate @ 7003]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
36 write_status(buddy, _("%s is no longer away."));
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 }
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 static void
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6621
diff changeset
40 buddy_idle_cb(GaimBuddy *buddy, void *data)
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 {
6489
aefe4067d3a3 [gaim-migrate @ 7003]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
42 write_status(buddy, _("%s has become idle."));
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 }
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 static void
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6621
diff changeset
46 buddy_unidle_cb(GaimBuddy *buddy, void *data)
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 {
6489
aefe4067d3a3 [gaim-migrate @ 7003]
Nathan Walp <nwalp@pidgin.im>
parents: 6485
diff changeset
48 write_status(buddy, _("%s is no longer idle."));
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 }
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 static gboolean
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 plugin_load(GaimPlugin *plugin)
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
54 void *blist_handle = gaim_blist_get_handle();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
55
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
56 gaim_signal_connect(blist_handle, "buddy-away",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
57 plugin, GAIM_CALLBACK(buddy_away_cb), NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
58 gaim_signal_connect(blist_handle, "buddy-back",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
59 plugin, GAIM_CALLBACK(buddy_unaway_cb), NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
60 gaim_signal_connect(blist_handle, "buddy-idle",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
61 plugin, GAIM_CALLBACK(buddy_idle_cb), NULL);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
62 gaim_signal_connect(blist_handle, "buddy-unidle",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
63 plugin, GAIM_CALLBACK(buddy_unidle_cb), NULL);
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 return TRUE;
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 }
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 static GaimPluginInfo info =
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 {
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
70 GAIM_PLUGIN_API_VERSION, /**< api_version */
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 GAIM_PLUGIN_STANDARD, /**< type */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 NULL, /**< ui_requirement */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 0, /**< flags */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 NULL, /**< dependencies */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 GAIM_PRIORITY_DEFAULT, /**< priority */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 NULL, /**< id */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 N_("Buddy State Notification"), /**< name */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 VERSION, /**< version */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 /** summary */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 N_("Notifies in a conversation window when a buddy goes or returns from "
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 "away or idle."),
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 /** description */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 N_("Notifies in a conversation window when a buddy goes or returns from "
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 "away or idle."),
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 "Christian Hammond <chipx86@gnupdate.org>", /**< author */
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6441
diff changeset
87 GAIM_WEBSITE, /**< homepage */
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 plugin_load, /**< load */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 NULL, /**< unload */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 NULL, /**< destroy */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 NULL, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
94 NULL, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
95 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8749
diff changeset
96 NULL
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 };
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5873
diff changeset
100 init_plugin(GaimPlugin *plugin)
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 {
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 }
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5920
diff changeset
104 GAIM_INIT_PLUGIN(statenotify, init_plugin, info)