Commit | Line | Data |
---|---|---|
21c4e167 | 1 | #define PURPLE_PLUGINS |
21c4e167 H |
2 | |
3 | /* Purple headers */ | |
4 | #include <libpurple/debug.h> | |
5 | #include <libpurple/version.h> | |
6 | #include <libpurple/conversation.h> | |
7 | #include <libpurple/debug.h> | |
8 | #include <libpurple/log.h> | |
9 | #include <libpurple/plugin.h> | |
10 | #include <libpurple/pluginpref.h> | |
11 | #include <libpurple/prefs.h> | |
12 | #include <libpurple/signals.h> | |
13 | #include <libpurple/util.h> | |
14 | #include <libpurple/notify.h> | |
15 | ||
21c4e167 H |
16 | #include <time.h> |
17 | #include <string.h> | |
18 | #include <stdio.h> | |
aeaa58a9 | 19 | /* |
21c4e167 H |
20 | #include <sys/stat.h> |
21 | #include <ftw.h> | |
22 | #include <glib.h> | |
aeaa58a9 H |
23 | #include <unistd.h> |
24 | */ | |
21c4e167 H |
25 | |
26 | char *buff = NULL; | |
21c4e167 | 27 | |
d10f934a H |
28 | gint compare_str(gconstpointer a, gconstpointer b) { |
29 | if (a == NULL) return 1; | |
30 | if (b == NULL) return -1; | |
31 | return strcmp(a, b); | |
21c4e167 H |
32 | } |
33 | ||
21c4e167 | 34 | static void |
d10f934a | 35 | received_im_msg_cb(PurpleAccount * account, char *who, char *buffer, |
f6560cc6 H |
36 | PurpleConversation * conv, PurpleMessageFlags flags, |
37 | void *data) { | |
21c4e167 H |
38 | |
39 | /* A workaround to avoid skipping of the first message as a result on NULL-conv: */ | |
f6560cc6 | 40 | if (conv == NULL) conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, who); |
21c4e167 | 41 | |
21c4e167 H |
42 | buff = purple_markup_strip_html(buffer); |
43 | printf("\nHarvie received 1: %s\n", buffer); | |
21c4e167 | 44 | |
aeaa58a9 | 45 | purple_conv_im_send(purple_conversation_get_im_data(conv), ":-*"); |
d10f934a | 46 | |
21c4e167 H |
47 | } |
48 | ||
21c4e167 | 49 | |
d10f934a | 50 | static gboolean plugin_load(PurplePlugin * plugin) { |
21c4e167 | 51 | void *conv_handle = purple_conversations_get_handle(); |
d10f934a | 52 | |
21c4e167 | 53 | purple_signal_connect(conv_handle, "received-im-msg", |
d10f934a H |
54 | plugin, PURPLE_CALLBACK(received_im_msg_cb), |
55 | NULL); | |
21c4e167 H |
56 | return TRUE; |
57 | } | |
58 | ||
d10f934a | 59 | static gboolean plugin_unload(PurplePlugin * plugin) { |
21c4e167 H |
60 | return TRUE; |
61 | } | |
62 | ||
aeaa58a9 | 63 | static PurplePluginInfo info = { |
d10f934a H |
64 | PURPLE_PLUGIN_MAGIC, |
65 | PURPLE_MAJOR_VERSION, | |
66 | PURPLE_MINOR_VERSION, | |
67 | PURPLE_PLUGIN_STANDARD, | |
68 | NULL, | |
69 | 0, | |
70 | NULL, | |
71 | PURPLE_PRIORITY_DEFAULT, | |
72 | ||
f6560cc6 H |
73 | "core-autokiss", |
74 | "AutoKiss", | |
75 | "0.1", | |
76 | "Automatic answering", | |
aeaa58a9 | 77 | "Automatically answering based on regexpppppppppppppppp", |
f6560cc6 H |
78 | "Harvie <harvie@email.cz>", |
79 | "http://sourceforge.net/projects/pidgin-autoansw", | |
d10f934a | 80 | |
f6560cc6 H |
81 | plugin_load, |
82 | plugin_unload, | |
d10f934a | 83 | NULL, |
d10f934a H |
84 | NULL, |
85 | NULL, | |
86 | NULL, | |
87 | NULL, | |
88 | NULL, | |
89 | NULL, | |
90 | NULL, | |
91 | NULL | |
21c4e167 H |
92 | }; |
93 | ||
d10f934a | 94 | static void init_plugin(PurplePlugin * plugin) { |
21c4e167 H |
95 | |
96 | } | |
97 | ||
98 | PURPLE_INIT_PLUGIN(autoanswer, init_plugin, info) | |
aeaa58a9 | 99 |