Mercurial > pidgin
comparison plugins/mailchk.c @ 8598:58e02f309485
[gaim-migrate @ 9349]
" I've got two patches for mailchk. The first fixes some
compile errors. The second patch adds a preference for
whether or not to play a sound on new mail since it
keeps annoying me (the second patch depends on the
first).
The third patch fixes up my entry in the COPYRIGHT file
(adds the rest of my last name)." --Paul Aurich
that second mailck patch didn't go in.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Tue, 06 Apr 2004 15:11:20 +0000 |
parents | cce494e69d68 |
children | d7b8eb1f0a18 |
comparison
equal
deleted
inserted
replaced
8597:d0d1507b52b4 | 8598:58e02f309485 |
---|---|
7 #include "signals.h" | 7 #include "signals.h" |
8 #include "sound.h" | 8 #include "sound.h" |
9 | 9 |
10 #include "gtkblist.h" | 10 #include "gtkblist.h" |
11 #include "gtkplugin.h" | 11 #include "gtkplugin.h" |
12 #include "gtksound.h" | |
12 | 13 |
13 #define MAILCHK_PLUGIN_ID "gtk-mailchk" | 14 #define MAILCHK_PLUGIN_ID "gtk-mailchk" |
14 | 15 |
15 #define ANY_MAIL 0x01 | 16 #define ANY_MAIL 0x01 |
16 #define UNREAD_MAIL 0x02 | 17 #define UNREAD_MAIL 0x02 |
53 } | 54 } |
54 | 55 |
55 static gboolean check_timeout(gpointer data) | 56 static gboolean check_timeout(gpointer data) |
56 { | 57 { |
57 gint count = check_mail(); | 58 gint count = check_mail(); |
58 struct gaim_buddy_list *list = gaim_get_blist(); | 59 GaimBuddyList *list = gaim_get_blist(); |
59 | 60 |
60 if (count == -1) | 61 if (count == -1) |
61 return FALSE; | 62 return FALSE; |
62 | 63 |
63 if (!list || !GAIM_IS_GTK_BLIST(list) || !(GAIM_GTK_BLIST(list)->vbox)) | 64 if (!list || !GAIM_IS_GTK_BLIST(list) || !(GAIM_GTK_BLIST(list)->vbox)) |
87 return TRUE; | 88 return TRUE; |
88 } | 89 } |
89 | 90 |
90 static void signon_cb(GaimConnection *gc) | 91 static void signon_cb(GaimConnection *gc) |
91 { | 92 { |
92 struct gaim_buddy_list *list = gaim_get_blist(); | 93 GaimBuddyList *list = gaim_get_blist(); |
93 if (list && GAIM_IS_GTK_BLIST(list) && !timer) { | 94 if (list && GAIM_IS_GTK_BLIST(list) && !timer) { |
94 check_timeout(NULL); /* we want the box to be drawn immediately */ | 95 check_timeout(NULL); /* we want the box to be drawn immediately */ |
95 timer = g_timeout_add(2000, check_timeout, NULL); | 96 timer = g_timeout_add(2000, check_timeout, NULL); |
96 } | 97 } |
97 } | 98 } |
98 | 99 |
99 static void signoff_cb(GaimConnection *gc) | 100 static void signoff_cb(GaimConnection *gc) |
100 { | 101 { |
101 struct gaim_buddy_list *list = gaim_get_blist(); | 102 GaimBuddyList *list = gaim_get_blist(); |
102 if ((!list || !GAIM_IS_GTK_BLIST(list) || !GAIM_GTK_BLIST(list)->vbox) && timer) { | 103 if ((!list || !GAIM_IS_GTK_BLIST(list) || !GAIM_GTK_BLIST(list)->vbox) && timer) { |
103 g_source_remove(timer); | 104 g_source_remove(timer); |
104 timer = 0; | 105 timer = 0; |
105 } | 106 } |
106 } | 107 } |
110 */ | 111 */ |
111 | 112 |
112 static gboolean | 113 static gboolean |
113 plugin_load(GaimPlugin *plugin) | 114 plugin_load(GaimPlugin *plugin) |
114 { | 115 { |
115 struct gaim_buddy_list *list = gaim_get_blist(); | 116 GaimBuddyList *list = gaim_get_blist(); |
116 void *conn_handle = gaim_connections_get_handle(); | 117 void *conn_handle = gaim_connections_get_handle(); |
117 | 118 |
118 if (!check_timeout(NULL)) { | 119 if (!check_timeout(NULL)) { |
119 gaim_debug(GAIM_DEBUG_WARNING, "mailchk", "Could not read $MAIL or /var/spool/mail/$USER"); | 120 gaim_debug_warning("mailchk", "Could not read $MAIL or /var/spool/mail/$USER"); |
120 return FALSE; | 121 return FALSE; |
121 } | 122 } |
122 | 123 |
123 if (list && GAIM_IS_GTK_BLIST(list) && GAIM_GTK_BLIST(list)->vbox) | 124 if (list && GAIM_IS_GTK_BLIST(list) && GAIM_GTK_BLIST(list)->vbox) |
124 timer = g_timeout_add(2000, check_timeout, NULL); | 125 timer = g_timeout_add(2000, check_timeout, NULL); |
154 GAIM_PRIORITY_DEFAULT, | 155 GAIM_PRIORITY_DEFAULT, |
155 MAILCHK_PLUGIN_ID, | 156 MAILCHK_PLUGIN_ID, |
156 N_("Mail Checker"), | 157 N_("Mail Checker"), |
157 VERSION, | 158 VERSION, |
158 N_("Checks for new local mail."), | 159 N_("Checks for new local mail."), |
159 N_("Checks for new local mail."), | 160 N_("Adds a small box to the buddy list that" |
161 " shows if you have new mail."), | |
160 "Eric Warmenhoven <eric@warmenhoven.org>", | 162 "Eric Warmenhoven <eric@warmenhoven.org>", |
161 GAIM_WEBSITE, | 163 GAIM_WEBSITE, |
162 plugin_load, | 164 plugin_load, |
163 plugin_unload, | 165 plugin_unload, |
164 NULL, | 166 NULL, |