comparison plugins/filectl.c @ 5255:c0baa01cdeda

[gaim-migrate @ 5627] Paul A (darkrain) writes: " This patch updates the events.c, filectl.c, gaiminc.c, and mailchk.c plugins to the new api as well as updating mailchk.c to the new buddy list code. events.so, gaiminc.so, and mailchk.so all load and function properly on my computer. filectl doesn't even compile, but then, it has been a while since it did actually compile. I didn't even bother to update a few of the other plugins, since they're completely out of date. Perhaps one of the developers needs to go through and prune out a bunch of the plugins that are not kept up to date. Out of date plugins: chatlist.c - superceded by faceprint's recent commit to cvs. filectl.c - doesn't support multiple accounts for IMs and away messages. raw.c - does anyone use this? it doesn't compile, but it looks like an easy fix. " committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 28 Apr 2003 18:45:38 +0000
parents 6d1707dc8c3d
children dae79aefac8d
comparison
equal deleted inserted replaced
5254:d1e1ca490894 5255:c0baa01cdeda
7 #include <sys/types.h> 7 #include <sys/types.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 #include <string.h> 9 #include <string.h>
10 #include <ctype.h> 10 #include <ctype.h>
11 11
12 static void *handle; 12 #define FILECTL_PLUGIN_ID "core-filectl"
13 static int check; 13 static int check;
14 static time_t mtime; 14 static time_t mtime;
15 15
16 static void init_file(); 16 static void init_file();
17 static void check_file(); 17 static void check_file();
105 if (stat (filename, &finfo) != 0) 105 if (stat (filename, &finfo) != 0)
106 return; 106 return;
107 mtime = finfo.st_mtime; 107 mtime = finfo.st_mtime;
108 } 108 }
109 109
110 char *gaim_plugin_init(GModule *h) {
111 handle = h;
112 init_file();
113 check = g_timeout_add(5000, check_file, NULL);
114 return NULL;
115 }
116
117 void gaim_plugin_remove() {
118 g_source_remove(check);
119 }
120
121 struct gaim_plugin_description desc;
122 struct gaim_plugin_description *gaim_plugin_desc() {
123 desc.api_version = GAIM_PLUGIN_API_VERSION;
124 desc.name = g_strdup("Gaim File Control");
125 desc.version = g_strdup(VERSION);
126 desc.description = g_strdup("Allows you to control Gaim by entering commands in aa file.");
127 desc.authors = g_strdup("Eric Warmehoven &lt;eric@warmenhoven.org>");
128 desc.url = g_strdup(WEBSITE);
129 return &desc;
130 }
131
132 char *name() {
133 return "Gaim File Control";
134 }
135
136 char *description() {
137 return "Allows you to control gaim by entering commands in a file.";
138 }
139
140 /* check to see if the size of the file is > 0. if so, run commands */ 110 /* check to see if the size of the file is > 0. if so, run commands */
141 void init_file() { 111 void init_file() {
142 /* most of this was taken from Bash v2.04 by the FSF */ 112 /* most of this was taken from Bash v2.04 by the FSF */
143 struct stat finfo; 113 struct stat finfo;
144 char file[256]; 114 char file[256];
197 val = strdup(arr); 167 val = strdup(arr);
198 arr[i] = ' '; 168 arr[i] = ' ';
199 free(arr); 169 free(arr);
200 return val; 170 return val;
201 } 171 }
172 /*
173 * EXPORTED FUNCTIONS
174 */
175
176 static gboolean
177 plugin_load(GaimPlugin *plugin)
178 {
179 init_file();
180 check = g_timeout_add(5000, check_file, NULL);
181
182 return TRUE;
183 }
184
185 static gboolean
186 plugin_unload(GaimPlugin *plugin)
187 {
188 g_source_remove(check);
189
190 return TRUE;
191 }
192
193 static GaimPluginInfo info =
194 {
195 2, /**< api_version */
196 GAIM_PLUGIN_STANDARD, /**< type */
197 NULL, /**< ui_requirement */
198 0, /**< flags */
199 NULL, /**< dependencies */
200 GAIM_PRIORITY_DEFAULT, /**< priority */
201
202 FILECTL_PLUGIN_ID, /**< id */
203 N_("Gaim File Control"), /**< name */
204 VERSION, /**< version */
205 /** summary */
206 N_("Allows you to control Gaim by entering commands in a file."),
207 /** description */
208 N_("Allows you to control Gaim by entering commands in a file."),
209 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */
210 WEBSITE, /**< homepage */
211
212 plugin_load, /**< load */
213 plugin_unload, /**< unload */
214 NULL, /**< destroy */
215
216 NULL, /**< ui_info */
217 NULL /**< extra_info */
218 };
219
220 static void
221 __init_plugin(GaimPlugin *plugin)
222 {
223 }
224
225 GAIM_INIT_PLUGIN(filectl, __init_plugin, info);