Mercurial > pidgin.yaz
comparison src/protocols/irc/irc.c @ 2170:c24595d3c364
[gaim-migrate @ 2180]
buddy_menu
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 27 Aug 2001 07:11:50 +0000 |
parents | edf8c5a70e5b |
children | b51cd9350d65 |
comparison
equal
deleted
inserted
replaced
2169:b7807144bf44 | 2170:c24595d3c364 |
---|---|
22 | 22 |
23 #include <config.h> | 23 #include <config.h> |
24 | 24 |
25 | 25 |
26 #include <netdb.h> | 26 #include <netdb.h> |
27 #include <gtk/gtk.h> | |
28 #include <unistd.h> | 27 #include <unistd.h> |
29 #include <errno.h> | 28 #include <errno.h> |
30 #include <netinet/in.h> | 29 #include <netinet/in.h> |
31 #include <arpa/inet.h> | 30 #include <arpa/inet.h> |
32 #include <fcntl.h> | 31 #include <fcntl.h> |
1976 { | 1975 { |
1977 return free_icon_xpm; | 1976 return free_icon_xpm; |
1978 } | 1977 } |
1979 | 1978 |
1980 /* Send out a ping request to the specified user */ | 1979 /* Send out a ping request to the specified user */ |
1981 static void irc_send_ping(GtkObject *w, char *who) | 1980 static void irc_send_ping(struct gaim_connection *gc, char *who) |
1982 { | 1981 { |
1983 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(w); | |
1984 struct irc_data *idata = (struct irc_data *)gc->proto_data; | 1982 struct irc_data *idata = (struct irc_data *)gc->proto_data; |
1985 char buf[BUF_LEN]; | 1983 char buf[BUF_LEN]; |
1986 | 1984 |
1987 g_snprintf(buf, BUF_LEN, "PRIVMSG %s :%cPING %ld%c\n", who, '\001', time((time_t *) NULL), | 1985 g_snprintf(buf, BUF_LEN, "PRIVMSG %s :%cPING %ld%c\n", who, '\001', time((time_t *) NULL), |
1988 '\001'); | 1986 '\001'); |
2001 else | 1999 else |
2002 g_snprintf(buf, BUF_LEN, "WHOIS %s\n", who); | 2000 g_snprintf(buf, BUF_LEN, "WHOIS %s\n", who); |
2003 write(idata->fd, buf, strlen(buf)); | 2001 write(idata->fd, buf, strlen(buf)); |
2004 } | 2002 } |
2005 | 2003 |
2006 static void irc_send_whois(GtkObject *w, char *who) | 2004 static GList *irc_buddy_menu(struct gaim_connection *gc, char *who) |
2007 { | 2005 { |
2008 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(w); | 2006 GList *m = NULL; |
2009 irc_get_info(gc, who); | 2007 struct proto_buddy_menu *pbm; |
2010 } | 2008 |
2011 | 2009 pbm = g_new0(struct proto_buddy_menu, 1); |
2012 static void irc_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) | 2010 pbm->label = _("Ping"); |
2013 { | 2011 pbm->callback = irc_send_ping; |
2014 GtkWidget *button; | 2012 pbm->gc = gc; |
2015 | 2013 m = g_list_append(m, pbm); |
2016 button = gtk_menu_item_new_with_label("Ping"); | 2014 |
2017 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(irc_send_ping), who); | 2015 pbm = g_new0(struct proto_buddy_menu, 1); |
2018 gtk_object_set_user_data(GTK_OBJECT(button), gc); | 2016 pbm->label = _("Whois"); |
2019 gtk_menu_append(GTK_MENU(menu), button); | 2017 pbm->callback = irc_get_info; |
2020 gtk_widget_show(button); | 2018 pbm->gc = gc; |
2021 | 2019 m = g_list_append(m, pbm); |
2022 button = gtk_menu_item_new_with_label("Whois"); | 2020 |
2023 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(irc_send_whois), who); | 2021 return m; |
2024 gtk_object_set_user_data(GTK_OBJECT(button), gc); | |
2025 gtk_menu_append(GTK_MENU(menu), button); | |
2026 gtk_widget_show(button); | |
2027 } | 2022 } |
2028 | 2023 |
2029 | 2024 |
2030 static void irc_set_away(struct gaim_connection *gc, char *state, char *msg) | 2025 static void irc_set_away(struct gaim_connection *gc, char *state, char *msg) |
2031 { | 2026 { |