Mercurial > pidgin
annotate plugins/icq/gaim_icq.c @ 2011:8195d67364a4
[gaim-migrate @ 2021]
ha
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 13 Jun 2001 23:13:06 +0000 |
parents | 8ed70631ed15 |
children | 5748a6faa461 |
rev | line source |
---|---|
1152 | 1 #include <gtk/gtk.h> |
1167
5d1ded9f88b7
[gaim-migrate @ 1177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
2 #include <string.h> |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
3 #include <stdlib.h> |
1152 | 4 #include "icq.h" /* well, we're doing ICQ, right? */ |
5 #include "multi.h" /* needed for gaim_connection */ | |
6 #include "prpl.h" /* needed for prpl */ | |
7 #include "gaim.h" /* needed for every other damn thing */ | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
8 #include "proxy.h" |
1152 | 9 |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
10 #include "pixmaps/gnomeicu-online.xpm" |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
11 #include "pixmaps/gnomeicu-away.xpm" |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
12 #include "pixmaps/gnomeicu-dnd.xpm" |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
13 #include "pixmaps/gnomeicu-na.xpm" |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
14 #include "pixmaps/gnomeicu-occ.xpm" |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
15 #include "pixmaps/gnomeicu-ffc.xpm" |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
16 |
1336
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
17 #define USEROPT_NICK 0 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
18 |
1152 | 19 struct icq_data { |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
20 icq_Link *link; |
1152 | 21 int cur_status; |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
22 GSList *thru_serv; |
1152 | 23 }; |
24 | |
1498
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
25 static guint ack_timer = 0; |
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
26 |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
27 static struct gaim_connection *find_gaim_conn_by_icq_link(icq_Link *link) { |
1152 | 28 GSList *c = connections; |
29 struct gaim_connection *gc = NULL; | |
30 struct icq_data *id; | |
31 | |
32 while (c) { | |
33 gc = (struct gaim_connection *)c->data; | |
34 if (gc->protocol == PROTO_ICQ) { | |
35 id = (struct icq_data *)gc->proto_data; | |
36 if (id->link == link) | |
37 break; | |
38 } | |
39 gc = NULL; | |
40 c = c->next; | |
41 } | |
42 | |
43 return gc; | |
44 } | |
45 | |
46 static char *icq_name() { | |
47 return "ICQ"; | |
48 } | |
49 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
50 static void icq_do_log(icq_Link *link, time_t time, unsigned char level, const char *log) { |
1152 | 51 debug_printf("ICQ debug %d: %s", level, log); |
52 } | |
53 | |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
54 GList *sockets = NULL; |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
55 struct gaim_sock { |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
56 int socket; |
1531
e06dcc3025a9
[gaim-migrate @ 1541]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
57 int type; |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
58 gint inpa; |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
59 }; |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
60 |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
61 static void gaim_icq_handler(gpointer data, gint source, GdkInputCondition cond) { |
1531
e06dcc3025a9
[gaim-migrate @ 1541]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
62 if (cond & GDK_INPUT_READ) |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
63 icq_HandleReadySocket(source, ICQ_SOCKET_READ); |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
64 if (cond & GDK_INPUT_WRITE) |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
65 icq_HandleReadySocket(source, ICQ_SOCKET_WRITE); |
1152 | 66 } |
67 | |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
68 static void icq_sock_notify(int socket, int type, int status) { |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
69 struct gaim_sock *gs; |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
70 if (status) { |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
71 GdkInputCondition cond; |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
72 if (type == ICQ_SOCKET_READ) |
1531
e06dcc3025a9
[gaim-migrate @ 1541]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
73 cond = GDK_INPUT_READ; |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
74 else |
1531
e06dcc3025a9
[gaim-migrate @ 1541]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
75 cond = GDK_INPUT_WRITE; |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
76 gs = g_new0(struct gaim_sock, 1); |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
77 gs->socket = socket; |
1531
e06dcc3025a9
[gaim-migrate @ 1541]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
78 gs->type = type; |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
79 gs->inpa = gdk_input_add(socket, cond, gaim_icq_handler, NULL); |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
80 sockets = g_list_append(sockets, gs); |
1531
e06dcc3025a9
[gaim-migrate @ 1541]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
81 debug_printf("Adding socket notifier: %d %d (%d)\n", socket, type, gs->inpa); |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
82 } else { |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
83 GList *m = sockets; |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
84 while (m) { |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
85 gs = m->data; |
1531
e06dcc3025a9
[gaim-migrate @ 1541]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
86 if ((gs->socket == socket) && (gs->type == type)) |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
87 break; |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
88 m = g_list_next(m); |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
89 } |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
90 if (m) { |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
91 gdk_input_remove(gs->inpa); |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
92 sockets = g_list_remove(sockets, gs); |
1531
e06dcc3025a9
[gaim-migrate @ 1541]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
93 debug_printf("Removing socket notifier: %d %d (%d)\n", socket, type, gs->inpa); |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
94 g_free(gs); |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
95 } |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
96 } |
1152 | 97 } |
98 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
99 static void icq_online(icq_Link *link) { |
1152 | 100 struct gaim_connection *gc = find_gaim_conn_by_icq_link(link); |
101 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
102 debug_printf("%s is now online.\n", gc->username); | |
103 account_online(gc); | |
1772
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1766
diff
changeset
|
104 /*gc->options |= OPT_USR_KEEPALV; this is always-on now */ |
1152 | 105 serv_finish_login(gc); |
106 | |
107 icq_ChangeStatus(id->link, STATUS_ONLINE); | |
108 } | |
109 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
110 static void icq_logged_off(icq_Link *link) { |
1152 | 111 struct gaim_connection *gc = find_gaim_conn_by_icq_link(link); |
112 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
113 | |
114 if (icq_Connect(link, "icq.mirabilis.com", 4000) < 1) { | |
115 hide_login_progress(gc, "Unable to connect"); | |
116 signoff(gc); | |
117 return; | |
118 } | |
119 | |
120 icq_Login(link, STATUS_ONLINE); | |
121 id->cur_status = STATUS_ONLINE; | |
122 } | |
123 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
124 static void icq_msg_incoming(icq_Link *link, unsigned long uin, unsigned char hour, unsigned char minute, |
1152 | 125 unsigned char day, unsigned char month, unsigned short year, const char *data) { |
126 struct gaim_connection *gc = find_gaim_conn_by_icq_link(link); | |
1487
7bb7eca3fa14
[gaim-migrate @ 1497]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
127 char buf[256], *tmp = g_malloc(BUF_LONG); |
7bb7eca3fa14
[gaim-migrate @ 1497]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
128 g_snprintf(tmp, BUF_LONG, "%s", data); |
1152 | 129 g_snprintf(buf, sizeof buf, "%lu", uin); |
1766
a247305b835f
[gaim-migrate @ 1776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1765
diff
changeset
|
130 serv_got_im(gc, buf, tmp, 0, time((time_t)NULL)); |
1152 | 131 g_free(tmp); |
132 } | |
133 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
134 static void icq_user_online(icq_Link *link, unsigned long uin, unsigned long st, |
1152 | 135 unsigned long ip, unsigned short port, unsigned long real_ip, |
136 unsigned char tcp_flags) { | |
137 struct gaim_connection *gc = find_gaim_conn_by_icq_link(link); | |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
138 guint status; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
139 char buf[256]; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
140 |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
141 g_snprintf(buf, sizeof buf, "%lu", uin); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
142 status = (st == STATUS_ONLINE) ? UC_NORMAL : UC_UNAVAILABLE | (st << 5); |
1496
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1493
diff
changeset
|
143 serv_got_update(gc, buf, 1, 0, 0, 0, status, 0); |
1152 | 144 } |
145 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
146 static void icq_user_offline(icq_Link *link, unsigned long uin) { |
1152 | 147 struct gaim_connection *gc = find_gaim_conn_by_icq_link(link); |
148 char buf[256]; g_snprintf(buf, sizeof buf, "%lu", uin); | |
149 serv_got_update(gc, buf, 0, 0, 0, 0, 0, 0); | |
150 } | |
151 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
152 static void icq_user_status(icq_Link *link, unsigned long uin, unsigned long st) { |
1152 | 153 struct gaim_connection *gc = find_gaim_conn_by_icq_link(link); |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
154 guint status; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
155 char buf[256]; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
156 |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
157 g_snprintf(buf, sizeof buf, "%lu", uin); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
158 status = (st == STATUS_ONLINE) ? UC_NORMAL : UC_UNAVAILABLE | (st << 5); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
159 serv_got_update(gc, buf, 1, 0, 0, 0, status, 0); |
1152 | 160 } |
161 | |
1498
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
162 static gint icq_set_timeout_cb() { |
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
163 icq_HandleTimeout(); |
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
164 ack_timer = 0; |
1152 | 165 return FALSE; |
166 } | |
167 | |
1498
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
168 static void icq_set_timeout(long interval) { |
1152 | 169 debug_printf("icq_SetTimeout: %ld\n", interval); |
1498
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
170 if (interval > 0 && ack_timer == 0) |
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
171 ack_timer = gtk_timeout_add(interval * 1000, (GtkFunction)icq_set_timeout_cb, NULL); |
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
172 else if (ack_timer > 0) { |
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
173 gtk_timeout_remove(ack_timer); |
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
174 ack_timer = 0; |
1152 | 175 } |
176 } | |
177 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
178 static void icq_url_incoming(icq_Link *link, unsigned long uin, unsigned char hour, |
1152 | 179 unsigned char minute, unsigned char day, unsigned char month, |
180 unsigned short year, const char *url, const char *descr) { | |
181 struct gaim_connection *gc = find_gaim_conn_by_icq_link(link); | |
1487
7bb7eca3fa14
[gaim-migrate @ 1497]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
182 char *msg = g_malloc(BUF_LONG), buf[256]; |
7bb7eca3fa14
[gaim-migrate @ 1497]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
183 g_snprintf(msg, BUF_LONG, "<A HREF=\"%s\">%s</A>", url, descr); |
1152 | 184 g_snprintf(buf, 256, "%lu", uin); |
1766
a247305b835f
[gaim-migrate @ 1776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1765
diff
changeset
|
185 serv_got_im(gc, buf, msg, 0, time((time_t)NULL)); |
1152 | 186 g_free(msg); |
187 } | |
188 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
189 static void icq_wrong_passwd(icq_Link *link) { |
1152 | 190 struct gaim_connection *gc = find_gaim_conn_by_icq_link(link); |
191 hide_login_progress(gc, "Invalid password."); | |
192 signoff(gc); | |
193 } | |
194 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
195 static void icq_invalid_uin(icq_Link *link) { |
1152 | 196 struct gaim_connection *gc = find_gaim_conn_by_icq_link(link); |
197 hide_login_progress(gc, "Invalid UIN."); | |
198 signoff(gc); | |
199 } | |
200 | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
201 static void icq_info_reply(icq_Link *link, unsigned long uin, const char *nick, |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
202 const char *first, const char *last, const char *email, char auth) { |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
203 char buf[16 * 1024]; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
204 |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
205 g_snprintf(buf, sizeof buf, |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
206 "<B>UIN:</B> %lu<BR>" |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
207 "<B>Nick:</B> %s<BR>" |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
208 "<B>Name:</B> %s %s<BR>" |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
209 "<B>Email:</B> %s\n", |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
210 uin, |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
211 nick, |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
212 first, last, |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
213 email); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
214 g_show_info_text(buf); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
215 } |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
216 |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
217 static void icq_web_pager(icq_Link *link, unsigned char hour, unsigned char minute, |
1336
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
218 unsigned char day, unsigned char month, unsigned short year, const char *nick, |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
219 const char *email, const char *msg) { |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
220 struct gaim_connection *gc = find_gaim_conn_by_icq_link(link); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
221 char *who = g_strdup_printf("ICQ Web Pager: %s (%s)", nick, email); |
1487
7bb7eca3fa14
[gaim-migrate @ 1497]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
222 char *what = g_malloc(BUF_LONG); |
7bb7eca3fa14
[gaim-migrate @ 1497]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
223 g_snprintf(what, BUF_LONG, "%s", msg); |
1766
a247305b835f
[gaim-migrate @ 1776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1765
diff
changeset
|
224 serv_got_im(gc, who, what, 0, time((time_t)NULL)); |
1336
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
225 g_free(who); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
226 g_free(what); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
227 } |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
228 |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
229 static void icq_mail_express(icq_Link *link, unsigned char hour, unsigned char minute, |
1336
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
230 unsigned char day, unsigned char month, unsigned short year, const char *nick, |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
231 const char *email, const char *msg) { |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
232 struct gaim_connection *gc = find_gaim_conn_by_icq_link(link); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
233 char *who = g_strdup_printf("ICQ Mail Express: %s (%s)", nick, email); |
1487
7bb7eca3fa14
[gaim-migrate @ 1497]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
234 char *what = g_malloc(BUF_LONG); |
7bb7eca3fa14
[gaim-migrate @ 1497]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
235 g_snprintf(what, BUF_LONG, "%s", msg); |
1766
a247305b835f
[gaim-migrate @ 1776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1765
diff
changeset
|
236 serv_got_im(gc, who, what, 0, time((time_t)NULL)); |
1336
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
237 g_free(who); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
238 g_free(what); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
239 } |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
240 |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
241 static void icq_req_not(icq_Link *link, unsigned long id, int type, int arg, void *data) { |
1698
4c3bcc579e71
[gaim-migrate @ 1708]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1543
diff
changeset
|
242 if (type == ICQ_NOTIFY_FAILED) |
4c3bcc579e71
[gaim-migrate @ 1708]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1543
diff
changeset
|
243 do_error_dialog("Failure in sending packet", "ICQ error"); |
4c3bcc579e71
[gaim-migrate @ 1708]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1543
diff
changeset
|
244 return; |
4c3bcc579e71
[gaim-migrate @ 1708]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1543
diff
changeset
|
245 } |
4c3bcc579e71
[gaim-migrate @ 1708]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1543
diff
changeset
|
246 |
1152 | 247 static void icq_login(struct aim_user *user) { |
248 struct gaim_connection *gc = new_gaim_conn(user); | |
249 struct icq_data *id = gc->proto_data = g_new0(struct icq_data, 1); | |
1912
8ed70631ed15
[gaim-migrate @ 1922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1898
diff
changeset
|
250 icq_Link *link; |
1543
352f05feb0d1
[gaim-migrate @ 1553]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1531
diff
changeset
|
251 char ps[9]; |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
252 |
1152 | 253 icq_LogLevel = ICQ_LOG_MESSAGE; |
254 | |
1543
352f05feb0d1
[gaim-migrate @ 1553]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1531
diff
changeset
|
255 g_snprintf(ps, sizeof(ps), "%s", user->password); |
352f05feb0d1
[gaim-migrate @ 1553]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1531
diff
changeset
|
256 link = id->link = icq_ICQLINKNew(atol(user->username), ps, |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
257 user->proto_opt[USEROPT_NICK][0] ? user->proto_opt[USEROPT_NICK] : "gaim user", |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
258 TRUE); |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
259 |
1152 | 260 link->icq_Logged = icq_online; |
261 link->icq_Disconnected = icq_logged_off; | |
262 link->icq_RecvMessage = icq_msg_incoming; | |
263 link->icq_RecvURL = icq_url_incoming; | |
1336
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
264 link->icq_RecvWebPager = icq_web_pager; |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
265 link->icq_RecvMailExpress = icq_mail_express; |
1152 | 266 link->icq_UserOnline = icq_user_online; |
267 link->icq_UserOffline = icq_user_offline; | |
268 link->icq_UserStatusUpdate = icq_user_status; | |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
269 link->icq_InfoReply = icq_info_reply; |
1152 | 270 link->icq_WrongPassword = icq_wrong_passwd; |
271 link->icq_InvalidUIN = icq_invalid_uin; | |
272 link->icq_Log = icq_do_log; | |
1698
4c3bcc579e71
[gaim-migrate @ 1708]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1543
diff
changeset
|
273 link->icq_RequestNotify = icq_req_not; |
1152 | 274 |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
275 if (proxytype == PROXY_SOCKS5) |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
276 icq_SetProxy(link, proxyhost, proxyport, proxyuser[0], proxyuser, proxypass); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
277 |
1493
e12fa57b9ef9
[gaim-migrate @ 1503]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1487
diff
changeset
|
278 icq_ContactClear(id->link); |
e12fa57b9ef9
[gaim-migrate @ 1503]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1487
diff
changeset
|
279 if (bud_list_cache_exists(gc)) |
e12fa57b9ef9
[gaim-migrate @ 1503]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1487
diff
changeset
|
280 do_import(NULL, gc); |
e12fa57b9ef9
[gaim-migrate @ 1503]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1487
diff
changeset
|
281 |
1152 | 282 icq_UnsetProxy(link); |
283 | |
284 if (icq_Connect(link, "icq.mirabilis.com", 4000) < 1) { | |
285 hide_login_progress(gc, "Unable to connect"); | |
286 signoff(gc); | |
287 return; | |
288 } | |
289 | |
290 icq_Login(link, STATUS_ONLINE); | |
291 id->cur_status = STATUS_ONLINE; | |
292 | |
293 set_login_progress(gc, 0, "Connecting..."); | |
294 } | |
295 | |
296 static void icq_close(struct gaim_connection *gc) { | |
297 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
298 | |
299 icq_Logout(id->link); | |
300 icq_Disconnect(id->link); | |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1232
diff
changeset
|
301 icq_ICQLINKDelete(id->link); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
302 g_slist_free(id->thru_serv); |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1232
diff
changeset
|
303 g_free(id); |
1152 | 304 } |
305 | |
306 static void icq_send_msg(struct gaim_connection *gc, char *who, char *msg, int away) { | |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
307 if (!away && (strlen(msg) > 0)) { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
308 struct icq_data *id = (struct icq_data *)gc->proto_data; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
309 GSList *l = id->thru_serv; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
310 long w = atol(who); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
311 while (l) { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
312 if (w == (long)l->data) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
313 break; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
314 l = l->next; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
315 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
316 icq_SendMessage(id->link, w, msg, l ? ICQ_SEND_THRUSERVER : ICQ_SEND_BESTWAY); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
317 } |
1152 | 318 } |
319 | |
320 static void icq_keepalive(struct gaim_connection *gc) { | |
321 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
322 icq_KeepAlive(id->link); | |
323 } | |
324 | |
325 static void icq_add_buddy(struct gaim_connection *gc, char *who) { | |
326 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
327 icq_ContactAdd(id->link, atol(who)); | |
328 icq_ContactSetVis(id->link, atol(who), TRUE); | |
329 } | |
330 | |
331 static void icq_add_buddies(struct gaim_connection *gc, GList *whos) { | |
332 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
333 while (whos) { | |
334 icq_ContactAdd(id->link, atol(whos->data)); | |
335 icq_ContactSetVis(id->link, atol(whos->data), TRUE); | |
336 whos = whos->next; | |
337 } | |
338 } | |
339 | |
340 static void icq_rem_buddy(struct gaim_connection *gc, char *who) { | |
341 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
342 icq_ContactRemove(id->link, atol(who)); | |
343 } | |
344 | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
345 static void icq_set_away(struct gaim_connection *gc, char *state, char *msg) { |
1152 | 346 struct icq_data *id = (struct icq_data *)gc->proto_data; |
347 | |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
348 if (gc->away) |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
349 gc->away = NULL; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
350 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
351 if (!strcmp(state, "Online")) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
352 icq_ChangeStatus(id->link, STATUS_ONLINE); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
353 else if (!strcmp(state, "Away")) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
354 icq_ChangeStatus(id->link, STATUS_AWAY); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
355 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
356 } else if (!strcmp(state, "Do Not Disturb")) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
357 icq_ChangeStatus(id->link, STATUS_DND); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
358 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
359 } else if (!strcmp(state, "Not Available")) { |
1152 | 360 icq_ChangeStatus(id->link, STATUS_NA); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
361 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
362 } else if (!strcmp(state, "Occupied")) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
363 icq_ChangeStatus(id->link, STATUS_OCCUPIED); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
364 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
365 } else if (!strcmp(state, "Free For Chat")) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
366 icq_ChangeStatus(id->link, STATUS_FREE_CHAT); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
367 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
368 } else if (!strcmp(state, "Invisible")) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
369 icq_ChangeStatus(id->link, STATUS_INVISIBLE); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
370 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
371 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
372 if (msg) { |
1402
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
373 icq_ChangeStatus(id->link, STATUS_NA); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
374 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
375 } else { |
1402
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
376 icq_ChangeStatus(id->link, STATUS_ONLINE); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
377 } |
1402
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
378 } |
1152 | 379 } |
380 | |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
381 static char **icq_list_icon(int uc) { |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
382 guint status; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
383 if (uc == UC_NORMAL) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
384 return icon_online_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
385 status = uc >> 5; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
386 if (status & STATUS_NA) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
387 return icon_na_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
388 if (status & STATUS_DND) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
389 return icon_dnd_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
390 if (status & STATUS_OCCUPIED) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
391 return icon_occ_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
392 if (status & STATUS_AWAY) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
393 return icon_away_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
394 if (status & STATUS_FREE_CHAT) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
395 return icon_ffc_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
396 if (status & STATUS_INVISIBLE) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
397 return NULL; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
398 return icon_online_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
399 } |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
400 |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
401 static void icq_get_info(struct gaim_connection *gc, char *who) { |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
402 struct icq_data *id = (struct icq_data *)gc->proto_data; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
403 icq_SendInfoReq(id->link, atol(who)); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
404 } |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
405 |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
406 static void icq_info(GtkObject *obj, char *who) { |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
407 serv_get_info(gtk_object_get_user_data(obj), who); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
408 } |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
409 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
410 static void icq_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) { |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
411 GtkWidget *button; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
412 |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
413 button = gtk_menu_item_new_with_label(_("Get Info")); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
414 gtk_signal_connect(GTK_OBJECT(button), "activate", |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
415 GTK_SIGNAL_FUNC(icq_info), who); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
416 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
417 gtk_menu_append(GTK_MENU(menu), button); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
418 gtk_widget_show(button); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
419 } |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
420 |
1336
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
421 static void icq_print_option(GtkEntry *entry, struct aim_user *user) { |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
422 int entrynum; |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
423 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
424 entrynum = (int) gtk_object_get_user_data(GTK_OBJECT(entry)); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
425 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
426 if (entrynum == USEROPT_NICK) |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
427 g_snprintf(user->proto_opt[USEROPT_NICK], |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
428 sizeof(user->proto_opt[USEROPT_NICK]), |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
429 "%s", gtk_entry_get_text(entry)); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
430 } |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
431 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
432 static void icq_user_opts(GtkWidget *book, struct aim_user *user) { |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
433 GtkWidget *vbox; |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
434 GtkWidget *hbox; |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
435 GtkWidget *label; |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
436 GtkWidget *entry; |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
437 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
438 vbox = gtk_vbox_new(FALSE, 5); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
439 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
440 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
441 gtk_label_new("ICQ Options")); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
442 gtk_widget_show(vbox); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
443 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
444 hbox = gtk_hbox_new(FALSE, 5); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
445 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
446 gtk_widget_show(hbox); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
447 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
448 label = gtk_label_new("Nick"); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
449 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
450 gtk_widget_show(label); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
451 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
452 entry = gtk_entry_new(); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
453 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
454 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_NICK); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
455 gtk_signal_connect(GTK_OBJECT(entry), "changed", |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
456 GTK_SIGNAL_FUNC(icq_print_option), user); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
457 if (user->proto_opt[USEROPT_NICK][0]) |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
458 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_NICK]); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
459 else |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
460 gtk_entry_set_text(GTK_ENTRY(entry), "gaim user"); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
461 gtk_widget_show(entry); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
462 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
463 hbox = gtk_hbox_new(FALSE, 5); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
464 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
465 gtk_widget_show(hbox); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
466 } |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
467 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
468 static GList *icq_away_states() { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
469 GList *m = NULL; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
470 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
471 m = g_list_append(m, "Online"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
472 m = g_list_append(m, "Away"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
473 m = g_list_append(m, "Do Not Disturb"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
474 m = g_list_append(m, "Not Available"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
475 m = g_list_append(m, "Occupied"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
476 m = g_list_append(m, "Free For Chat"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
477 m = g_list_append(m, "Invisible"); |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
478 |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
479 return m; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
480 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
481 |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
482 static void toggle_thru_serv(GtkToggleButton *button, struct conversation *c) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
483 { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
484 struct gaim_connection *gc = gtk_object_get_user_data(GTK_OBJECT(button)); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
485 struct icq_data *id = gc->proto_data; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
486 GSList *l = id->thru_serv; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
487 long who = atol(c->name); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
488 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
489 while (l) { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
490 if (who == (long)l->data) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
491 break; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
492 l = l->next; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
493 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
494 if (l) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
495 id->thru_serv = g_slist_remove(id->thru_serv, (void *)who); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
496 else |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
497 id->thru_serv = g_slist_append(id->thru_serv, (void *)who); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
498 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
499 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
500 static void icq_insert_convo(struct gaim_connection *gc, struct conversation *c) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
501 { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
502 GtkWidget *button; |
2011
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
503 struct icq_data *id = gc->proto_data; |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
504 GSList *l = id->thru_serv; |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
505 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
506 button = gtk_check_button_new_with_label("Send message through server"); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
507 gtk_box_pack_start(GTK_BOX(c->lbox), button, FALSE, FALSE, 5); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
508 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_thru_serv), c); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
509 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
2011
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
510 while (l) { |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
511 if (who == (long)l->data) |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
512 break; |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
513 l = l->next; |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
514 } |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
515 if (l) |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
516 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
517 gtk_widget_show(button); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
518 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
519 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
520 static void icq_remove_convo(struct gaim_connection *gc, struct conversation *c) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
521 { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
522 while (GTK_BOX(c->lbox)->children) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
523 gtk_container_remove(GTK_CONTAINER(c->lbox), |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
524 ((GtkBoxChild *)GTK_BOX(c->lbox)->children->data)->widget); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
525 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
526 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
527 static struct prpl *my_protocol = NULL; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
528 |
1152 | 529 static void icq_init(struct prpl *ret) { |
530 ret->protocol = PROTO_ICQ; | |
531 ret->name = icq_name; | |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
532 ret->list_icon = icq_list_icon; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
533 ret->away_states = icq_away_states; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
534 ret->buddy_menu = icq_buddy_menu; |
1336
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
535 ret->user_opts = icq_user_opts; |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
536 ret->insert_convo = icq_insert_convo; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
537 ret->remove_convo = icq_remove_convo; |
1152 | 538 ret->login = icq_login; |
539 ret->close = icq_close; | |
540 ret->send_im = icq_send_msg; | |
541 ret->add_buddy = icq_add_buddy; | |
542 ret->add_buddies = icq_add_buddies; | |
543 ret->remove_buddy = icq_rem_buddy; | |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
544 ret->get_info = icq_get_info; |
1152 | 545 ret->set_away = icq_set_away; |
546 ret->keepalive = icq_keepalive; | |
547 | |
548 my_protocol = ret; | |
549 } | |
550 | |
551 char *gaim_plugin_init(GModule *handle) { | |
1493
e12fa57b9ef9
[gaim-migrate @ 1503]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1487
diff
changeset
|
552 icq_SocketNotify = icq_sock_notify; |
1498
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
553 icq_SetTimeout = icq_set_timeout; |
1443
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1433
diff
changeset
|
554 load_protocol(icq_init, sizeof(struct prpl)); |
1152 | 555 return NULL; |
556 } | |
557 | |
558 void gaim_plugin_remove() { | |
559 struct prpl *p = find_prpl(PROTO_ICQ); | |
560 if (p == my_protocol) | |
561 unload_protocol(p); | |
562 } | |
563 | |
564 char *name() { | |
565 return "ICQ"; | |
566 } | |
567 | |
568 char *description() { | |
569 return "Allows gaim to use the ICQ protocol"; | |
570 } |