comparison src/protocols/toc/toc.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 381da05cb5ed
children 890b29f00b68
comparison
equal deleted inserted replaced
5204:44de70702205 5205:fefad67de2c7
50 50
51 #ifdef _WIN32 51 #ifdef _WIN32
52 #include "win32dep.h" 52 #include "win32dep.h"
53 #endif 53 #endif
54 54
55 static struct prpl *my_protocol = NULL; 55 static GaimPlugin *my_protocol = NULL;
56 56
57 /* for win32 compatability */ 57 /* for win32 compatability */
58 G_MODULE_IMPORT GSList *connections; 58 G_MODULE_IMPORT GSList *connections;
59 59
60 #define REVISION "penguin" 60 #define REVISION "penguin"
1448 pam->gc = gc; 1448 pam->gc = gc;
1449 m = g_list_append(m, pam); 1449 m = g_list_append(m, pam);
1450 1450
1451 return m; 1451 return m;
1452 } 1452 }
1453
1454 G_MODULE_EXPORT void toc_init(struct prpl *ret)
1455 {
1456 struct proto_user_opt *puo;
1457 ret->protocol = PROTO_TOC;
1458 ret->options = OPT_PROTO_CORRECT_TIME;
1459 ret->name = g_strdup("TOC");
1460 ret->list_icon = toc_list_icon;
1461 ret->list_emblems = toc_list_emblems;
1462 ret->away_states = toc_away_states;
1463 ret->actions = toc_actions;
1464 ret->buddy_menu = toc_buddy_menu;
1465 ret->login = toc_login;
1466 ret->close = toc_close;
1467 ret->send_im = toc_send_im;
1468 ret->set_info = toc_set_info;
1469 ret->get_info = toc_get_info;
1470 ret->set_away = toc_set_away;
1471 ret->set_dir = toc_set_dir;
1472 ret->get_dir = toc_get_dir;
1473 ret->dir_search = toc_dir_search;
1474 ret->set_idle = toc_set_idle;
1475 ret->change_passwd = toc_change_passwd;
1476 ret->add_buddy = toc_add_buddy;
1477 ret->add_buddies = toc_add_buddies;
1478 ret->remove_buddy = toc_remove_buddy;
1479 ret->remove_buddies = toc_remove_buddies;
1480 ret->add_permit = toc_add_permit;
1481 ret->add_deny = toc_add_deny;
1482 ret->rem_permit = toc_rem_permit;
1483 ret->rem_deny = toc_rem_deny;
1484 ret->set_permit_deny = toc_set_permit_deny;
1485 ret->warn = toc_warn;
1486 ret->chat_info = toc_chat_info;
1487 ret->join_chat = toc_join_chat;
1488 ret->chat_invite = toc_chat_invite;
1489 ret->chat_leave = toc_chat_leave;
1490 ret->chat_whisper = toc_chat_whisper;
1491 ret->chat_send = toc_chat_send;
1492 ret->keepalive = toc_keepalive;
1493
1494 puo = g_new0(struct proto_user_opt, 1);
1495 puo->label = g_strdup(_("TOC Host:"));
1496 puo->def = g_strdup("toc.oscar.aol.com");
1497 puo->pos = USEROPT_AUTH;
1498 ret->user_opts = g_list_append(ret->user_opts, puo);
1499
1500 puo = g_new0(struct proto_user_opt, 1);
1501 puo->label = g_strdup(_("TOC Port:"));
1502 puo->def = g_strdup("9898");
1503 puo->pos = USEROPT_AUTHPORT;
1504 ret->user_opts = g_list_append(ret->user_opts, puo);
1505
1506 my_protocol = ret;
1507 }
1508
1509 #ifndef STATIC
1510
1511 G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl)
1512 {
1513 toc_init(prpl);
1514 prpl->plug->desc.api_version = PLUGIN_API_VERSION;
1515 }
1516
1517 #endif
1518 1453
1519 /********* 1454 /*********
1520 * RVOUS ACTIONS 1455 * RVOUS ACTIONS
1521 ********/ 1456 ********/
1522 1457
2036 ft->filename, size, sizes[index], (ft->message) ? "\n" : "", 1971 ft->filename, size, sizes[index], (ft->message) ? "\n" : "",
2037 (ft->message) ? ft->message : ""); 1972 (ft->message) ? ft->message : "");
2038 } else { 1973 } else {
2039 g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user); 1974 g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user);
2040 } 1975 }
2041 do_ask_dialog(buf, NULL, ft, _("Accept"), toc_accept_ft, _("Cancel"), toc_reject_ft, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); 1976 do_ask_dialog(buf, NULL, ft, _("Accept"), toc_accept_ft, _("Cancel"), toc_reject_ft, my_protocol->handle, FALSE);
2042 } 1977 }
1978
1979 static GaimPluginProtocolInfo prpl_info =
1980 {
1981 GAIM_PROTO_TOC,
1982 OPT_PROTO_CORRECT_TIME,
1983 NULL,
1984 NULL,
1985 toc_list_icon,
1986 toc_list_emblems,
1987 NULL,
1988 NULL,
1989 toc_away_states,
1990 toc_actions,
1991 toc_buddy_menu,
1992 toc_chat_info,
1993 toc_login,
1994 toc_close,
1995 toc_send_im,
1996 toc_set_info,
1997 NULL,
1998 toc_get_info,
1999 toc_set_away,
2000 NULL,
2001 toc_set_dir,
2002 toc_get_dir,
2003 toc_dir_search,
2004 toc_set_idle,
2005 toc_change_passwd,
2006 toc_add_buddy,
2007 toc_add_buddies,
2008 toc_remove_buddy,
2009 toc_remove_buddies,
2010 toc_add_permit,
2011 toc_add_deny,
2012 toc_rem_permit,
2013 toc_rem_deny,
2014 toc_set_permit_deny,
2015 toc_warn,
2016 toc_join_chat,
2017 toc_chat_invite,
2018 toc_chat_leave,
2019 toc_chat_whisper,
2020 toc_chat_send,
2021 toc_keepalive,
2022 NULL,
2023 NULL,
2024 NULL,
2025 NULL,
2026 NULL,
2027 NULL,
2028 NULL,
2029 NULL,
2030 NULL
2031 };
2032
2033 static GaimPluginInfo info =
2034 {
2035 2, /**< api_version */
2036 GAIM_PLUGIN_PROTOCOL, /**< type */
2037 NULL, /**< ui_requirement */
2038 0, /**< flags */
2039 NULL, /**< dependencies */
2040 GAIM_PRIORITY_DEFAULT, /**< priority */
2041
2042 "prpl-toc", /**< id */
2043 "TOC", /**< name */
2044 VERSION, /**< version */
2045 /** summary */
2046 N_("TOC Protocol Plugin"),
2047 /** description */
2048 N_("TOC Protocol Plugin"),
2049 NULL, /**< author */
2050 WEBSITE, /**< homepage */
2051
2052 NULL, /**< load */
2053 NULL, /**< unload */
2054 NULL, /**< destroy */
2055
2056 NULL, /**< ui_info */
2057 &prpl_info /**< extra_info */
2058 };
2059
2060 static void
2061 __init_plugin(GaimPlugin *plugin)
2062 {
2063 struct proto_user_opt *puo;
2064
2065 puo = g_new0(struct proto_user_opt, 1);
2066 puo->label = g_strdup(_("TOC Host:"));
2067 puo->def = g_strdup("toc.oscar.aol.com");
2068 puo->pos = USEROPT_AUTH;
2069 prpl_info.user_opts = g_list_append(prpl_info.user_opts, puo);
2070
2071 puo = g_new0(struct proto_user_opt, 1);
2072 puo->label = g_strdup(_("TOC Port:"));
2073 puo->def = g_strdup("9898");
2074 puo->pos = USEROPT_AUTHPORT;
2075 prpl_info.user_opts = g_list_append(prpl_info.user_opts, puo);
2076
2077 my_protocol = plugin;
2078 }
2079
2080 GAIM_INIT_PLUGIN(toc, __init_plugin, info);