comparison src/buddy_chat.c @ 5234:890b29f00b68

[gaim-migrate @ 5604] Chats in the buddy list! You can now put chat rooms in your buddy list, and double-click them to join them, instead of having to do all that typing. I'm eventually gonna add auto-join support, so that ugly hack involving pouncing can go away. Someone should make some new artwork so we don't have 2 + icons next to each other in the menus. This also has some fixes to let gaim compile again, after the renaming of the buddy list files. This also fixes the problem with offline buddies not showing up in the list sometimes for accounts that didn't log in at startup. This probably fixes other stuff, but I can't remember any of it off the top of my head. I'm going to stop typing and let people play with this now. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 26 Apr 2003 20:30:43 +0000
parents fefad67de2c7
children ad445074d239
comparison
equal deleted inserted replaced
5233:202105dbed8f 5234:890b29f00b68
28 #include <ctype.h> 28 #include <ctype.h>
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <gtk/gtk.h> 31 #include <gtk/gtk.h>
32 #include "gtkimhtml.h" 32 #include "gtkimhtml.h"
33 #ifdef USE_GTKSPELL
34 #include <gtkspell/gtkspell.h>
35 #endif
36 #include <gdk/gdkkeysyms.h>
37 33
38 #include "prpl.h" 34 #include "prpl.h"
39 35
40 #ifdef _WIN32 36 #ifdef _WIN32
41 #include "wspell.h" 37 #include "wspell.h"
48 44
49 static void 45 static void
50 do_join_chat() 46 do_join_chat()
51 { 47 {
52 if (joinchat) { 48 if (joinchat) {
53 GList *data = NULL; 49 GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal,
50 g_free, g_free);
54 GList *tmp; 51 GList *tmp;
55 int *ival;
56 char *sval;
57 52
58 for (tmp = chatentries; tmp != NULL; tmp = tmp->next) { 53 for (tmp = chatentries; tmp != NULL; tmp = tmp->next) {
59 if (g_object_get_data(tmp->data, "is_spin")) { 54 if (g_object_get_data(tmp->data, "is_spin")) {
60 ival = g_new0(int, 1); 55 g_hash_table_replace(components,
61 *ival = gtk_spin_button_get_value_as_int(tmp->data); 56 g_strdup(g_object_get_data(tmp->data, "identifier")),
62 data = g_list_append(data, ival); 57 g_strdup_printf("%d",
58 gtk_spin_button_get_value_as_int(tmp->data)));
63 } 59 }
64 else { 60 else {
65 sval = g_strdup(gtk_entry_get_text(tmp->data)); 61 g_hash_table_replace(components,
66 data = g_list_append(data, sval); 62 g_strdup(g_object_get_data(tmp->data, "identifier")),
63 g_strdup(gtk_entry_get_text(tmp->data)));
67 } 64 }
68 } 65 }
69 66
70 serv_join_chat(joinchatgc, data); 67 serv_join_chat(joinchatgc, components);
71 68
72 for (tmp = data; tmp != NULL; tmp = tmp->next) 69 g_hash_table_destroy(components);
73 g_free(tmp->data);
74
75 g_list_free(data);
76 70
77 gtk_widget_destroy(joinchat); 71 gtk_widget_destroy(joinchat);
78 72
79 if (chatentries) 73 if (chatentries)
80 g_list_free(chatentries); 74 g_list_free(chatentries);
124 GtkWidget *spin; 118 GtkWidget *spin;
125 adjust = gtk_adjustment_new(pce->min, pce->min, 119 adjust = gtk_adjustment_new(pce->min, pce->min,
126 pce->max, 1, 10, 10); 120 pce->max, 1, 10, 10);
127 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); 121 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
128 g_object_set_data(G_OBJECT(spin), "is_spin", GINT_TO_POINTER(TRUE)); 122 g_object_set_data(G_OBJECT(spin), "is_spin", GINT_TO_POINTER(TRUE));
123 g_object_set_data(G_OBJECT(spin), "identifier", pce->identifier);
129 chatentries = g_list_append(chatentries, spin); 124 chatentries = g_list_append(chatentries, spin);
130 gtk_widget_set_size_request(spin, 50, -1); 125 gtk_widget_set_size_request(spin, 50, -1);
131 gtk_box_pack_end(GTK_BOX(rowbox), spin, FALSE, FALSE, 0); 126 gtk_box_pack_end(GTK_BOX(rowbox), spin, FALSE, FALSE, 0);
132 gtk_widget_show(spin); 127 gtk_widget_show(spin);
133 } 128 }
147 focus = FALSE; 142 focus = FALSE;
148 } 143 }
149 144
150 g_signal_connect(G_OBJECT(entry), "activate", 145 g_signal_connect(G_OBJECT(entry), "activate",
151 G_CALLBACK(do_join_chat), NULL); 146 G_CALLBACK(do_join_chat), NULL);
147 g_object_set_data(G_OBJECT(entry), "identifier", pce->identifier);
152 148
153 gtk_widget_show(entry); 149 gtk_widget_show(entry);
154 } 150 }
155 151
156 g_free(pce); 152 g_free(pce);
163 joinchat_choose(GtkWidget *w, struct gaim_connection *g) 159 joinchat_choose(GtkWidget *w, struct gaim_connection *g)
164 { 160 {
165 if (joinchatgc == g) 161 if (joinchatgc == g)
166 return; 162 return;
167 163
168 joinchatgc = g; 164 if(joinchatgc->account->protocol == g->account->protocol) {
169 165 joinchatgc = g;
170 rebuild_jc(); 166 } else {
167 joinchatgc = g;
168 rebuild_jc();
169 }
171 } 170 }
172 171
173 static void 172 static void
174 create_joinchat_menu(GtkWidget *box) 173 create_joinchat_menu(GtkWidget *box)
175 { 174 {