Mercurial > pidgin
comparison src/protocols/toc/toc.c @ 2205:cff4fbe01c7b
[gaim-migrate @ 2215]
eric@blue:~/gaim/app/src/protocols $ cat gtk
for i in icq irc jabber msn napster oscar toc yahoo zephyr
do
echo -n $i:
grep -i g\[td\]k $i/*.c | wc -l
done
eric@blue:~/gaim/app/src/protocols $ ./gtk
icq: 13
irc: 0
jabber: 59
msn: 0
napster: 106
oscar: 13
toc: 25
yahoo: 15
zephyr: 2
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Fri, 31 Aug 2001 20:36:11 +0000 |
| parents | c24595d3c364 |
| children | 8c4ff1a368bd |
comparison
equal
deleted
inserted
replaced
| 2204:5014b802eb41 | 2205:cff4fbe01c7b |
|---|---|
| 120 }; | 120 }; |
| 121 | 121 |
| 122 /* constants to identify proto_opts */ | 122 /* constants to identify proto_opts */ |
| 123 #define USEROPT_AUTH 0 | 123 #define USEROPT_AUTH 0 |
| 124 #define USEROPT_AUTHPORT 1 | 124 #define USEROPT_AUTHPORT 1 |
| 125 | |
| 126 static GtkWidget *join_chat_spin = NULL; | |
| 127 static GtkWidget *join_chat_entry = NULL; | |
| 128 | 125 |
| 129 static void toc_login_callback(gpointer, gint, GaimInputCondition); | 126 static void toc_login_callback(gpointer, gint, GaimInputCondition); |
| 130 static void toc_callback(gpointer, gint, GaimInputCondition); | 127 static void toc_callback(gpointer, gint, GaimInputCondition); |
| 131 static unsigned char *roast_password(char *); | 128 static unsigned char *roast_password(char *); |
| 132 static void accept_file_dialog(struct ft_request *); | 129 static void accept_file_dialog(struct ft_request *); |
| 544 else | 541 else |
| 545 while ((buddy = strtok(NULL, ":")) != NULL) | 542 while ((buddy = strtok(NULL, ":")) != NULL) |
| 546 remove_chat_buddy(b, buddy); | 543 remove_chat_buddy(b, buddy); |
| 547 } else if (!strcasecmp(c, "CHAT_INVITE")) { | 544 } else if (!strcasecmp(c, "CHAT_INVITE")) { |
| 548 char *name, *who, *message; | 545 char *name, *who, *message; |
| 549 int id; | 546 int *id = g_new0(int, 1); |
| 550 | 547 |
| 551 name = strtok(NULL, ":"); | 548 name = strtok(NULL, ":"); |
| 552 sscanf(strtok(NULL, ":"), "%d", &id); | 549 sscanf(strtok(NULL, ":"), "%d", id); |
| 553 who = strtok(NULL, ":"); | 550 who = strtok(NULL, ":"); |
| 554 message = strtok(NULL, ":"); | 551 message = strtok(NULL, ":"); |
| 555 | 552 |
| 556 serv_got_chat_invite(gc, name, id, who, message); | 553 serv_got_chat_invite(gc, name, who, message, g_list_append(NULL, id)); |
| 557 } else if (!strcasecmp(c, "CHAT_LEFT")) { | 554 } else if (!strcasecmp(c, "CHAT_LEFT")) { |
| 558 GSList *bcs = gc->buddy_chats; | 555 GSList *bcs = gc->buddy_chats; |
| 559 struct conversation *b = NULL; | 556 struct conversation *b = NULL; |
| 560 int id; | 557 int id; |
| 561 | 558 |
| 880 char send[BUF_LEN * 2]; | 877 char send[BUF_LEN * 2]; |
| 881 g_snprintf(send, 255, "toc_evil %s %s", name, ((anon) ? "anon" : "norm")); | 878 g_snprintf(send, 255, "toc_evil %s %s", name, ((anon) ? "anon" : "norm")); |
| 882 sflap_send(g, send, -1, TYPE_DATA); | 879 sflap_send(g, send, -1, TYPE_DATA); |
| 883 } | 880 } |
| 884 | 881 |
| 885 static void toc_accept_chat(struct gaim_connection *g, int i) | 882 static GList *toc_chat_info(struct gaim_connection *gc) |
| 886 { | 883 { |
| 887 char buf[BUF_LEN * 2]; | 884 GList *m = NULL; |
| 888 g_snprintf(buf, 255, "toc_chat_accept %d", i); | 885 struct proto_chat_entry *pce; |
| 889 sflap_send(g, buf, -1, TYPE_DATA); | 886 |
| 890 } | 887 pce = g_new0(struct proto_chat_entry, 1); |
| 891 | 888 pce->label = _("Join what group:"); |
| 892 static void toc_join_chat(struct gaim_connection *g, int exchange, char *name) | 889 m = g_list_append(m, pce); |
| 890 | |
| 891 pce = g_new0(struct proto_chat_entry, 1); | |
| 892 pce->label = _("Exchange:"); | |
| 893 pce->is_int = TRUE; | |
| 894 pce->min = 4; | |
| 895 pce->max = 20; | |
| 896 m = g_list_append(m, pce); | |
| 897 | |
| 898 return m; | |
| 899 } | |
| 900 | |
| 901 static void toc_join_chat(struct gaim_connection *g, GList *data) | |
| 893 { | 902 { |
| 894 char buf[BUF_LONG]; | 903 char buf[BUF_LONG]; |
| 895 if (!name) { | 904 int *exchange; |
| 896 const char *nm; | 905 char *name; |
| 897 if (!join_chat_entry || !join_chat_spin) | 906 int *i; |
| 898 return; | 907 |
| 899 nm = gtk_entry_get_text(GTK_ENTRY(join_chat_entry)); | 908 if (!data) |
| 900 exchange = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(join_chat_spin)); | 909 return; |
| 901 if (!nm || !strlen(nm)) | 910 |
| 902 return; | 911 if (!data->next) { |
| 903 g_snprintf(buf, sizeof(buf) / 2, "toc_chat_join %d \"%s\"", exchange, nm); | 912 i = data->data; |
| 904 } else | 913 g_snprintf(buf, 255, "toc_chat_accept %d", *i); |
| 905 g_snprintf(buf, sizeof(buf) / 2, "toc_chat_join %d \"%s\"", exchange, name); | 914 } else { |
| 915 name = data->data; | |
| 916 exchange = data->next->data; | |
| 917 g_snprintf(buf, sizeof(buf) / 2, "toc_chat_join %d \"%s\"", *exchange, name); | |
| 918 } | |
| 919 | |
| 906 sflap_send(g, buf, -1, TYPE_DATA); | 920 sflap_send(g, buf, -1, TYPE_DATA); |
| 907 } | 921 } |
| 908 | 922 |
| 909 static void toc_chat_invite(struct gaim_connection *g, int id, char *message, char *name) | 923 static void toc_chat_invite(struct gaim_connection *g, int id, char *message, char *name) |
| 910 { | 924 { |
| 972 if (uc & UC_ADMIN) | 986 if (uc & UC_ADMIN) |
| 973 return (char **)admin_icon_xpm; | 987 return (char **)admin_icon_xpm; |
| 974 if (uc & UC_UNCONFIRMED) | 988 if (uc & UC_UNCONFIRMED) |
| 975 return (char **)dt_icon_xpm; | 989 return (char **)dt_icon_xpm; |
| 976 return NULL; | 990 return NULL; |
| 977 } | |
| 978 | |
| 979 static void des_jc() | |
| 980 { | |
| 981 join_chat_entry = NULL; | |
| 982 join_chat_spin = NULL; | |
| 983 } | |
| 984 | |
| 985 static void toc_draw_join_chat(struct gaim_connection *gc, GtkWidget *fbox) { | |
| 986 GtkWidget *label; | |
| 987 GtkWidget *rowbox; | |
| 988 GtkObject *adjust; | |
| 989 | |
| 990 rowbox = gtk_hbox_new(FALSE, 5); | |
| 991 gtk_box_pack_start(GTK_BOX(fbox), rowbox, TRUE, TRUE, 0); | |
| 992 gtk_widget_show(rowbox); | |
| 993 | |
| 994 label = gtk_label_new(_("Join what group:")); | |
| 995 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0); | |
| 996 gtk_signal_connect(GTK_OBJECT(label), "destroy", GTK_SIGNAL_FUNC(des_jc), NULL); | |
| 997 gtk_widget_show(label); | |
| 998 | |
| 999 join_chat_entry = gtk_entry_new(); | |
| 1000 gtk_box_pack_start(GTK_BOX(rowbox), join_chat_entry, TRUE, TRUE, 0); | |
| 1001 gtk_widget_grab_focus(join_chat_entry); | |
| 1002 gtk_signal_connect(GTK_OBJECT(join_chat_entry), "activate", GTK_SIGNAL_FUNC(do_join_chat), NULL); | |
| 1003 gtk_widget_show(join_chat_entry); | |
| 1004 | |
| 1005 rowbox = gtk_hbox_new(FALSE, 5); | |
| 1006 gtk_box_pack_start(GTK_BOX(fbox), rowbox, TRUE, TRUE, 0); | |
| 1007 gtk_widget_show(rowbox); | |
| 1008 | |
| 1009 label = gtk_label_new(_("Community:")); | |
| 1010 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0); | |
| 1011 gtk_widget_show(label); | |
| 1012 | |
| 1013 adjust = gtk_adjustment_new(4, 4, 20, 1, 10, 10); | |
| 1014 join_chat_spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); | |
| 1015 gtk_widget_set_usize(join_chat_spin, 50, -1); | |
| 1016 gtk_box_pack_start(GTK_BOX(rowbox), join_chat_spin, FALSE, FALSE, 0); | |
| 1017 gtk_widget_show(join_chat_spin); | |
| 1018 } | 991 } |
| 1019 | 992 |
| 1020 static GList *toc_buddy_menu(struct gaim_connection *gc, char *who) | 993 static GList *toc_buddy_menu(struct gaim_connection *gc, char *who) |
| 1021 { | 994 { |
| 1022 GList *m = NULL; | 995 GList *m = NULL; |
| 1234 ret->add_deny = toc_add_deny; | 1207 ret->add_deny = toc_add_deny; |
| 1235 ret->rem_permit = toc_rem_permit; | 1208 ret->rem_permit = toc_rem_permit; |
| 1236 ret->rem_deny = toc_rem_deny; | 1209 ret->rem_deny = toc_rem_deny; |
| 1237 ret->set_permit_deny = toc_set_permit_deny; | 1210 ret->set_permit_deny = toc_set_permit_deny; |
| 1238 ret->warn = toc_warn; | 1211 ret->warn = toc_warn; |
| 1239 ret->draw_join_chat = toc_draw_join_chat; | 1212 ret->chat_info = toc_chat_info; |
| 1240 ret->accept_chat = toc_accept_chat; | |
| 1241 ret->join_chat = toc_join_chat; | 1213 ret->join_chat = toc_join_chat; |
| 1242 ret->chat_invite = toc_chat_invite; | 1214 ret->chat_invite = toc_chat_invite; |
| 1243 ret->chat_leave = toc_chat_leave; | 1215 ret->chat_leave = toc_chat_leave; |
| 1244 ret->chat_whisper = toc_chat_whisper; | 1216 ret->chat_whisper = toc_chat_whisper; |
| 1245 ret->chat_send = toc_chat_send; | 1217 ret->chat_send = toc_chat_send; |
