comparison src/core.c @ 2441:2c2c1f717616

[gaim-migrate @ 2454] you can sign people on now. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 06 Oct 2001 02:49:18 +0000
parents 8306c042bac7
children 7f2432a87376
comparison
equal deleted inserted replaced
2440:8306c042bac7 2441:2c2c1f717616
88 debug_printf("unhandled meta subtype %d\n", subtype); 88 debug_printf("unhandled meta subtype %d\n", subtype);
89 break; 89 break;
90 } 90 }
91 } 91 }
92 92
93 static void user_handler(struct UI *ui, guchar subtype, guchar *data)
94 {
95 guint id;
96 struct aim_user *u;
97
98 switch (subtype) {
99 /*
100 case CUI_USER_LIST:
101 break;
102 case CUI_USER_ADD:
103 break;
104 case CUI_USER_REMOVE:
105 break;
106 case CUI_USER_MODIFY:
107 break;
108 */
109 case CUI_USER_SIGNON:
110 if (!data)
111 return;
112 memcpy(&id, data, sizeof(id));
113 u = g_slist_nth_data(aim_users, id);
114 if (u)
115 serv_login(u);
116 /* don't need to do anything here because the UI will get updates from other handlers */
117 break;
118 default:
119 debug_printf("unhandled user subtype %d\n", subtype);
120 break;
121 }
122 }
123
93 static gint gaim_recv(GIOChannel *source, void *buf, gint len) 124 static gint gaim_recv(GIOChannel *source, void *buf, gint len)
94 { 125 {
95 gint total = 0; 126 gint total = 0;
96 gint cur; 127 gint cur;
97 128
142 g_source_remove(ui->inpa); 173 g_source_remove(ui->inpa);
143 g_free(ui); 174 g_free(ui);
144 return FALSE; 175 return FALSE;
145 } 176 }
146 177
147 in = g_new0(guchar, len); 178 if (len) {
148 if (gaim_recv(source, in, len) != len) { 179 in = g_new0(guchar, len);
149 debug_printf("UI has abandoned us!\n"); 180 if (gaim_recv(source, in, len) != len) {
150 uis = g_slist_remove(uis, ui); 181 debug_printf("UI has abandoned us!\n");
151 g_io_channel_close(ui->channel); 182 uis = g_slist_remove(uis, ui);
152 g_source_remove(ui->inpa); 183 g_io_channel_close(ui->channel);
153 g_free(ui); 184 g_source_remove(ui->inpa);
154 return FALSE; 185 g_free(ui);
155 } 186 return FALSE;
187 }
188 } else
189 in = NULL;
156 190
157 switch (type) { 191 switch (type) {
158 case CUI_TYPE_META: 192 case CUI_TYPE_META:
159 meta_handler(ui, subtype, in); 193 meta_handler(ui, subtype, in);
160 break; 194 break;
161 case CUI_TYPE_PLUGIN: 195 case CUI_TYPE_PLUGIN:
162 plugin_handler(ui, subtype, in); 196 plugin_handler(ui, subtype, in);
163 break; 197 break;
164 /*
165 case CUI_TYPE_USER: 198 case CUI_TYPE_USER:
166 user_handler(ui, subtype, in); 199 user_handler(ui, subtype, in);
167 break; 200 break;
201 /*
168 case CUI_TYPE_CONN: 202 case CUI_TYPE_CONN:
169 conn_handler(ui, subtype, in); 203 conn_handler(ui, subtype, in);
170 break; 204 break;
171 case CUI_TYPE_BUDDY: 205 case CUI_TYPE_BUDDY:
172 buddy_handler(ui, subtype, in); 206 buddy_handler(ui, subtype, in);
181 default: 215 default:
182 debug_printf("unhandled type %d\n", type); 216 debug_printf("unhandled type %d\n", type);
183 break; 217 break;
184 } 218 }
185 219
186 g_free(in); 220 if (in)
221 g_free(in);
187 return TRUE; 222 return TRUE;
188 } 223 }
189 224
190 static gboolean socket_readable(GIOChannel *source, GIOCondition cond, gpointer data) 225 static gboolean socket_readable(GIOChannel *source, GIOCondition cond, gpointer data)
191 { 226 {