comparison src/core.c @ 2443:7f2432a87376

[gaim-migrate @ 2456] it can send ims. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 06 Oct 2001 04:37:34 +0000
parents 2c2c1f717616
children f9cad82d321b
comparison
equal deleted inserted replaced
2442:895e2469cb3a 2443:7f2432a87376
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 plugin_handler(struct UI *ui, guchar subtype, guchar *data)
94 {
95 guint id;
96 struct gaim_plugin *p;
97
98 switch (subtype) {
99 /*
100 case CUI_PLUGIN_LIST:
101 break;
102 */
103 case CUI_PLUGIN_LOAD:
104 p = load_plugin(data);
105 /* XXX need to broadcast to UIs that plugin has been loaded */
106 break;
107 case CUI_PLUGIN_UNLOAD:
108 memcpy(&id, data, sizeof(id));
109 p = g_list_nth_data(plugins, id);
110 if (p) {
111 unload_plugin(p);
112 /* XXX need to broadcast to UIs that plugin has been unloaded */
113 }
114 break;
115 case CUI_PLUGIN_RELOAD:
116 memcpy(&id, data, sizeof(id));
117 p = g_list_nth_data(plugins, id);
118 if (p) {
119 p = reload_plugin(p);
120 /* XXX need to broadcast to UIs that plugin has been reloaded */
121 }
122 break;
123 default:
124 debug_printf("unhandled plugin subtype %d\n", subtype);
125 break;
126 }
127 }
128
93 static void user_handler(struct UI *ui, guchar subtype, guchar *data) 129 static void user_handler(struct UI *ui, guchar subtype, guchar *data)
94 { 130 {
95 guint id; 131 guint id;
96 struct aim_user *u; 132 struct aim_user *u;
97 133
115 serv_login(u); 151 serv_login(u);
116 /* don't need to do anything here because the UI will get updates from other handlers */ 152 /* don't need to do anything here because the UI will get updates from other handlers */
117 break; 153 break;
118 default: 154 default:
119 debug_printf("unhandled user subtype %d\n", subtype); 155 debug_printf("unhandled user subtype %d\n", subtype);
156 break;
157 }
158 }
159
160 static void message_handler(struct UI *ui, guchar subtype, guchar *data)
161 {
162 switch (subtype) {
163 case CUI_MESSAGE_LIST:
164 break;
165 case CUI_MESSAGE_SEND:
166 if (!data)
167 return;
168 {
169 guint id;
170 struct gaim_connection *gc;
171 guint len;
172 char *who, *msg;
173 gint flags;
174 int pos = 0;
175
176 memcpy(&id, data + pos, sizeof(id));
177 pos += sizeof(id);
178 gc = g_slist_nth_data(connections, id);
179 if (!gc)
180 return;
181
182 memcpy(&len, data + pos, sizeof(len));
183 pos += sizeof(len);
184 who = g_strndup(data + pos, len + 1);
185 pos += len;
186
187 memcpy(&len, data + pos, sizeof(len));
188 pos += sizeof(len);
189 msg = g_strndup(data + pos, len + 1);
190 pos += len;
191
192 memcpy(&flags, data + pos, sizeof(flags));
193 serv_send_im(gc, who, msg, flags);
194
195 g_free(who);
196 g_free(msg);
197 }
198 break;
199 case CUI_MESSAGE_RECV:
200 break;
201 default:
202 debug_printf("unhandled message subtype %d\n", subtype);
120 break; 203 break;
121 } 204 }
122 } 205 }
123 206
124 static gint gaim_recv(GIOChannel *source, void *buf, gint len) 207 static gint gaim_recv(GIOChannel *source, void *buf, gint len)