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 H |
35 | received_im_msg_cb(PurpleAccount * account, char *who, char *buffer, |
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: */ | |
d10f934a H |
40 | if (conv == NULL) |
41 | conv = | |
42 | purple_conversation_new(PURPLE_CONV_TYPE_IM, account, who); | |
21c4e167 | 43 | |
21c4e167 H |
44 | buff = purple_markup_strip_html(buffer); |
45 | printf("\nHarvie received 1: %s\n", buffer); | |
21c4e167 | 46 | |
aeaa58a9 | 47 | purple_conv_im_send(purple_conversation_get_im_data(conv), ":-*"); |
d10f934a | 48 | |
21c4e167 H |
49 | } |
50 | ||
21c4e167 H |
51 | /* Plugin Routine */ |
52 | ||
d10f934a | 53 | static gboolean plugin_load(PurplePlugin * plugin) { |
21c4e167 | 54 | void *conv_handle = purple_conversations_get_handle(); |
d10f934a | 55 | |
21c4e167 | 56 | purple_signal_connect(conv_handle, "received-im-msg", |
d10f934a H |
57 | plugin, PURPLE_CALLBACK(received_im_msg_cb), |
58 | NULL); | |
21c4e167 H |
59 | return TRUE; |
60 | } | |
61 | ||
d10f934a | 62 | static gboolean plugin_unload(PurplePlugin * plugin) { |
21c4e167 | 63 | |
21c4e167 H |
64 | return TRUE; |
65 | } | |
66 | ||
aeaa58a9 | 67 | static PurplePluginInfo info = { |
d10f934a H |
68 | PURPLE_PLUGIN_MAGIC, |
69 | PURPLE_MAJOR_VERSION, | |
70 | PURPLE_MINOR_VERSION, | |
71 | PURPLE_PLUGIN_STANDARD, | |
72 | NULL, | |
73 | 0, | |
74 | NULL, | |
75 | PURPLE_PRIORITY_DEFAULT, | |
76 | ||
77 | "core-autokiss", /**< id */ | |
78 | "AutoKiss", /**< name */ | |
79 | "0.1", /**< version */ | |
80 | /** summary */ | |
81 | "Automatically answering based on regexes.", | |
82 | /** description */ | |
aeaa58a9 | 83 | "Automatically answering based on regexpppppppppppppppp", |
d10f934a H |
84 | "Harvie <harvie@email.cz>", /**< author */ |
85 | "http://sourceforge.net/projects/pidgin-autoansw", /**< homepage */ | |
86 | ||
87 | plugin_load, /**< load */ | |
88 | plugin_unload, /**< unload */ | |
89 | NULL, | |
90 | ||
91 | NULL, | |
92 | NULL, | |
93 | NULL, | |
94 | NULL, | |
95 | NULL, | |
96 | NULL, | |
97 | NULL, | |
98 | NULL | |
21c4e167 H |
99 | }; |
100 | ||
d10f934a | 101 | static void init_plugin(PurplePlugin * plugin) { |
21c4e167 H |
102 | |
103 | } | |
104 | ||
105 | PURPLE_INIT_PLUGIN(autoanswer, init_plugin, info) | |
aeaa58a9 | 106 |