Mercurial > pidgin.yaz
comparison src/server.c @ 4487:abb0c3eccc76
[gaim-migrate @ 4762]
slowly, the gtk code in server.c dies off
there should be no patent issues with this code
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Fri, 31 Jan 2003 02:02:52 +0000 |
parents | 62c1e5e656d0 |
children | 3196d9044a45 |
comparison
equal
deleted
inserted
replaced
4486:c3281e2af992 | 4487:abb0c3eccc76 |
---|---|
34 #include "gtkimhtml.h" | 34 #include "gtkimhtml.h" |
35 #include "prpl.h" | 35 #include "prpl.h" |
36 #include "multi.h" | 36 #include "multi.h" |
37 #include "gaim.h" | 37 #include "gaim.h" |
38 | 38 |
39 #include "pixmaps/ok.xpm" | |
40 #include "pixmaps/cancel.xpm" | 39 #include "pixmaps/cancel.xpm" |
41 #include "pixmaps/tb_search.xpm" | 40 #include "pixmaps/tb_search.xpm" |
42 | 41 |
43 void serv_login(struct aim_user *user) | 42 void serv_login(struct aim_user *user) |
44 { | 43 { |
978 gaim_im_stop_typing_timeout(im); | 977 gaim_im_stop_typing_timeout(im); |
979 gaim_im_set_typing_state(im, NOT_TYPING); | 978 gaim_im_set_typing_state(im, NOT_TYPING); |
980 gaim_im_update_typing(im); | 979 gaim_im_update_typing(im); |
981 } | 980 } |
982 | 981 |
983 static void close_invite(GtkWidget *w, GtkWidget *w2) | 982 struct chat_invite_data { |
984 { | 983 struct gaim_connection *gc; |
985 GList *str = gtk_object_get_user_data(GTK_OBJECT(w2)); | 984 GList *str; |
986 GList *tmp = str; | 985 }; |
987 | 986 |
988 while (tmp) { | 987 static void chat_invite_data_free(struct chat_invite_data *cid) |
989 g_free(tmp->data); | 988 { |
990 tmp = tmp->next; | 989 GList *tmp = cid->str; |
991 } | |
992 if (str) | |
993 g_list_free(str); | |
994 | |
995 gtk_widget_destroy(w2); | |
996 } | |
997 | |
998 static void chat_invite_callback(GtkWidget *w, GtkWidget *w2) | |
999 { | |
1000 struct gaim_connection *g = (struct gaim_connection *) | |
1001 gtk_object_get_user_data(GTK_OBJECT(GTK_DIALOG(w2)->vbox)); | |
1002 GList *str, *tmp; | |
1003 | |
1004 str = gtk_object_get_user_data(GTK_OBJECT(w2)); | |
1005 | |
1006 serv_join_chat(g, str); | |
1007 | |
1008 tmp = str; | |
1009 | |
1010 while (tmp) { | 990 while (tmp) { |
1011 /* this is either a g_malloc'd char* or g_malloc'd int* */ | 991 /* this is either a g_malloc'd char* or g_malloc'd int* */ |
1012 g_free(tmp->data); | 992 g_free(tmp->data); |
1013 tmp = tmp->next; | 993 tmp = tmp->next; |
1014 } | 994 } |
1015 if (str) | 995 if (cid->str) |
1016 g_list_free(str); | 996 g_list_free(cid->str); |
1017 | 997 g_free(cid); |
1018 gtk_widget_destroy(w2); | 998 } |
1019 } | 999 |
1020 | 1000 static void chat_invite_accept(struct chat_invite_data *cid) |
1021 | 1001 { |
1022 | 1002 serv_join_chat(cid->gc, cid->str); |
1023 void serv_got_chat_invite(struct gaim_connection *g, char *name, | 1003 |
1004 chat_invite_data_free(cid); | |
1005 } | |
1006 | |
1007 | |
1008 | |
1009 void serv_got_chat_invite(struct gaim_connection *gc, char *name, | |
1024 char *who, char *message, GList *data) | 1010 char *who, char *message, GList *data) |
1025 { | 1011 { |
1026 GtkWidget *d; | |
1027 GtkWidget *label; | |
1028 GtkWidget *yesbtn; | |
1029 GtkWidget *nobtn; | |
1030 | |
1031 char buf2[BUF_LONG]; | 1012 char buf2[BUF_LONG]; |
1032 | 1013 struct chat_invite_data *cid = g_new0(struct chat_invite_data, 1); |
1033 | 1014 |
1034 plugin_event(event_chat_invited, g, who, name, message); | 1015 |
1016 plugin_event(event_chat_invited, gc, who, name, message); | |
1035 | 1017 |
1036 if (message) | 1018 if (message) |
1037 g_snprintf(buf2, sizeof(buf2), | 1019 g_snprintf(buf2, sizeof(buf2), |
1038 _("User '%s' invites %s to buddy chat room: '%s'\n%s"), | 1020 _("User '%s' invites %s to buddy chat room: '%s'\n%s"), |
1039 who, g->username, name, message); | 1021 who, gc->username, name, message); |
1040 else | 1022 else |
1041 g_snprintf(buf2, sizeof(buf2), | 1023 g_snprintf(buf2, sizeof(buf2), |
1042 _("User '%s' invites %s to buddy chat room: '%s'\n"), | 1024 _("User '%s' invites %s to buddy chat room: '%s'\n"), |
1043 who, g->username, name); | 1025 who, gc->username, name); |
1044 | 1026 |
1045 d = gtk_dialog_new(); | 1027 cid->gc = gc; |
1046 gtk_widget_realize(d); | 1028 cid->str = data; |
1047 | 1029 |
1048 | 1030 do_ask_dialog(_("Buddy Chat Invite"), buf2, cid, _("Accept"), chat_invite_accept, _("Cancel"), chat_invite_data_free, NULL, FALSE); |
1049 label = gtk_label_new(buf2); | |
1050 gtk_widget_show(label); | |
1051 yesbtn = picture_button(d, _("Yes"), ok_xpm); | |
1052 nobtn = picture_button(d, _("No"), cancel_xpm); | |
1053 gtk_widget_show(nobtn); | |
1054 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), label, FALSE, FALSE, 5); | |
1055 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), yesbtn, FALSE, FALSE, 5); | |
1056 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), nobtn, FALSE, FALSE, 5); | |
1057 | |
1058 gtk_object_set_user_data(GTK_OBJECT(GTK_DIALOG(d)->vbox), g); | |
1059 gtk_object_set_user_data(GTK_OBJECT(d), data); | |
1060 | |
1061 | |
1062 gtk_window_set_title(GTK_WINDOW(d), _("Buddy chat invite")); | |
1063 g_signal_connect(G_OBJECT(nobtn), "clicked", | |
1064 G_CALLBACK(close_invite), d); | |
1065 g_signal_connect(G_OBJECT(yesbtn), "clicked", | |
1066 G_CALLBACK(chat_invite_callback), d); | |
1067 | |
1068 gtk_widget_show(d); | |
1069 } | 1031 } |
1070 | 1032 |
1071 struct gaim_conversation *serv_got_joined_chat(struct gaim_connection *gc, | 1033 struct gaim_conversation *serv_got_joined_chat(struct gaim_connection *gc, |
1072 int id, char *name) | 1034 int id, char *name) |
1073 { | 1035 { |