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 H |
27 | |
28 | gint compare_str(gconstpointer a, gconstpointer b) | |
29 | { | |
30 | if (a==NULL) return 1; | |
31 | if (b==NULL) return -1; | |
32 | return strcmp(a,b); | |
33 | } | |
34 | ||
21c4e167 H |
35 | |
36 | static void | |
37 | received_im_msg_cb(PurpleAccount *account, char *who, char *buffer, | |
38 | PurpleConversation *conv, PurpleMessageFlags flags, void *data) | |
39 | { | |
21c4e167 H |
40 | |
41 | /* A workaround to avoid skipping of the first message as a result on NULL-conv: */ | |
42 | if (conv == NULL) conv=purple_conversation_new(PURPLE_CONV_TYPE_IM, account, who); | |
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), ":-*"); |
21c4e167 | 48 | |
21c4e167 H |
49 | } |
50 | ||
21c4e167 H |
51 | /* Plugin Routine */ |
52 | ||
53 | static gboolean | |
54 | plugin_load(PurplePlugin *plugin) | |
55 | { | |
56 | void *conv_handle = purple_conversations_get_handle(); | |
57 | ||
58 | purple_signal_connect(conv_handle, "received-im-msg", | |
59 | plugin, PURPLE_CALLBACK(received_im_msg_cb), NULL); | |
60 | return TRUE; | |
61 | } | |
62 | ||
63 | static gboolean | |
64 | plugin_unload(PurplePlugin *plugin) { | |
65 | ||
21c4e167 H |
66 | return TRUE; |
67 | } | |
68 | ||
69 | ||
aeaa58a9 H |
70 | static PurplePluginInfo info = { |
71 | PURPLE_PLUGIN_MAGIC, | |
72 | PURPLE_MAJOR_VERSION, | |
73 | PURPLE_MINOR_VERSION, | |
74 | PURPLE_PLUGIN_STANDARD, | |
75 | NULL, | |
76 | 0, | |
77 | NULL, | |
78 | PURPLE_PRIORITY_DEFAULT, | |
21c4e167 | 79 | |
aeaa58a9 | 80 | "core-autokiss", /**< id */ |
21c4e167 H |
81 | "AutoKiss", /**< name */ |
82 | "0.1", /**< version */ | |
83 | /** summary */ | |
84 | "Automatically answering based on regexes.", | |
85 | /** description */ | |
aeaa58a9 | 86 | "Automatically answering based on regexpppppppppppppppp", |
21c4e167 H |
87 | "Harvie <harvie@email.cz>", /**< author */ |
88 | "http://sourceforge.net/projects/pidgin-autoansw", /**< homepage */ | |
89 | ||
90 | plugin_load, /**< load */ | |
91 | plugin_unload, /**< unload */ | |
aeaa58a9 H |
92 | NULL, |
93 | ||
94 | NULL, | |
95 | NULL, | |
96 | NULL, | |
97 | NULL, | |
98 | NULL, | |
99 | NULL, | |
100 | NULL, | |
101 | NULL | |
21c4e167 H |
102 | }; |
103 | ||
104 | static void | |
105 | init_plugin(PurplePlugin *plugin) | |
106 | { | |
21c4e167 H |
107 | |
108 | } | |
109 | ||
110 | PURPLE_INIT_PLUGIN(autoanswer, init_plugin, info) | |
aeaa58a9 H |
111 | |
112 |