pidgin/plugins/relnot.c

Sun, 09 Jan 2022 12:11:21 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Sun, 09 Jan 2022 12:11:21 -0600
changeset 41240
943ba4838efc
parent 41216
5c4269ad7ee4
permissions
-rw-r--r--

Remove some deprecated accounts api

Testing Done:
Compiled and ran

Reviewed at https://reviews.imfreedom.org/r/1222/

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
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
22 #include <glib/gi18n-lib.h>
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23
39992
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
24 #include <libsoup/soup.h>
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25 #include <string.h>
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26
40360
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 40222
diff changeset
27 #include <purple.h>
41212
9f0f4c23132e Use accessor for SoupMessage->status_code
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 41078
diff changeset
28 #include "soupcompat.h"
40360
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 40222
diff changeset
29
40502
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 40496
diff changeset
30 #include <pidgin.h>
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31
39992
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
32 static SoupSession *session = NULL;
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
33
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
34 /* 1 day */
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
35 #define MIN_CHECK_INTERVAL 60 * 60 * 24
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37 static void
40991
d92defc9ba95 Move minidialog stuff from utils to its source file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40894
diff changeset
38 release_hide(G_GNUC_UNUSED PidginMiniDialog *mini_dialog,
d92defc9ba95 Move minidialog stuff from utils to its source file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40894
diff changeset
39 G_GNUC_UNUSED GtkButton *button,
d92defc9ba95 Move minidialog stuff from utils to its source file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40894
diff changeset
40 G_GNUC_UNUSED gpointer user_data)
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
41 {
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
42 /* 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
43 * 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
44 }
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
45
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
46 static void
40991
d92defc9ba95 Move minidialog stuff from utils to its source file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40894
diff changeset
47 release_show(G_GNUC_UNUSED PidginMiniDialog *mini_dialog,
d92defc9ba95 Move minidialog stuff from utils to its source file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40894
diff changeset
48 G_GNUC_UNUSED GtkButton *button,
d92defc9ba95 Move minidialog stuff from utils to its source file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40894
diff changeset
49 G_GNUC_UNUSED gpointer user_data)
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
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 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
52 }
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
39992
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
54 static void
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
55 version_fetch_cb(G_GNUC_UNUSED SoupSession *session, SoupMessage *msg,
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
56 gpointer user_data)
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
57 {
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
58 gchar *cur_ver;
33441
b69cd2bfe289 Migrate relnot plugin to new HTTP API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
59 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
60 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
61
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
62 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
63 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
64
41212
9f0f4c23132e Use accessor for SoupMessage->status_code
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 41078
diff changeset
65 if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(msg))) {
24247
9f640ea2ab9f Parse the HTTP status code in the release notification plugin and only display
Daniel Atallah <datallah@pidgin.im>
parents: 20288
diff changeset
66 return;
39992
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
67 }
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
68
39992
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
69 changelog = msg->response_body->data;
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
70
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
71 while(changelog[i] && changelog[i] != '\n') i++;
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
72
14281
bb395cb6e106 [gaim-migrate @ 16900]
Nathan Walp <nwalp@pidgin.im>
parents: 14253
diff changeset
73 /* 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
74 * looking for so sourceforge is probably having web server issues, and
bb395cb6e106 [gaim-migrate @ 16900]
Nathan Walp <nwalp@pidgin.im>
parents: 14253
diff changeset
75 * we should try again later */
bb395cb6e106 [gaim-migrate @ 16900]
Nathan Walp <nwalp@pidgin.im>
parents: 14253
diff changeset
76 if(i == 0)
bb395cb6e106 [gaim-migrate @ 16900]
Nathan Walp <nwalp@pidgin.im>
parents: 14253
diff changeset
77 return;
bb395cb6e106 [gaim-migrate @ 16900]
Nathan Walp <nwalp@pidgin.im>
parents: 14253
diff changeset
78
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
79 cur_ver = g_strndup(changelog, i);
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
80
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
81 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
82 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
83 PIDGIN_NAME, cur_ver);
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
84
40991
d92defc9ba95 Move minidialog stuff from utils to its source file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40894
diff changeset
85 release_dialog = pidgin_mini_dialog_new_with_buttons(
d92defc9ba95 Move minidialog stuff from utils to its source file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40894
diff changeset
86 _("New Version Available"), message->str, "dialog-information", NULL,
d92defc9ba95 Move minidialog stuff from utils to its source file
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40894
diff changeset
87 _("Later"), release_hide, _("Download Now"), release_show, NULL);
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
88
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
89 pidgin_blist_add_alert(release_dialog);
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
90
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
91 g_string_free(message, TRUE);
7599
37ee21202f1f [gaim-migrate @ 8220]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 7546
diff changeset
92 g_free(cur_ver);
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
93 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
94
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
95 static void
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
96 do_check(void)
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
97 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
98 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
99 if(!last_check || time(NULL) - last_check > MIN_CHECK_INTERVAL) {
39992
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
100 SoupMessage *msg;
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
101
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
102 purple_debug_info("relnot", "Checking for new version.");
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 24768
diff changeset
103
41216
5c4269ad7ee4 Replace the removed soup_form_request_new API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41212
diff changeset
104 msg = soup_message_new_from_encoded_form("GET", "https://pidgin.im/version.php",
5c4269ad7ee4 Replace the removed soup_form_request_new API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41212
diff changeset
105 soup_form_encode(
5c4269ad7ee4 Replace the removed soup_form_request_new API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41212
diff changeset
106 "version", purple_core_get_version(),
5c4269ad7ee4 Replace the removed soup_form_request_new API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41212
diff changeset
107 "build",
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
108 #ifdef _WIN32
41216
5c4269ad7ee4 Replace the removed soup_form_request_new API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41212
diff changeset
109 "purple-win32",
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
110 #else
41216
5c4269ad7ee4 Replace the removed soup_form_request_new API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41212
diff changeset
111 "purple",
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
112 #endif
41216
5c4269ad7ee4 Replace the removed soup_form_request_new API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41212
diff changeset
113 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
114
39992
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
115 soup_session_queue_message(session, msg, version_fetch_cb, 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
116
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
117 purple_prefs_set_int("/plugins/gtk/relnot/last_check", time(NULL));
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
118 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
119 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
120
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
121 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
122 signed_on_cb(PurpleConnection *gc, void *data) {
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
123 do_check();
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
124 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
125
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
126 /**************************************************************************
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
127 * Plugin stuff
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
128 **************************************************************************/
40894
80d9d7a73a60 Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
129 static GPluginPluginInfo *
80d9d7a73a60 Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
130 relnot_query(GError **error)
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
131 {
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
132 const gchar * const authors[] = {
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
133 "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
134 NULL
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
135 };
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
136
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
137 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
138 "id", "gtk-relnot",
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
139 "name", N_("Release Notification"),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
140 "version", DISPLAY_VERSION,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
141 "category", N_("Notification"),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
142 "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
143 "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
144 "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
145 "authors", authors,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
146 "website", PURPLE_WEBSITE,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
147 "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
148 NULL
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
149 );
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
150 }
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
151
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
152 static gboolean
40894
80d9d7a73a60 Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
153 relnot_load(GPluginPlugin *plugin, GError **error)
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
154 {
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
155 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
156 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
157
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
158 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
159 plugin, PURPLE_CALLBACK(signed_on_cb), NULL);
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
160
39992
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
161 session = soup_session_new();
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
162
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
163 /* 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
164 if(purple_connections_get_all())
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
165 do_check();
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
166
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
167 return TRUE;
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
168 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
169
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
170 static gboolean
41078
84e48180ef67 Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents: 40991
diff changeset
171 relnot_unload(GPluginPlugin *plugin, gboolean shutdown, GError **error)
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
172 {
39992
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
173 soup_session_abort(session);
bffad41e933f Convert Pidgin plugins to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39498
diff changeset
174 g_clear_object(&session);
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
175 return TRUE;
7543
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
176 }
03c003c76c98 [gaim-migrate @ 8157]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
177
40894
80d9d7a73a60 Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
178 GPLUGIN_NATIVE_PLUGIN_DECLARE(relnot)

mercurial