libpurple/plugins/notify_example.c

Mon, 16 Sep 2013 15:58:29 +0530

author
Ankit Vani <a@nevitus.org>
date
Mon, 16 Sep 2013 15:58:29 +0530
branch
soc.2013.gobjectification.plugins
changeset 36742
5d43951cabc0
parent 36741
c96edeed7ea7
child 36782
64936dae41a3
permissions
-rw-r--r--

More refactoring

19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
1 /*
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
2 * Notify API Example Plugin
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
3 *
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
4 * Copyright (C) 2007, John Bailey <rekkanoryo@cpw.pidgin.im>
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
5 *
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
8 * published by the Free Software Foundation; either version 2 of the
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
9 * License, or (at your option) any later version.
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
10 *
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful, but
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
14 * General Public License for more details.
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
15 *
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
19 * 02111-1301, USA.
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
20 *
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
21 */
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
22
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
24 # include <config.h>
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
25 #endif
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
26
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
27 #include <glib.h>
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
28
20084
7b3c24de3714 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@pidgin.im>
parents: 20011
diff changeset
29 /* This will prevent compiler errors in some instances and is better explained in the
7b3c24de3714 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@pidgin.im>
parents: 20011
diff changeset
30 * how-to documents on the wiki */
7b3c24de3714 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@pidgin.im>
parents: 20011
diff changeset
31 #ifndef G_GNUC_NULL_TERMINATED
7b3c24de3714 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@pidgin.im>
parents: 20011
diff changeset
32 # if __GNUC__ >= 4
7b3c24de3714 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@pidgin.im>
parents: 20011
diff changeset
33 # define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
7b3c24de3714 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@pidgin.im>
parents: 20011
diff changeset
34 # else
7b3c24de3714 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@pidgin.im>
parents: 20011
diff changeset
35 # define G_GNUC_NULL_TERMINATED
7b3c24de3714 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@pidgin.im>
parents: 20011
diff changeset
36 # endif
7b3c24de3714 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@pidgin.im>
parents: 20011
diff changeset
37 #endif
7b3c24de3714 applied changes from f4700a52b60d8473e9671ceabfec7772211fe424
Richard Laager <rlaager@pidgin.im>
parents: 20011
diff changeset
38
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
39 /* This is the required definition of PURPLE_PLUGINS as required for a plugin,
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
40 * but we protect it with an #ifndef because config.h may define it for us
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
41 * already and this would cause an unneeded compiler warning. */
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
42 #ifndef PURPLE_PLUGINS
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
43 # define PURPLE_PLUGINS
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
44 #endif
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
45
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
46 #define PLUGIN_ID "core-notifyexample"
36741
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
47 #define PLUGIN_AUTHORS { "John Bailey <rekkanoryo@cpw.pidgin.im>", NULL }
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
48
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
49 #include <notify.h>
36367
891eea799578 Renamed plugin.[ch] to plugins.[ch], since we (will) no longer have a PurplePlugin structure.
Ankit Vani <a@nevitus.org>
parents: 33955
diff changeset
50 #include <plugins.h>
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
51 #include <version.h>
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
52
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
53 static PurplePlugin *notify_example = NULL;
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
54
20011
4a21c1668afb Comment tweaks to be closer to the version handed out via the wiki as well as
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19880
diff changeset
55 /* The next four functions and the calls within them should cause dialog boxes to appear
4a21c1668afb Comment tweaks to be closer to the version handed out via the wiki as well as
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19880
diff changeset
56 * when you select the plugin action from the Tools->Notify Example menu */
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
57 static void
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
58 notify_error_cb(PurplePluginAction *action)
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
59 {
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
60 purple_notify_error(notify_example, "Test Notification", "Test Notification",
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
61 "This is a test error notification");
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
62 }
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
63
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
64 static void
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
65 notify_info_cb(PurplePluginAction *action)
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
66 {
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
67 purple_notify_info(notify_example, "Test Notification", "Test Notification",
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
68 "This is a test informative notification");
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
69 }
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
70
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
71 static void
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
72 notify_warn_cb(PurplePluginAction *action)
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
73 {
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
74 purple_notify_warning(notify_example, "Test Notification", "Test Notification",
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
75 "This is a test warning notification");
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
76 }
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
77
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
78 static void
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
79 notify_format_cb(PurplePluginAction *action)
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
80 {
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
81 purple_notify_formatted(notify_example, "Test Notification", "Test Notification",
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
82 "Test Notification",
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
83 "<I>This is a test notification with formatted text.</I>", NULL, NULL);
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
84 }
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
85
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
86 static void
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
87 notify_uri_cb(PurplePluginAction *action)
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
88 {
20011
4a21c1668afb Comment tweaks to be closer to the version handed out via the wiki as well as
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19880
diff changeset
89 /* This one should open your web browser of choice. */
33955
55aa58076485 Use https URLs for pidgin.im and developer.pidgin.im.
Mark Doliner <mark@kingant.net>
parents: 20288
diff changeset
90 purple_notify_uri(notify_example, "https://www.pidgin.im/");
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
91 }
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
92
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
93 static GList *
36742
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36741
diff changeset
94 plugin_actions(PurplePlugin *plugin)
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
95 {
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
96 GList *actions = NULL;
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
97
20011
4a21c1668afb Comment tweaks to be closer to the version handed out via the wiki as well as
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19880
diff changeset
98 /* Here we take advantage of return values to avoid the need for a temp variable */
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
99 actions = g_list_prepend(actions,
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
100 purple_plugin_action_new("Show Error Notification", notify_error_cb));
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
101
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
102 actions = g_list_prepend(actions,
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
103 purple_plugin_action_new("Show Info Notification", notify_info_cb));
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
104
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
105 actions = g_list_prepend(actions,
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
106 purple_plugin_action_new("Show Warning Notification", notify_warn_cb));
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
107
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
108 actions = g_list_prepend(actions,
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
109 purple_plugin_action_new("Show Formatted Notification", notify_format_cb));
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
110
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
111 actions = g_list_prepend(actions,
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
112 purple_plugin_action_new("Show URI Notification", notify_uri_cb));
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
113
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
114 return g_list_reverse(actions);
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
115 }
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
116
36741
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
117 static PurplePluginInfo *
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
118 plugin_query(GError **error)
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
119 {
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
120 const gchar * const authors[] = PLUGIN_AUTHORS;
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
121
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
122 return purple_plugin_info_new(
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
123 "id", PLUGIN_ID,
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
124 "name", "Notify API Example",
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
125 "version", DISPLAY_VERSION,
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
126 "category", "Example",
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
127 "summary", "Notify API Example",
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
128 "description", "Notify API Example",
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
129 "authors", authors,
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
130 "website", "https://pidgin.im",
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
131 "abi-version", PURPLE_ABI_VERSION,
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
132 "get-actions", plugin_actions,
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
133 NULL
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
134 );
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
135 }
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
136
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
137 static gboolean
36741
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
138 plugin_load(PurplePlugin *plugin, GError **error)
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
139 {
20011
4a21c1668afb Comment tweaks to be closer to the version handed out via the wiki as well as
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19880
diff changeset
140 /* we need a handle for all the notify calls */
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
141 notify_example = plugin;
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
142
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
143 return TRUE;
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
144 }
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
145
36741
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
146 static gboolean
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
147 plugin_unload(PurplePlugin *plugin, GError **error)
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
148 {
36741
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
149 return TRUE;
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
150 }
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
151
36741
c96edeed7ea7 Refactored notify_example, one_time_password, pluginpref_example plugins to use the new API
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
152 PURPLE_PLUGIN_INIT(notifyexample, plugin_query, plugin_load, plugin_unload);
19880
7008830b4cc4 Adding a notify API example plugin.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
153

mercurial