comparison src/protocols/irc/irc.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 9a19c0a1e1be
children 0241d6b6702d
comparison
equal deleted inserted replaced
5204:44de70702205 5205:fefad67de2c7
57 #define USEROPT_PORT 1 57 #define USEROPT_PORT 1
58 #define USEROPT_CHARSET 2 58 #define USEROPT_CHARSET 2
59 59
60 #define DEFAULT_SERVER "irc.freenode.net" 60 #define DEFAULT_SERVER "irc.freenode.net"
61 61
62 static struct prpl *my_protocol = NULL; 62 static GaimPlugin *my_protocol = NULL;
63 63
64 /* for win32 compatability */ 64 /* for win32 compatability */
65 G_MODULE_IMPORT GSList *connections; 65 G_MODULE_IMPORT GSList *connections;
66 66
67 #ifndef INET6_ADDRSTRLEN 67 #ifndef INET6_ADDRSTRLEN
1358 dccchat->gc = gc; 1358 dccchat->gc = gc;
1359 g_snprintf(dccchat->ip_address, sizeof(dccchat->ip_address), chat_args[3]); 1359 g_snprintf(dccchat->ip_address, sizeof(dccchat->ip_address), chat_args[3]);
1360 dccchat->port=atoi(chat_args[4]); 1360 dccchat->port=atoi(chat_args[4]);
1361 g_snprintf(dccchat->nick, sizeof(dccchat->nick), nick); 1361 g_snprintf(dccchat->nick, sizeof(dccchat->nick), nick);
1362 g_snprintf(ask, sizeof(ask), _("%s would like to establish a DCC chat"), nick); 1362 g_snprintf(ask, sizeof(ask), _("%s would like to establish a DCC chat"), nick);
1363 do_ask_dialog(ask, _("This requires a direct connection to be established between the two computers. Messages sent will not pass through the IRC server"), dccchat, _("Connect"), dcc_chat_init, _("Cancel"), dcc_chat_cancel, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); 1363 do_ask_dialog(ask, _("This requires a direct connection to be established between the two computers. Messages sent will not pass through the IRC server"), dccchat, _("Connect"), dcc_chat_init, _("Cancel"), dcc_chat_cancel, my_protocol->handle, FALSE);
1364 } 1364 }
1365 1365
1366 1366
1367 if (!g_ascii_strncasecmp(msg, "DCC SEND", 8)) { 1367 if (!g_ascii_strncasecmp(msg, "DCC SEND", 8)) {
1368 struct gaim_xfer *xfer; 1368 struct gaim_xfer *xfer;
2831 m = g_list_append(m, pbm); 2831 m = g_list_append(m, pbm);
2832 2832
2833 return m; 2833 return m;
2834 } 2834 }
2835 2835
2836 G_MODULE_EXPORT void 2836 static GaimPluginProtocolInfo prpl_info =
2837 irc_init(struct prpl *ret) 2837 {
2838 { 2838 GAIM_PROTO_IRC,
2839 OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL,
2840 NULL,
2841 NULL,
2842 irc_list_icon,
2843 irc_list_emblems,
2844 NULL,
2845 NULL,
2846 irc_away_states,
2847 NULL,
2848 irc_buddy_menu,
2849 irc_chat_info,
2850 irc_login,
2851 irc_close,
2852 irc_send_im,
2853 NULL,
2854 NULL,
2855 irc_get_info,
2856 irc_set_away,
2857 NULL,
2858 NULL,
2859 NULL,
2860 NULL,
2861 NULL,
2862 NULL,
2863 irc_add_buddy,
2864 NULL,
2865 irc_remove_buddy,
2866 NULL,
2867 NULL,
2868 NULL,
2869 NULL,
2870 NULL,
2871 NULL,
2872 NULL,
2873 irc_join_chat,
2874 irc_chat_invite,
2875 irc_chat_leave,
2876 NULL,
2877 irc_chat_send,
2878 NULL,
2879 NULL,
2880 NULL,
2881 NULL,
2882 NULL,
2883 NULL,
2884 NULL,
2885 NULL,
2886 irc_convo_closed,
2887 NULL
2888 };
2889
2890 static GaimPluginInfo info =
2891 {
2892 2, /**< api_version */
2893 GAIM_PLUGIN_PROTOCOL, /**< type */
2894 NULL, /**< ui_requirement */
2895 0, /**< flags */
2896 NULL, /**< dependencies */
2897 GAIM_PRIORITY_DEFAULT, /**< priority */
2898
2899 "prpl-irc", /**< id */
2900 "IRC", /**< name */
2901 VERSION, /**< version */
2902 /** summary */
2903 N_("IRC Protocol Plugin"),
2904 /** description */
2905 N_("IRC Protocol Plugin"),
2906 NULL, /**< author */
2907 WEBSITE, /**< homepage */
2908
2909 NULL, /**< load */
2910 NULL, /**< unload */
2911 NULL, /**< destroy */
2912
2913 NULL, /**< ui_info */
2914 &prpl_info /**< extra_info */
2915 };
2916
2917 static void
2918 __init_plugin(GaimPlugin *plugin)
2919 {
2920 struct proto_user_opt *puo;
2839 struct proto_user_split *pus; 2921 struct proto_user_split *pus;
2840 struct proto_user_opt *puo;
2841 ret->protocol = PROTO_IRC;
2842 ret->options = OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL;
2843 ret->name = g_strdup("IRC");
2844 ret->list_icon = irc_list_icon;
2845 ret->list_emblems = irc_list_emblems;
2846 ret->login = irc_login;
2847 ret->close = irc_close;
2848 ret->send_im = irc_send_im;
2849 ret->add_buddy = irc_add_buddy;
2850 ret->remove_buddy = irc_remove_buddy;
2851 ret->chat_info = irc_chat_info;
2852 ret->join_chat = irc_join_chat;
2853 ret->chat_leave = irc_chat_leave;
2854 ret->chat_send = irc_chat_send;
2855 ret->away_states = irc_away_states;
2856 ret->set_away = irc_set_away;
2857 ret->get_info = irc_get_info;
2858 ret->buddy_menu = irc_buddy_menu;
2859 ret->chat_invite = irc_chat_invite;
2860 ret->convo_closed = irc_convo_closed;
2861 #if 0
2862 ret->file_transfer_out = irc_file_transfer_out;
2863 ret->file_transfer_in = irc_file_transfer_in;
2864 ret->file_transfer_data_chunk = irc_file_transfer_data_chunk;
2865 ret->file_transfer_done = irc_file_transfer_done;
2866 ret->file_transfer_cancel =irc_file_transfer_cancel;
2867 #endif
2868 2922
2869 pus = g_new0(struct proto_user_split, 1); 2923 pus = g_new0(struct proto_user_split, 1);
2870 pus->sep = '@'; 2924 pus->sep = '@';
2871 pus->label = g_strdup(_("Server:")); 2925 pus->label = g_strdup(_("Server:"));
2872 pus->def = g_strdup(DEFAULT_SERVER); 2926 pus->def = g_strdup(DEFAULT_SERVER);
2873 ret->user_splits = g_list_append(ret->user_splits, pus); 2927 prpl_info.user_splits = g_list_append(prpl_info.user_splits, pus);
2874 2928
2875 puo = g_new0(struct proto_user_opt, 1); 2929 puo = g_new0(struct proto_user_opt, 1);
2876 puo->label = g_strdup(_("Port:")); 2930 puo->label = g_strdup(_("Port:"));
2877 puo->def = g_strdup("6667"); 2931 puo->def = g_strdup("6667");
2878 puo->pos = USEROPT_PORT; 2932 puo->pos = USEROPT_PORT;
2879 ret->user_opts = g_list_append(ret->user_opts, puo); 2933 prpl_info.user_opts = g_list_append(prpl_info.user_opts, puo);
2880 2934
2881 puo = g_new0(struct proto_user_opt, 1); 2935 puo = g_new0(struct proto_user_opt, 1);
2882 puo->label = g_strdup(_("Encoding:")); 2936 puo->label = g_strdup(_("Encoding:"));
2883 puo->def = g_strdup("ISO-8859-1"); 2937 puo->def = g_strdup("ISO-8859-1");
2884 puo->pos = USEROPT_CHARSET; 2938 puo->pos = USEROPT_CHARSET;
2885 ret->user_opts = g_list_append(ret->user_opts, puo); 2939 prpl_info.user_opts = g_list_append(prpl_info.user_opts, puo);
2886 2940
2887 my_protocol = ret; 2941 my_protocol = plugin;
2888 } 2942 }
2889 2943
2890 #ifndef STATIC 2944 GAIM_INIT_PLUGIN(irc, __init_plugin, info);
2891 G_MODULE_EXPORT void
2892 gaim_prpl_init(struct prpl* prpl)
2893 {
2894 irc_init(prpl);
2895 prpl->plug->desc.api_version = PLUGIN_API_VERSION;
2896 }
2897
2898 #endif