Sun, 20 Oct 2013 16:40:03 +0530
Included internal.h in notify_example
|
19875
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1 | /* |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2 | * Debug Example Plugin |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3 | * |
|
19878
aa9d2cfa70bf
Fix my e-mail address to match my MTN key since it now is a real e-mail address.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19875
diff
changeset
|
4 | * Copyright (C) 2007, John Bailey <rekkanoryo@cpw.pidgin.im> |
|
19875
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5 | * |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
6 | * This program is free software; you can redistribute it and/or |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
7 | * modify it under the terms of the GNU General Public License as |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
8 | * published by the Free Software Foundation; either version 2 of the |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
9 | * License, or (at your option) any later version. |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
10 | * |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
11 | * This program is distributed in the hope that it will be useful, but |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
14 | * General Public License for more details. |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
15 | * |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
16 | * You should have received a copy of the GNU General Public License |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
17 | * along with this program; if not, write to the Free Software |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
19 | * 02111-1301, USA. |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
20 | * |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
21 | */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
22 | |
|
35027
bf4e1f00ec72
Included internal.h in notify_example
Ankit Vani <a@nevitus.org>
parents:
35026
diff
changeset
|
23 | #include <internal.h> |
|
35026
fde23518e1e5
Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents:
34964
diff
changeset
|
24 | |
|
34964
54ebd3dcae16
Simplified example plugins by including purple.h
Ankit Vani <a@nevitus.org>
parents:
33955
diff
changeset
|
25 | /* This file defines PURPLE_PLUGINS and includes all the libpurple headers */ |
|
54ebd3dcae16
Simplified example plugins by including purple.h
Ankit Vani <a@nevitus.org>
parents:
33955
diff
changeset
|
26 | #include <purple.h> |
|
19875
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
27 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
28 | /* It's more convenient to type PLUGIN_ID all the time than it is to type |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
29 | * "core-debugexample", so define this convenience macro. */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
30 | #define PLUGIN_ID "core-debugexample" |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
31 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
32 | /* Common practice in third-party plugins is to define convenience macros for |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
33 | * many of the fields of the plugin info struct, so we'll do that for the |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
34 | * purposes of demonstration. */ |
|
19878
aa9d2cfa70bf
Fix my e-mail address to match my MTN key since it now is a real e-mail address.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19875
diff
changeset
|
35 | #define PLUGIN_AUTHOR "John Bailey <rekkanoryo@cpw.pidgin.im>" |
|
19875
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
36 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
37 | /* As we've covered before, libpurple calls this function, if present, when it |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
38 | * loads the plugin. Here we're using it to show off the capabilities of the |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
39 | * debug API and just blindly returning TRUE to tell libpurple it's safe to |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
40 | * continue loading. */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
41 | static gboolean |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
42 | plugin_load(PurplePlugin *plugin) |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
43 | { |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
44 | /* Define these for convenience--we're just using them to show the |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
45 | * similarities of the debug functions to the standard printf(). */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
46 | gint i = 256; |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
47 | gfloat f = 512.1024; |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
48 | const gchar *s = "example string"; |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
49 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
50 | /* Introductory message */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
51 | purple_debug_info(PLUGIN_ID, |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
52 | "Called plugin_load. Beginning debug demonstration\n"); |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
53 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
54 | /* Show off the debug API a bit */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
55 | purple_debug_misc(PLUGIN_ID, |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
56 | "MISC level debug message. i = %d, f = %f, s = %s\n", i, f, s); |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
57 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
58 | purple_debug_info(PLUGIN_ID, |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
59 | "INFO level debug message. i = %d, f = %f, s = %s\n", i, f, s); |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
60 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
61 | purple_debug_warning(PLUGIN_ID, |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
62 | "WARNING level debug message. i = %d, f = %f, s = %s\n", i, f, s); |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
63 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
64 | purple_debug_error(PLUGIN_ID, |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
65 | "ERROR level debug message. i = %d, f = %f, s = %s\n", i, f, s); |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
66 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
67 | purple_debug_fatal(PLUGIN_ID, |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
68 | "FATAL level debug message. i = %d, f = %f, s = %s\n", i, f, s); |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
69 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
70 | /* Now just return TRUE to tell libpurple to finish loading. */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
71 | return TRUE; |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
72 | } |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
73 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
74 | static PurplePluginInfo info = { |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
75 | PURPLE_PLUGIN_MAGIC, /* magic number */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
76 | PURPLE_MAJOR_VERSION, /* purple major */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
77 | PURPLE_MINOR_VERSION, /* purple minor */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
78 | PURPLE_PLUGIN_STANDARD, /* plugin type */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
79 | NULL, /* UI requirement */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
80 | 0, /* flags */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
81 | NULL, /* dependencies */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
82 | PURPLE_PRIORITY_DEFAULT, /* priority */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
83 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
84 | PLUGIN_ID, /* id */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
85 | "Debug API Example", /* name */ |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20084
diff
changeset
|
86 | DISPLAY_VERSION, /* version */ |
|
19875
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
87 | "Debug API Example", /* summary */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
88 | "Debug API Example", /* description */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
89 | PLUGIN_AUTHOR, /* author */ |
|
33955
55aa58076485
Use https URLs for pidgin.im and developer.pidgin.im.
Mark Doliner <mark@kingant.net>
parents:
20288
diff
changeset
|
90 | "https://pidgin.im", /* homepage */ |
|
19875
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
91 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
92 | plugin_load, /* load */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
93 | NULL, /* unload */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
94 | NULL, /* destroy */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
95 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
96 | NULL, /* ui info */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
97 | NULL, /* extra info */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
98 | NULL, /* prefs info */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
99 | NULL, /* actions */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
100 | NULL, /* reserved */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
101 | NULL, /* reserved */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
102 | NULL, /* reserved */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
103 | NULL /* reserved */ |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
104 | }; |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
105 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
106 | static void |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
107 | init_plugin(PurplePlugin *plugin) |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
108 | { |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
109 | } |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
110 | |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
111 | PURPLE_INIT_PLUGIN(debugexample, init_plugin, info) |
|
ace837283c37
Add the debug example plugin
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
112 |