Mercurial > pidgin.yaz
annotate pidgin/plugins/relnot.c @ 26603:6b0c6a370cda
Call purple_log_uninit() in purple_core_uninit().
Thanks to Nick Hebner.
References #8683
committer: Ethan Blanton <elb@pidgin.im>
author | Nick Hebner <hebnern@gmail.com> |
---|---|
date | Thu, 09 Apr 2009 17:36:34 +0000 |
parents | 6ae245788b85 |
children | a8cc50c2279f |
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" |
24452
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
37 #include "gtkblist.h" |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
38 #include "gtkutils.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "notify.h" |
24452
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
40 #include "pidginstock.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 #include "version.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 |
15514 | 45 #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
|
46 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 /* 1 day */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 #define MIN_CHECK_INTERVAL 60 * 60 * 24 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 static void |
24452
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
51 release_hide() |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
52 { |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
53 /* No-op. We may use this method in the future to avoid showing |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
54 * the popup twice */ |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
55 } |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
56 |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
57 static void |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
58 release_show() |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
59 { |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
60 purple_notify_uri(NULL, PURPLE_WEBSITE); |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
61 } |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
62 |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
63 static void |
15823 | 64 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
|
65 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
|
66 { |
24452
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
67 gchar *cur_ver; |
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
|
68 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
|
69 char response_code[4]; |
24452
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
70 GtkWidget *release_dialog; |
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
|
71 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 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
|
73 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
|
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 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
|
76 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 |
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
|
78 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
|
79 /* 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
|
80 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
|
81 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
|
82 /* 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
|
83 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
|
84 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
|
85 } |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
86 } |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
87 |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
88 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
|
89 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
|
90 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
|
91 } |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
92 |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
93 /* 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
|
94 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
|
95 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
|
96 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
|
97 } |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
98 changelog += 4; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 while(changelog[i] && changelog[i] != '\n') i++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 /* 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
|
103 * 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
|
104 * we should try again later */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 if(i == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 cur_ver = g_strndup(changelog, i); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 message = g_string_new(""); |
24452
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
111 g_string_append_printf(message, _("You can upgrade to %s %s today."), |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
112 PIDGIN_NAME, cur_ver); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 |
24452
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
114 release_dialog = pidgin_make_mini_dialog( |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
115 NULL, PIDGIN_STOCK_DIALOG_INFO, |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
116 _("New Version Available"), |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
117 message->str, |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
118 NULL, |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
119 _("Later"), PURPLE_CALLBACK(release_hide), |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
120 _("Download Now"), PURPLE_CALLBACK(release_show), |
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
121 NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 |
24452
6ae245788b85
A patch from Casey Ho to move the release notification to a mini-dialog in the buddy list. The change log is no longer displayed, but will open a webbrowser to show it.
Casey Ho <me@caseyho.com>
parents:
23980
diff
changeset
|
123 pidgin_blist_add_alert(release_dialog); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 g_string_free(message, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 g_free(cur_ver); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 do_check(void) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 { |
15823 | 132 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
|
133 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
|
134 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
|
135 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
|
136 |
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 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
|
138 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
|
139 purple_core_get_version(), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 #ifdef _WIN32 |
15823 | 141 "purple-win32" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 #else |
15823 | 143 "purple" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 ); |
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
|
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 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
|
148 "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
|
149 "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
|
150 "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
|
151 "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
|
152 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
|
153 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
|
154 |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
155 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
|
156 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
|
157 |
13e520aeb956
Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21030
diff
changeset
|
158 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
|
159 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
|
160 |
15823 | 161 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
|
162 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 static void |
15823 | 167 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
|
168 do_check(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 * Plugin stuff |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 static gboolean |
15823 | 175 plugin_load(PurplePlugin *plugin) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 { |
15823 | 177 purple_signal_connect(purple_connections_get_handle(), "signed-on", |
178 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
|
179 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 /* we don't check if we're offline */ |
15823 | 181 if(purple_connections_get_all()) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 do_check(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 |
15823 | 187 static PurplePluginInfo info = |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 { |
15823 | 189 PURPLE_PLUGIN_MAGIC, |
190 PURPLE_MAJOR_VERSION, | |
191 PURPLE_MINOR_VERSION, | |
192 PURPLE_PLUGIN_STANDARD, /**< type */ | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 NULL, /**< ui_requirement */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 0, /**< flags */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 NULL, /**< dependencies */ |
15823 | 196 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
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 "gtk-relnot", /**< id */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 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
|
200 DISPLAY_VERSION, /**< version */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 /** summary */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 N_("Checks periodically for new releases."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 /** description */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 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
|
205 "with the ChangeLog."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 "Nathan Walp <faceprint@faceprint.com>", /**< author */ |
15823 | 207 PURPLE_WEBSITE, /**< homepage */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 plugin_load, /**< load */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 NULL, /**< unload */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 NULL, /**< destroy */ |
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 NULL, /**< ui_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 NULL, /**< extra_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 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
|
216 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
|
217 |
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
|
218 /* 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
|
219 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
|
220 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
|
221 NULL, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 NULL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 static void |
15823 | 226 init_plugin(PurplePlugin *plugin) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 { |
15823 | 228 purple_prefs_add_none("/plugins/gtk/relnot"); |
229 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
|
230 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 |
15823 | 232 PURPLE_INIT_PLUGIN(relnot, init_plugin, info) |