comparison src/protocols/irc/irc.c @ 3572:bdd0bebd2d04

[gaim-migrate @ 3670] Phase II. No longer do you have to worry about protocol plugins. When Gaim probes plugins on load, it will detect protocol plugins and add them to the list of available protocols. When you try to log an account on with one of them, Gaim will automatically load the plugin--when no more accounts need the protocol--Gaim will automatically unload it. Protocol plugins are no longer available in the plugins ui, and no protocols are compiled statically by default. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 30 Sep 2002 01:05:18 +0000
parents d6468f276d24
children 0a60fd3905b1
comparison
equal deleted inserted replaced
3571:a88c62c5b7da 3572:bdd0bebd2d04
97 return data; 97 return data;
98 } 98 }
99 tmp = tmp->next; 99 tmp = tmp->next;
100 } 100 }
101 return NULL; 101 return NULL;
102 }
103
104 static char *irc_name()
105 {
106 return "IRC";
107 } 102 }
108 103
109 static int irc_write(int fd, char *data, int len) 104 static int irc_write(int fd, char *data, int len)
110 { 105 {
111 debug_printf("IRC C: %s", data); 106 debug_printf("IRC C: %s", data);
1399 1394
1400 close(idata->fd); 1395 close(idata->fd);
1401 g_free(gc->proto_data); 1396 g_free(gc->proto_data);
1402 } 1397 }
1403 1398
1404 static GList *irc_user_opts()
1405 {
1406 GList *m = NULL;
1407 struct proto_user_opt *puo;
1408
1409 puo = g_new0(struct proto_user_opt, 1);
1410 puo->label = "Server:";
1411 puo->def = "irc.openprojects.net";
1412 puo->pos = USEROPT_SERV;
1413 m = g_list_append(m, puo);
1414
1415 puo = g_new0(struct proto_user_opt, 1);
1416 puo->label = "Port:";
1417 puo->def = "6667";
1418 puo->pos = USEROPT_PORT;
1419 m = g_list_append(m, puo);
1420
1421 return m;
1422 }
1423
1424 static void set_mode_3(struct gaim_connection *gc, char *who, int sign, int mode, 1399 static void set_mode_3(struct gaim_connection *gc, char *who, int sign, int mode,
1425 int start, int end, char *word[]) 1400 int start, int end, char *word[])
1426 { 1401 {
1427 struct irc_data *id = gc->proto_data; 1402 struct irc_data *id = gc->proto_data;
1428 char buf[IRC_BUF_LEN]; 1403 char buf[IRC_BUF_LEN];
1985 1960
1986 static struct prpl *my_protocol = NULL; 1961 static struct prpl *my_protocol = NULL;
1987 1962
1988 void irc_init(struct prpl *ret) 1963 void irc_init(struct prpl *ret)
1989 { 1964 {
1965 struct proto_user_opt *puo;
1990 ret->protocol = PROTO_IRC; 1966 ret->protocol = PROTO_IRC;
1991 ret->options = OPT_PROTO_CHAT_TOPIC | OPT_PROTO_NO_PASSWORD; 1967 ret->options = OPT_PROTO_CHAT_TOPIC | OPT_PROTO_NO_PASSWORD;
1992 ret->name = irc_name; 1968 ret->name = g_strdup("IRC");
1993 ret->user_opts = irc_user_opts;
1994 ret->list_icon = irc_list_icon; 1969 ret->list_icon = irc_list_icon;
1995 ret->login = irc_login; 1970 ret->login = irc_login;
1996 ret->close = irc_close; 1971 ret->close = irc_close;
1997 ret->send_im = irc_send_im; 1972 ret->send_im = irc_send_im;
1998 ret->add_buddy = irc_add_buddy; 1973 ret->add_buddy = irc_add_buddy;
2005 ret->set_away = irc_set_away; 1980 ret->set_away = irc_set_away;
2006 ret->get_info = irc_get_info; 1981 ret->get_info = irc_get_info;
2007 ret->buddy_menu = irc_buddy_menu; 1982 ret->buddy_menu = irc_buddy_menu;
2008 ret->chat_invite = irc_chat_invite; 1983 ret->chat_invite = irc_chat_invite;
2009 ret->convo_closed = irc_convo_closed; 1984 ret->convo_closed = irc_convo_closed;
2010 my_protocol = ret; 1985
1986 puo = g_new0(struct proto_user_opt, 1);
1987 puo->label = g_strdup("Server:");
1988 puo->def = g_strdup("irc.openprojects.net");
1989 puo->pos = USEROPT_SERV;
1990 ret->user_opts = g_list_append(ret->user_opts, puo);
1991
1992 puo = g_new0(struct proto_user_opt, 1);
1993 puo->label = g_strdup("Port:");
1994 puo->def = g_strdup("6667");
1995 puo->pos = USEROPT_PORT;
1996 ret->user_opts = g_list_append(ret->user_opts, puo);
1997
1998 my_protocol = ret;
2011 } 1999 }
2012 2000
2013 #ifndef STATIC 2001 #ifndef STATIC
2014 2002
2015 char *gaim_plugin_init(GModule *handle) 2003 void *gaim_prpl_init(struct prpl* prpl)
2016 { 2004 {
2017 load_protocol(irc_init, sizeof(struct prpl)); 2005 irc_init(prpl);
2018 return NULL; 2006 prpl->plug->desc.api_version = PLUGIN_API_VERSION;
2019 }
2020
2021 void gaim_plugin_remove()
2022 {
2023 struct prpl *p = find_prpl(PROTO_IRC);
2024 if (p == my_protocol)
2025 unload_protocol(p);
2026 }
2027
2028 char *name()
2029 {
2030 return "IRC";
2031 }
2032
2033 char *description()
2034 {
2035 return PRPL_DESC("IRC");
2036 } 2007 }
2037 2008
2038 #endif 2009 #endif