comparison src/core.c @ 2435:b4f2a53c0ee5

[gaim-migrate @ 2448] more splits committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 05 Oct 2001 22:06:27 +0000
parents 0ba75351a01b
children 5cbe86a444d9
comparison
equal deleted inserted replaced
2434:20d1c2c945c9 2435:b4f2a53c0ee5
41 struct UI { 41 struct UI {
42 GIOChannel *channel; 42 GIOChannel *channel;
43 guint inpa; 43 guint inpa;
44 }; 44 };
45 GSList *uis = NULL; 45 GSList *uis = NULL;
46
47 gint UI_write(struct UI *ui, guchar *data, gint len)
48 {
49 guchar *send = g_new0(guchar, len + 6);
50 gint sent;
51 send[0] = 'f';
52 send[1] = 1;
53 memcpy(send + 2, &len, sizeof(len));
54 memcpy(send + 6, data, len);
55 /* we'll let the write silently fail because the read will pick it up as dead */
56 g_io_channel_write(ui->channel, send, len + 6, &sent);
57 return sent;
58 }
59
60 void UI_broadcast(guchar *data, gint len)
61 {
62 GSList *u = uis;
63 while (u) {
64 struct UI *ui = u->data;
65 UI_write(ui, data, len);
66 u = u->next;
67 }
68 }
46 69
47 static gint gaim_recv(GIOChannel *source, guchar *buf, gint len) 70 static gint gaim_recv(GIOChannel *source, guchar *buf, gint len)
48 { 71 {
49 gint total = 0; 72 gint total = 0;
50 gint cur; 73 gint cur;