annotate plugins/statenotify.c @ 6155:bac97cd0ed45

[gaim-migrate @ 6630] Going back to non-animated typing icon. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 16 Jul 2003 17:57:20 +0000
parents 5239a3b4ab33
children 8f94cce8faa5
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"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
6
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
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
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5587
diff changeset
10 GaimConversation *conv;
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 struct buddy *b;
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 char buf[256];
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 conv = gaim_find_conversation_with_account(who, gc->account);
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 if (conv == NULL)
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 return;
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 if ((b = gaim_find_buddy(gc->account, who)) != NULL)
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 who = gaim_get_buddy_alias(b);
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 g_snprintf(buf, sizeof(buf), "%s %s", who, message);
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 gaim_conversation_write(conv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL));
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
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
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 {
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 write_status(gc, who, "has gone away.");
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
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
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 {
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 write_status(gc, who, "is no longer away.");
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
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
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 {
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 write_status(gc, who, "has become idle.");
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
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
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 {
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 write_status(gc, who, "is no longer idle.");
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 {
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 gaim_signal_connect(plugin, event_buddy_away, buddy_away_cb, NULL);
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 gaim_signal_connect(plugin, event_buddy_back, buddy_unaway_cb, NULL);
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 gaim_signal_connect(plugin, event_buddy_idle, buddy_idle_cb, NULL);
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 gaim_signal_connect(plugin, event_buddy_unidle, buddy_unidle_cb, NULL);
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 return TRUE;
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 }
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 static GaimPluginInfo info =
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 {
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 2, /**< api_version */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 GAIM_PLUGIN_STANDARD, /**< type */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 NULL, /**< ui_requirement */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 0, /**< flags */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 NULL, /**< dependencies */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 GAIM_PRIORITY_DEFAULT, /**< priority */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 NULL, /**< id */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 N_("Buddy State Notification"), /**< name */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 VERSION, /**< version */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 /** summary */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 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
76 "away or idle."),
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 /** description */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 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
79 "away or idle."),
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 "Christian Hammond <chipx86@gnupdate.org>", /**< author */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 WEBSITE, /**< homepage */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 plugin_load, /**< load */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 NULL, /**< unload */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 NULL, /**< destroy */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 NULL, /**< ui_info */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 NULL /**< extra_info */
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 };
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5873
diff changeset
92 init_plugin(GaimPlugin *plugin)
5267
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 {
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 }
3cd24f012091 [gaim-migrate @ 5639]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5920
diff changeset
96 GAIM_INIT_PLUGIN(statenotify, init_plugin, info)