| 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 <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); |