Mercurial > pidgin
comparison src/protocols/zephyr/zephyr.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 |
---|---|
25 | 25 |
26 #ifdef HAVE_CONFIG_H | 26 #ifdef HAVE_CONFIG_H |
27 #include "config.h" | 27 #include "config.h" |
28 #endif | 28 #endif |
29 | 29 |
30 #include <gtk/gtk.h> | |
31 #include <string.h> | 30 #include <string.h> |
32 #include <stdlib.h> | 31 #include <stdlib.h> |
33 #include <errno.h> | 32 #include <errno.h> |
34 #include "gaim.h" | 33 #include "gaim.h" |
35 #include "prpl.h" | 34 #include "prpl.h" |
86 static guint32 loctimer = 0; | 85 static guint32 loctimer = 0; |
87 struct gaim_connection *zgc = NULL; | 86 struct gaim_connection *zgc = NULL; |
88 static GList *pending_zloc_names = NULL; | 87 static GList *pending_zloc_names = NULL; |
89 static GSList *subscrips = NULL; | 88 static GSList *subscrips = NULL; |
90 static int last_id = 0; | 89 static int last_id = 0; |
91 static GtkWidget *class_entry; | |
92 static GtkWidget *inst_entry; | |
93 static GtkWidget *recip_entry; | |
94 | 90 |
95 /* just for debugging | 91 /* just for debugging |
96 static void handle_unknown(ZNotice_t notice) | 92 static void handle_unknown(ZNotice_t notice) |
97 { | 93 { |
98 g_print("z_packet: %s\n", notice.z_packet); | 94 g_print("z_packet: %s\n", notice.z_packet); |
817 m = g_list_append(m, "Hidden"); | 813 m = g_list_append(m, "Hidden"); |
818 | 814 |
819 return m; | 815 return m; |
820 } | 816 } |
821 | 817 |
822 static void zephyr_draw_jc(struct gaim_connection *gc, GtkWidget *vbox) { | 818 static GList *zephyr_chat_info(struct gaim_connection *gc) { |
823 GtkWidget *label; | 819 GList *m = NULL; |
824 GtkWidget *rowbox; | 820 struct proto_chat_entry *pce; |
825 | 821 |
826 rowbox = gtk_hbox_new(FALSE, 5); | 822 pce = g_new0(struct proto_chat_entry, 1); |
827 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0); | 823 pce->label = _("Class:"); |
828 | 824 m = g_list_append(m, NULL); |
829 label = gtk_label_new(_("Class:")); | 825 |
830 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 5); | 826 pce = g_new0(struct proto_chat_entry, 1); |
831 gtk_widget_show(label); | 827 pce->label = _("Instance:"); |
832 | 828 m = g_list_append(m, NULL); |
833 class_entry = gtk_entry_new(); | 829 |
834 gtk_box_pack_end(GTK_BOX(rowbox), class_entry, FALSE, FALSE, 5); | 830 pce = g_new0(struct proto_chat_entry, 1); |
835 gtk_widget_show(class_entry); | 831 pce->label = _("Recipient:"); |
836 | 832 m = g_list_append(m, NULL); |
837 gtk_widget_show(rowbox); | 833 |
838 | 834 return m; |
839 rowbox = gtk_hbox_new(FALSE, 5); | 835 } |
840 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0); | 836 |
841 | 837 static void zephyr_join_chat(struct gaim_connection *gc, GList *data) |
842 label = gtk_label_new(_("Instance:")); | |
843 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 5); | |
844 gtk_widget_show(label); | |
845 | |
846 inst_entry = gtk_entry_new(); | |
847 gtk_box_pack_end(GTK_BOX(rowbox), inst_entry, FALSE, FALSE, 5); | |
848 gtk_widget_show(inst_entry); | |
849 | |
850 gtk_widget_show(rowbox); | |
851 | |
852 rowbox = gtk_hbox_new(FALSE, 5); | |
853 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0); | |
854 | |
855 label = gtk_label_new(_("Recipient:")); | |
856 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 5); | |
857 gtk_widget_show(label); | |
858 | |
859 recip_entry = gtk_entry_new(); | |
860 gtk_box_pack_end(GTK_BOX(rowbox), recip_entry, FALSE, FALSE, 5); | |
861 gtk_widget_show(recip_entry); | |
862 | |
863 gtk_widget_show(rowbox); | |
864 } | |
865 | |
866 static void zephyr_join_chat(struct gaim_connection *gc, int id, char *nm) | |
867 { | 838 { |
868 ZSubscription_t sub; | 839 ZSubscription_t sub; |
869 zephyr_triple *zt1, *zt2; | 840 zephyr_triple *zt1, *zt2; |
870 const char *classname; | 841 const char *classname; |
871 const char *instname; | 842 const char *instname; |
872 const char *recip; | 843 const char *recip; |
873 char **splitted; | 844 |
874 | 845 if (!data || !data->next || !data->next->next) |
875 if (!nm) { | 846 return; |
876 splitted = NULL; | 847 |
877 classname = gtk_entry_get_text(GTK_ENTRY(class_entry)); | 848 classname = data->data; |
878 instname = gtk_entry_get_text(GTK_ENTRY(inst_entry)); | 849 instname = data->next->data; |
879 recip = gtk_entry_get_text(GTK_ENTRY(recip_entry)); | 850 recip = data->next->next->data; |
880 if (!g_strcasecmp(recip, "%me%")) | 851 if (!g_strcasecmp(recip, "%me%")) |
881 recip = g_getenv("USER"); | 852 recip = g_getenv("USER"); |
882 } else { | |
883 splitted = g_strsplit(nm, ",", 3); | |
884 if (!splitted[0] || !splitted[1] || !splitted[2]) { | |
885 g_strfreev(splitted); | |
886 return; | |
887 } | |
888 classname = g_strstrip(splitted[0]); | |
889 instname = g_strstrip(splitted[1]); | |
890 recip = g_strstrip(splitted[2]); | |
891 } | |
892 | 853 |
893 zt1 = new_triple(classname, instname, recip); | 854 zt1 = new_triple(classname, instname, recip); |
894 if (splitted) | |
895 g_strfreev(splitted); | |
896 zt2 = find_sub_by_triple(zt1); | 855 zt2 = find_sub_by_triple(zt1); |
897 if (zt2) { | 856 if (zt2) { |
898 free_triple(zt1); | 857 free_triple(zt1); |
899 if (!zt2->open) | 858 if (!zt2->open) |
900 serv_got_joined_chat(gc, zt2->id, zt2->name); | 859 serv_got_joined_chat(gc, zt2->id, zt2->name); |
940 ret->get_info = zephyr_zloc; | 899 ret->get_info = zephyr_zloc; |
941 ret->normalize = zephyr_normalize; | 900 ret->normalize = zephyr_normalize; |
942 ret->buddy_menu = zephyr_buddy_menu; | 901 ret->buddy_menu = zephyr_buddy_menu; |
943 ret->away_states = zephyr_away_states; | 902 ret->away_states = zephyr_away_states; |
944 ret->set_away = zephyr_set_away; | 903 ret->set_away = zephyr_set_away; |
945 ret->draw_join_chat = zephyr_draw_jc; | 904 ret->chat_info = zephyr_chat_info; |
946 ret->join_chat = zephyr_join_chat; | 905 ret->join_chat = zephyr_join_chat; |
947 ret->chat_send = zephyr_chat_send; | 906 ret->chat_send = zephyr_chat_send; |
948 ret->chat_leave = zephyr_chat_leave; | 907 ret->chat_leave = zephyr_chat_leave; |
949 | 908 |
950 my_protocol = ret; | 909 my_protocol = ret; |