comparison plugins/spellchk.c @ 5205:fefad67de2c7

[gaim-migrate @ 5573] I had a damn good commit message, but it was eaten. Let's try it again. Announcing, Gaim Plugin API version 2.0, or GPAPIV2.0 for short. There are lots'a cool thingies here. Okay now, this isn't as cool as the previous message, but: 1) There's now a single entry function for all plugin types. It returns a detailed information structure on the plugin. This removes a lot of the ugliness from old plugins. Oh yeah, libicq wasn't converted to this, so if you use it, well, you shouldn't have used it anyway, but now you can't! bwahahaha. Use AIM/ICQ. 2) There are now 3 types of plugins: Standard, Loader, and Protocol plugins. Standard plugins are, well, standard, compiled plugins. Loader plugins load other plugins. For example, the perl support is now a loader plugin. It loads perl scripts. In the future, we'll have Ruby and Python loader plugins. Protocol plugins are, well, protocol plugins... yeah... 3) Plugins have unique IDs, so they can be referred to or automatically updated from a plugin database in the future. Neat, huh? 4) Plugins will have dependency support in the future, and can be hidden, so if you have, say, a logging core plugin, it won't have to show up, but then you load the GTK+ logging plugin and it'll auto-load the core plugin. Core/UI split plugins! 5) There will eventually be custom plugin signals and RPC of some sort, for the core/ui split plugins. So, okay, back up .gaimrc. I'd like to thank my parents for their support, javabsp for helping convert a bunch of protocol plugins, and Etan for helping convert a bunch of standard plugins. Have fun. If you have any problems, please let me know, but you probably won't have anything major happen. You will have to convert your plugins, though, and I'm not guaranteeing that all perl scripts will still work. I'll end up changing the perl script API eventually, so I know they won't down the road. Don't worry, though. It'll be mass cool. faceprint wants me to just commit the damn code already. So, here we go!!! .. .. I need a massage. From a young, cute girl. Are there any young, cute girls in the audience? IM me plz k thx. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 25 Apr 2003 06:47:33 +0000
parents 03ea71acade3
children 6d1707dc8c3d
comparison
equal deleted inserted replaced
5204:44de70702205 5205:fefad67de2c7
1 /* 1 /*
2 * A lot of this code (especially the config code) was taken directly 2 * A lot of this code (especially the config code) was taken directly
3 * or nearly directly from xchat, version 1.4.2 by Peter Zelezny and others. 3 * or nearly directly from xchat, version 1.4.2 by Peter Zelezny and others.
4 * 4 *
5 * TODO: 5 * TODO:
6 * ? I think i did everything i want to with it. 6 * ? I think i did everything i want to with it.
7 * 7 *
8 * BUGS: 8 * BUGS:
9 * ? I think i fixed them all. 9 * ? I think i fixed them all.
10 */ 10 */
11 #include "config.h" 11 #include "config.h"
12 12
13 #ifndef GAIM_PLUGINS
14 #define GAIM_PLUGINS
15 #endif
16
17 #include "gaim.h" 13 #include "gaim.h"
14 #include "gtkplugin.h"
18 15
19 #include <string.h> 16 #include <string.h>
20 #include <ctype.h> 17 #include <ctype.h>
21 #include <stdlib.h> 18 #include <stdlib.h>
22 #include <sys/stat.h> 19 #include <sys/stat.h>
24 #include <unistd.h> 21 #include <unistd.h>
25 #include <fcntl.h> 22 #include <fcntl.h>
26 #ifdef _WIN32 23 #ifdef _WIN32
27 #include "win32dep.h" 24 #include "win32dep.h"
28 #endif 25 #endif
26
27 #define SPELLCHECK_PLUGIN_ID "gtk-spellcheck"
29 28
30 enum { 29 enum {
31 BAD_COLUMN, 30 BAD_COLUMN,
32 GOOD_COLUMN, 31 GOOD_COLUMN,
33 N_COLUMNS 32 N_COLUMNS
380 379
381 /* 380 /*
382 * EXPORTED FUNCTIONS 381 * EXPORTED FUNCTIONS
383 */ 382 */
384 383
385 G_MODULE_EXPORT char *gaim_plugin_init(GModule *handle) { 384 static gboolean
385 plugin_load(GaimPlugin *plugin)
386 {
386 load_conf(); 387 load_conf();
387 388
388 gaim_signal_connect(handle, event_im_send, substitute_words, NULL); 389 gaim_signal_connect(plugin, event_im_send, substitute_words, NULL);
389 gaim_signal_connect(handle, event_chat_send, substitute_words, NULL); 390 gaim_signal_connect(plugin, event_chat_send, substitute_words, NULL);
390 return NULL; 391
391 } 392 return TRUE;
392 393 }
393 G_MODULE_EXPORT void gaim_plugin_remove() { 394
394 } 395 static GtkWidget *
395 396 get_config_frame(GaimPlugin *plugin)
396 struct gaim_plugin_description desc;
397 G_MODULE_EXPORT struct gaim_plugin_description *gaim_plugin_desc() {
398 desc.api_version = PLUGIN_API_VERSION;
399 desc.name = g_strdup(_("Text replacement"));
400 desc.version = g_strdup(VERSION);
401 desc.description = g_strdup(_("Replaces text in outgoing messages according to user-defined rules."));
402 desc.authors = g_strdup("Eric Warmehoven &lt;eric@warmenhoven.org>");
403 desc.url = g_strdup(WEBSITE);
404 return &desc;
405 }
406
407 G_MODULE_EXPORT char *name() {
408 return _("Text replacement");
409 }
410
411 G_MODULE_EXPORT char *description() {
412 return _("Replaces text in outgoing messages according to user-defined rules.");
413 }
414
415 G_MODULE_EXPORT GtkWidget *gaim_plugin_config_gtk()
416 { 397 {
417 GtkWidget *ret, *vbox, *win; 398 GtkWidget *ret, *vbox, *win;
418 GtkWidget *hbox, *label; 399 GtkWidget *hbox, *label;
419 GtkWidget *button; 400 GtkWidget *button;
420 GtkSizeGroup *sg; 401 GtkSizeGroup *sg;
532 513
533 514
534 gtk_widget_show_all(ret); 515 gtk_widget_show_all(ret);
535 return ret; 516 return ret;
536 } 517 }
518
519 static GaimGtkPluginUiInfo ui_info =
520 {
521 get_config_frame
522 };
523
524 static GaimPluginInfo info =
525 {
526 2,
527 GAIM_PLUGIN_STANDARD,
528 GAIM_GTK_PLUGIN_TYPE,
529 0,
530 NULL,
531 GAIM_PRIORITY_DEFAULT,
532 SPELLCHECK_PLUGIN_ID,
533 N_("Text replacement"),
534 VERSION,
535 N_("Replaces text in outgoing messages according to user-defined rules."),
536 N_("Replaces text in outgoing messages according to user-defined rules."),
537 "Eric Warmnenhoven <eric@warmenhoven.org>",
538 WEBSITE,
539 plugin_load,
540 NULL,
541 NULL,
542 &ui_info,
543 NULL
544 };
545
546 static void
547 __init_plugin(GaimPlugin *plugin)
548 {
549 }
550
551 GAIM_INIT_PLUGIN(spellcheck, __init_plugin, info);