reindented autoansw.c
[mirrors/Programs.git] / plugins / pidgin-plugins / autokiss / autoansw.c
1 #define PURPLE_PLUGINS
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
16 #include <time.h>
17 #include <string.h>
18 #include <stdio.h>
19 /*
20 #include <sys/stat.h>
21 #include <ftw.h>
22 #include <glib.h>
23 #include <unistd.h>
24 */
25
26 char *buff = NULL;
27
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);
32 }
33
34 static void
35 received_im_msg_cb(PurpleAccount * account, char *who, char *buffer,
36 PurpleConversation * conv, PurpleMessageFlags flags,
37 void *data) {
38
39 /* A workaround to avoid skipping of the first message as a result on NULL-conv: */
40 if (conv == NULL)
41 conv =
42 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, who);
43
44 buff = purple_markup_strip_html(buffer);
45 printf("\nHarvie received 1: %s\n", buffer);
46
47 purple_conv_im_send(purple_conversation_get_im_data(conv), ":-*");
48
49 }
50
51 /* Plugin Routine */
52
53 static gboolean plugin_load(PurplePlugin * plugin) {
54 void *conv_handle = purple_conversations_get_handle();
55
56 purple_signal_connect(conv_handle, "received-im-msg",
57 plugin, PURPLE_CALLBACK(received_im_msg_cb),
58 NULL);
59 return TRUE;
60 }
61
62 static gboolean plugin_unload(PurplePlugin * plugin) {
63
64 return TRUE;
65 }
66
67 static PurplePluginInfo info = {
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 */
83 "Automatically answering based on regexpppppppppppppppp",
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
99 };
100
101 static void init_plugin(PurplePlugin * plugin) {
102
103 }
104
105 PURPLE_INIT_PLUGIN(autoanswer, init_plugin, info)
106
This page took 0.42844 seconds and 4 git commands to generate.