pidgin/plugins/relnot.c

Sat, 08 Dec 2018 21:35:39 -0600

author
Mike Ruprecht <cmaiku@gmail.com>
date
Sat, 08 Dec 2018 21:35:39 -0600
changeset 39412
d3c91a4e6f56
parent 39145
e12cc371a615
child 39498
51e0448a7ae8
permissions
-rw-r--r--

plugins/relnot: Remove PURPLE_PLUGINS definition

Now that GPlugin and libpurple plugin support are both required,
this patch removes the PURPLE_PLUGINS guarded definition from
libpurple's release notification plugin.

7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /*
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * Release Notification Plugin
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 *
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com>
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 *
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
8 * published by the Free Software Foundation; either version 2 of the
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 * License, or (at your option) any later version.
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 *
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful, but
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * General Public License for more details.
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 *
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 18169
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 18169
diff changeset
19 * 02111-1301, USA.
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20 */
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22 #ifdef HAVE_CONFIG_H
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23 #include <config.h>
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
24 #endif
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 #include "internal.h"
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28 #include <string.h>
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
30 #include "connection.h"
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31 #include "core.h"
24247
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
32 #include "debug.h"
24768
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
33 #include "gtkblist.h"
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
34 #include "gtkplugin.h"
24768
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
35 #include "gtkutils.h"
33441
b69cd2bfe289 Migrate relnot plugin to new HTTP API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
36 #include "http.h"
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37 #include "notify.h"
24768
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
38 #include "pidginstock.h"
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39 #include "prefs.h"
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40 #include "util.h"
9943
b54a762f60fa [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 8993
diff changeset
41 #include "version.h"
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
43 #include "pidgin.h"
15442
2ff7f5308727 I think this is all the instances of 'Gaim' within pidgin/
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
44
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45 /* 1 day */
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46 #define MIN_CHECK_INTERVAL 60 * 60 * 24
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48 static void
24768
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
49 release_hide()
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
50 {
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
51 /* No-op. We may use this method in the future to avoid showing
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
52 * the popup twice */
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
53 }
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
54
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
55 static void
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
56 release_show()
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
57 {
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
58 purple_notify_uri(NULL, PURPLE_WEBSITE);
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
59 }
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
60
33441
b69cd2bfe289 Migrate relnot plugin to new HTTP API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
61 static void version_fetch_cb(PurpleHttpConnection *hc,
b69cd2bfe289 Migrate relnot plugin to new HTTP API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
62 PurpleHttpResponse *response, gpointer user_data)
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
63 {
24768
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
64 gchar *cur_ver;
33441
b69cd2bfe289 Migrate relnot plugin to new HTTP API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
65 const char *changelog;
24768
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
66 GtkWidget *release_dialog;
24247
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
67
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
68 GString *message;
24247
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
69 int i = 0;
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
70
34287
6cd0c77b1f6a HTTP: successful is spelled with one l
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34233
diff changeset
71 if(!purple_http_response_is_successful(response))
24247
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
72 return;
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
73
33626
2522d124d883 update purple_http_response_get_data to take a second parameter that is a return address for the size of the data
Gary Kramlich <grim@reaperworld.com>
parents: 33598
diff changeset
74 changelog = purple_http_response_get_data(response, NULL);
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
75
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
76 while(changelog[i] && changelog[i] != '\n') i++;
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
77
14281
bb395cb6e106 [gaim-migrate @ 16900]
Nathan Walp <nwalp@pidgin.im>
parents: 14253
diff changeset
78 /* this basically means the version thing wasn't in the format we were
bb395cb6e106 [gaim-migrate @ 16900]
Nathan Walp <nwalp@pidgin.im>
parents: 14253
diff changeset
79 * looking for so sourceforge is probably having web server issues, and
bb395cb6e106 [gaim-migrate @ 16900]
Nathan Walp <nwalp@pidgin.im>
parents: 14253
diff changeset
80 * we should try again later */
bb395cb6e106 [gaim-migrate @ 16900]
Nathan Walp <nwalp@pidgin.im>
parents: 14253
diff changeset
81 if(i == 0)
bb395cb6e106 [gaim-migrate @ 16900]
Nathan Walp <nwalp@pidgin.im>
parents: 14253
diff changeset
82 return;
bb395cb6e106 [gaim-migrate @ 16900]
Nathan Walp <nwalp@pidgin.im>
parents: 14253
diff changeset
83
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
84 cur_ver = g_strndup(changelog, i);
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
85
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
86 message = g_string_new("");
24768
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
87 g_string_append_printf(message, _("You can upgrade to %s %s today."),
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
88 PIDGIN_NAME, cur_ver);
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
89
24768
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
90 release_dialog = pidgin_make_mini_dialog(
39145
e12cc371a615 Port PidginMiniDialog from deprecated GtkStock name to GtkIconTheme name
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
91 NULL, "dialog-information",
24768
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
92 _("New Version Available"),
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
93 message->str,
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
94 NULL,
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
95 _("Later"), PURPLE_CALLBACK(release_hide),
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
96 _("Download Now"), PURPLE_CALLBACK(release_show),
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
97 NULL);
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
98
24768
c9d1cfe1d89c 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 <caseyho@pidgin.im>
parents: 24247
diff changeset
99 pidgin_blist_add_alert(release_dialog);
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
100
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
101 g_string_free(message, TRUE);
7599
37ee21202f1f [gaim-migrate @ 8220]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 7546
diff changeset
102 g_free(cur_ver);
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
103 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
104
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
105 static void
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
106 do_check(void)
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
107 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
108 int last_check = purple_prefs_get_int("/plugins/gtk/relnot/last_check");
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
109 if(!last_check || time(NULL) - last_check > MIN_CHECK_INTERVAL) {
33441
b69cd2bfe289 Migrate relnot plugin to new HTTP API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
110 gchar *url;
24247
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
111 const char *host = "pidgin.im";
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 24768
diff changeset
112
33397
15591913dd85 Use https to check for updates in the Release Notification plugin. Refs #15276
Daniel Atallah <datallah@pidgin.im>
parents: 31294
diff changeset
113 url = g_strdup_printf("https://%s/version.php?version=%s&build=%s",
24247
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
114 host,
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
115 purple_core_get_version(),
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
116 #ifdef _WIN32
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
117 "purple-win32"
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
118 #else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
119 "purple"
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
120 #endif
7546
b8f94451a5b0 [gaim-migrate @ 8160]
Nathan Walp <nwalp@pidgin.im>
parents: 7545
diff changeset
121 );
24247
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
122
34233
8bdcc4f84a5e HTTP: introduce purple_http_get_printf, make purple_http_get consistent with it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33626
diff changeset
123 purple_http_get(NULL, version_fetch_cb, NULL, url);
24247
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
124
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
125 g_free(url);
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
126
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
127 purple_prefs_set_int("/plugins/gtk/relnot/last_check", time(NULL));
24247
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
128
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
129 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
130 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
131
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
132 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
133 signed_on_cb(PurpleConnection *gc, void *data) {
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
134 do_check();
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
135 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
136
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
137 /**************************************************************************
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
138 * Plugin stuff
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
139 **************************************************************************/
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
140 static PidginPluginInfo *
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
141 plugin_query(GError **error)
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
142 {
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
143 const gchar * const authors[] = {
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
144 "Nathan Walp <faceprint@faceprint.com>",
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
145 NULL
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
146 };
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
147
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
148 return pidgin_plugin_info_new(
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
149 "id", "gtk-relnot",
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
150 "name", N_("Release Notification"),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
151 "version", DISPLAY_VERSION,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
152 "category", N_("Notification"),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
153 "summary", N_("Checks periodically for new releases."),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
154 "description", N_("Checks periodically for new releases and notifies "
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
155 "the user with the ChangeLog."),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
156 "authors", authors,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
157 "website", PURPLE_WEBSITE,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
158 "abi-version", PURPLE_ABI_VERSION,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
159 NULL
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
160 );
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
161 }
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
162
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
163 static gboolean
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
164 plugin_load(PurplePlugin *plugin, GError **error)
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
165 {
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
166 purple_prefs_add_none("/plugins/gtk/relnot");
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
167 purple_prefs_add_int("/plugins/gtk/relnot/last_check", 0);
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
168
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
169 purple_signal_connect(purple_connections_get_handle(), "signed-on",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
170 plugin, PURPLE_CALLBACK(signed_on_cb), NULL);
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
171
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
172 /* we don't check if we're offline */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
173 if(purple_connections_get_all())
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
174 do_check();
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
175
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
176 return TRUE;
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
177 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
178
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
179 static gboolean
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
180 plugin_unload(PurplePlugin *plugin, GError **error)
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
181 {
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
182 return TRUE;
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
183 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
184
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
185 PURPLE_PLUGIN_INIT(relnot, plugin_query, plugin_load, plugin_unload);

mercurial