Mercurial > pidgin.yaz
annotate pidgin/plugins/relnot.c @ 24410:9eafd4a52906
merge of '59b09f0d1f3f4226f7edfd8351478498fbd6b8d3'
and 'ca4b6e987b967927b0f8bd001bc33440a6885000'
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 17 Nov 2008 07:44:40 +0000 |
parents | 13e520aeb956 |
children | 6ae245788b85 |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * Release Notification Plugin |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * This program is free software; you can redistribute it and/or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * modify it under the terms of the GNU General Public License as |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * published by the Free Software Foundation; either version 2 of the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * License, or (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, but |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18096
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18096
diff
changeset
|
19 * 02111-1301, USA. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include <config.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 |
15823 | 26 #ifndef PURPLE_PLUGINS |
27 #define PURPLE_PLUGINS | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include <string.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "connection.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "core.h" |
23980
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
36 #include "debug.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "version.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 |
15514 | 42 #include "pidgin.h" |
15381
d54794a47c56
I think this is all the instances of 'Gaim' within pidgin/
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
43 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 /* 1 day */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #define MIN_CHECK_INTERVAL 60 * 60 * 24 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 static void |
15823 | 48 version_fetch_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
23980
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
49 const gchar *response, size_t len, const gchar *error_message) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 { |
23980
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
51 gchar *cur_ver, *formatted; |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
52 const char *tmp, *changelog; |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
53 char response_code[4]; |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
54 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 GString *message; |
23980
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
56 int i = 0; |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
57 |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
58 if(error_message || !response || !len) |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
59 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 |
23980
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
61 memset(response_code, '\0', sizeof(response_code)); |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
62 /* Parse the status code - the response should be in the form of "HTTP/?.? 200 ..." */ |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
63 if ((tmp = strstr(response, " ")) != NULL) { |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
64 tmp++; |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
65 /* Read the 3 digit status code */ |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
66 if (len - (tmp - response) > 3) { |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
67 memcpy(response_code, tmp, 3); |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
68 } |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
69 } |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
70 |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
71 if (strcmp(response_code, "200") != 0) { |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
72 purple_debug_error("relnot", "Didn't recieve a HTTP status code of 200.\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 return; |
23980
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
74 } |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
75 |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
76 /* Go to the start of the data */ |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
77 if((changelog = strstr(response, "\r\n\r\n")) == NULL) { |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
78 purple_debug_error("relnot", "Unable to find start of HTTP response data.\n"); |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
79 return; |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
80 } |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
81 changelog += 4; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 while(changelog[i] && changelog[i] != '\n') i++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 /* this basically means the version thing wasn't in the format we were |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 * looking for so sourceforge is probably having web server issues, and |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 * we should try again later */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 if(i == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 cur_ver = g_strndup(changelog, i); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 changelog += i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 while(*changelog == '\n') changelog++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 message = g_string_new(""); |
16012
765cfc73182f
more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents:
15868
diff
changeset
|
97 g_string_append_printf(message, _("You are using %s version %s. The " |
17670
3522a4cda52f
Two small changes to the release notification plugin:
Mark Doliner <mark@kingant.net>
parents:
16678
diff
changeset
|
98 "current version is %s. You can get it from " |
18096
55ff2a39244e
Remove the use of compiler string concatenation in a translatable string to
Richard Laager <rlaager@wiktel.com>
parents:
17670
diff
changeset
|
99 "<a href=\"%s\">%s</a><hr>"), |
55ff2a39244e
Remove the use of compiler string concatenation in a translatable string to
Richard Laager <rlaager@wiktel.com>
parents:
17670
diff
changeset
|
100 PIDGIN_NAME, purple_core_get_version(), cur_ver, |
55ff2a39244e
Remove the use of compiler string concatenation in a translatable string to
Richard Laager <rlaager@wiktel.com>
parents:
17670
diff
changeset
|
101 PURPLE_WEBSITE, PURPLE_WEBSITE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 if(*changelog) { |
15823 | 104 formatted = purple_strdup_withhtml(changelog); |
17670
3522a4cda52f
Two small changes to the release notification plugin:
Mark Doliner <mark@kingant.net>
parents:
16678
diff
changeset
|
105 g_string_append_printf(message, _("<b>ChangeLog:</b><br>%s"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 formatted); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 g_free(formatted); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 |
15823 | 110 purple_notify_formatted(NULL, _("New Version Available"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 _("New Version Available"), NULL, message->str, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 g_string_free(message, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 g_free(cur_ver); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 do_check(void) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 { |
15823 | 121 int last_check = purple_prefs_get_int("/plugins/gtk/relnot/last_check"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 if(!last_check || time(NULL) - last_check > MIN_CHECK_INTERVAL) { |
23980
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
123 gchar *url, *request; |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
124 const char *host = "pidgin.im"; |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
125 |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
126 url = g_strdup_printf("http://%s/version.php?version=%s&build=%s", |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
127 host, |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
128 purple_core_get_version(), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 #ifdef _WIN32 |
15823 | 130 "purple-win32" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 #else |
15823 | 132 "purple" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 ); |
23980
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
135 |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
136 request = g_strdup_printf( |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
137 "GET %s HTTP/1.0\r\n" |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
138 "Connection: close\r\n" |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
139 "Accept: */*\r\n" |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
140 "Host: %s\r\n\r\n", |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
141 url, |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
142 host); |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
143 |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
144 purple_util_fetch_url_request_len(url, TRUE, NULL, FALSE, |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
145 request, TRUE, -1, version_fetch_cb, NULL); |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
146 |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
147 g_free(request); |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
148 g_free(url); |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
149 |
15823 | 150 purple_prefs_set_int("/plugins/gtk/relnot/last_check", time(NULL)); |
23980
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
151 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 static void |
15823 | 156 signed_on_cb(PurpleConnection *gc, void *data) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 do_check(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 * Plugin stuff |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 static gboolean |
15823 | 164 plugin_load(PurplePlugin *plugin) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 { |
15823 | 166 purple_signal_connect(purple_connections_get_handle(), "signed-on", |
167 plugin, PURPLE_CALLBACK(signed_on_cb), NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 /* we don't check if we're offline */ |
15823 | 170 if(purple_connections_get_all()) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 do_check(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 |
15823 | 176 static PurplePluginInfo info = |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 { |
15823 | 178 PURPLE_PLUGIN_MAGIC, |
179 PURPLE_MAJOR_VERSION, | |
180 PURPLE_MINOR_VERSION, | |
181 PURPLE_PLUGIN_STANDARD, /**< type */ | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 NULL, /**< ui_requirement */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 0, /**< flags */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 NULL, /**< dependencies */ |
15823 | 185 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 "gtk-relnot", /**< id */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 N_("Release Notification"), /**< name */ |
21030
3cc856ca2338
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents:
19680
diff
changeset
|
189 DISPLAY_VERSION, /**< version */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 /** summary */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 N_("Checks periodically for new releases."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 /** description */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 N_("Checks periodically for new releases and notifies the user " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 "with the ChangeLog."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 "Nathan Walp <faceprint@faceprint.com>", /**< author */ |
15823 | 196 PURPLE_WEBSITE, /**< homepage */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 plugin_load, /**< load */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 NULL, /**< unload */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 NULL, /**< destroy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 NULL, /**< ui_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 NULL, /**< extra_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 NULL, |
16678
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16012
diff
changeset
|
205 NULL, |
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16012
diff
changeset
|
206 |
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16012
diff
changeset
|
207 /* padding */ |
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16012
diff
changeset
|
208 NULL, |
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16012
diff
changeset
|
209 NULL, |
3d41d0d7fb9b
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16012
diff
changeset
|
210 NULL, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 NULL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 static void |
15823 | 215 init_plugin(PurplePlugin *plugin) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 { |
15823 | 217 purple_prefs_add_none("/plugins/gtk/relnot"); |
218 purple_prefs_add_int("/plugins/gtk/relnot/last_check", 0); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 |
15823 | 221 PURPLE_INIT_PLUGIN(relnot, init_plugin, info) |