Mercurial > pidgin
annotate plugins/icq/gaim_icq.c @ 2025:1bfef3e8ba63
[gaim-migrate @ 2035]
woo
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 16 Jun 2001 01:14:43 +0000 |
parents | 3a991ed8b45c |
children | 5424784377f6 |
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 if (icq_Connect(link, "icq.mirabilis.com", 4000) < 1) { |
283 hide_login_progress(gc, "Unable to connect"); | |
284 signoff(gc); | |
285 return; | |
286 } | |
287 | |
288 icq_Login(link, STATUS_ONLINE); | |
289 id->cur_status = STATUS_ONLINE; | |
290 | |
291 set_login_progress(gc, 0, "Connecting..."); | |
292 } | |
293 | |
294 static void icq_close(struct gaim_connection *gc) { | |
295 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
296 | |
297 icq_Logout(id->link); | |
298 icq_Disconnect(id->link); | |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1232
diff
changeset
|
299 icq_ICQLINKDelete(id->link); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
300 g_slist_free(id->thru_serv); |
1309
0a766047b4fd
[gaim-migrate @ 1319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1232
diff
changeset
|
301 g_free(id); |
1152 | 302 } |
303 | |
304 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
|
305 if (!away && (strlen(msg) > 0)) { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
306 struct icq_data *id = (struct icq_data *)gc->proto_data; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
307 GSList *l = id->thru_serv; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
308 long w = atol(who); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
309 while (l) { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
310 if (w == (long)l->data) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
311 break; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
312 l = l->next; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
313 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
314 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
|
315 } |
1152 | 316 } |
317 | |
318 static void icq_keepalive(struct gaim_connection *gc) { | |
319 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
320 icq_KeepAlive(id->link); | |
321 } | |
322 | |
323 static void icq_add_buddy(struct gaim_connection *gc, char *who) { | |
324 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
325 icq_ContactAdd(id->link, atol(who)); | |
326 icq_ContactSetVis(id->link, atol(who), TRUE); | |
327 } | |
328 | |
329 static void icq_add_buddies(struct gaim_connection *gc, GList *whos) { | |
330 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
331 while (whos) { | |
332 icq_ContactAdd(id->link, atol(whos->data)); | |
333 icq_ContactSetVis(id->link, atol(whos->data), TRUE); | |
334 whos = whos->next; | |
335 } | |
336 } | |
337 | |
338 static void icq_rem_buddy(struct gaim_connection *gc, char *who) { | |
339 struct icq_data *id = (struct icq_data *)gc->proto_data; | |
340 icq_ContactRemove(id->link, atol(who)); | |
341 } | |
342 | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
343 static void icq_set_away(struct gaim_connection *gc, char *state, char *msg) { |
1152 | 344 struct icq_data *id = (struct icq_data *)gc->proto_data; |
345 | |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
346 if (gc->away) |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
347 gc->away = NULL; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
348 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
349 if (!strcmp(state, "Online")) |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
350 icq_ChangeStatus(id->link, STATUS_ONLINE); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
351 else if (!strcmp(state, "Away")) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
352 icq_ChangeStatus(id->link, STATUS_AWAY); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
353 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
354 } else if (!strcmp(state, "Do Not Disturb")) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
355 icq_ChangeStatus(id->link, STATUS_DND); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
356 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
357 } else if (!strcmp(state, "Not Available")) { |
1152 | 358 icq_ChangeStatus(id->link, STATUS_NA); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
359 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
360 } else if (!strcmp(state, "Occupied")) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
361 icq_ChangeStatus(id->link, STATUS_OCCUPIED); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
362 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
363 } else if (!strcmp(state, "Free For Chat")) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
364 icq_ChangeStatus(id->link, STATUS_FREE_CHAT); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
365 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
366 } else if (!strcmp(state, "Invisible")) { |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
367 icq_ChangeStatus(id->link, STATUS_INVISIBLE); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
368 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
369 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
370 if (msg) { |
1402
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
371 icq_ChangeStatus(id->link, STATUS_NA); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
372 gc->away = ""; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
373 } else { |
1402
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
374 icq_ChangeStatus(id->link, STATUS_ONLINE); |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
375 } |
1402
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
376 } |
1152 | 377 } |
378 | |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
379 static char **icq_list_icon(int uc) { |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
380 guint status; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
381 if (uc == UC_NORMAL) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
382 return icon_online_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
383 status = uc >> 5; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
384 if (status & STATUS_NA) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
385 return icon_na_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
386 if (status & STATUS_DND) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
387 return icon_dnd_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
388 if (status & STATUS_OCCUPIED) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
389 return icon_occ_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
390 if (status & STATUS_AWAY) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
391 return icon_away_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
392 if (status & STATUS_FREE_CHAT) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
393 return icon_ffc_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
394 if (status & STATUS_INVISIBLE) |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
395 return NULL; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
396 return icon_online_xpm; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
397 } |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
398 |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
399 static void icq_get_info(struct gaim_connection *gc, char *who) { |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
400 struct icq_data *id = (struct icq_data *)gc->proto_data; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
401 icq_SendInfoReq(id->link, atol(who)); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
402 } |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
403 |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
404 static void icq_info(GtkObject *obj, char *who) { |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
405 serv_get_info(gtk_object_get_user_data(obj), who); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
406 } |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
407 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
408 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
|
409 GtkWidget *button; |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
410 |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
411 button = gtk_menu_item_new_with_label(_("Get Info")); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
412 gtk_signal_connect(GTK_OBJECT(button), "activate", |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
413 GTK_SIGNAL_FUNC(icq_info), who); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
414 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
415 gtk_menu_append(GTK_MENU(menu), button); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
416 gtk_widget_show(button); |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
417 } |
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
418 |
1336
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
419 static void icq_print_option(GtkEntry *entry, struct aim_user *user) { |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
420 int entrynum; |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
421 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
422 entrynum = (int) gtk_object_get_user_data(GTK_OBJECT(entry)); |
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 if (entrynum == USEROPT_NICK) |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
425 g_snprintf(user->proto_opt[USEROPT_NICK], |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
426 sizeof(user->proto_opt[USEROPT_NICK]), |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
427 "%s", gtk_entry_get_text(entry)); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
428 } |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
429 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
430 static void icq_user_opts(GtkWidget *book, struct aim_user *user) { |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
431 GtkWidget *vbox; |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
432 GtkWidget *hbox; |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
433 GtkWidget *label; |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
434 GtkWidget *entry; |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
435 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
436 vbox = gtk_vbox_new(FALSE, 5); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
437 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
438 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
439 gtk_label_new("ICQ Options")); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
440 gtk_widget_show(vbox); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
441 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
442 hbox = gtk_hbox_new(FALSE, 5); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
443 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
444 gtk_widget_show(hbox); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
445 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
446 label = gtk_label_new("Nick"); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
447 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
448 gtk_widget_show(label); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
449 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
450 entry = gtk_entry_new(); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
451 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
452 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_NICK); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
453 gtk_signal_connect(GTK_OBJECT(entry), "changed", |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
454 GTK_SIGNAL_FUNC(icq_print_option), user); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
455 if (user->proto_opt[USEROPT_NICK][0]) |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
456 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
|
457 else |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
458 gtk_entry_set_text(GTK_ENTRY(entry), "gaim user"); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
459 gtk_widget_show(entry); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
460 |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
461 hbox = gtk_hbox_new(FALSE, 5); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
462 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
463 gtk_widget_show(hbox); |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
464 } |
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
465 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
466 static GList *icq_away_states() { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
467 GList *m = NULL; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
468 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
469 m = g_list_append(m, "Online"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
470 m = g_list_append(m, "Away"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
471 m = g_list_append(m, "Do Not Disturb"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
472 m = g_list_append(m, "Not Available"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
473 m = g_list_append(m, "Occupied"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
474 m = g_list_append(m, "Free For Chat"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
475 m = g_list_append(m, "Invisible"); |
1432
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
476 |
4c510ca3563f
[gaim-migrate @ 1442]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
477 return m; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
478 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
479 |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
480 static void toggle_thru_serv(GtkToggleButton *button, struct conversation *c) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
481 { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
482 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
|
483 struct icq_data *id = gc->proto_data; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
484 GSList *l = id->thru_serv; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
485 long who = atol(c->name); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
486 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
487 while (l) { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
488 if (who == (long)l->data) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
489 break; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
490 l = l->next; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
491 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
492 if (l) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
493 id->thru_serv = g_slist_remove(id->thru_serv, (void *)who); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
494 else |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
495 id->thru_serv = g_slist_append(id->thru_serv, (void *)who); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
496 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
497 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
498 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
|
499 { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
500 GtkWidget *button; |
2011
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
501 struct icq_data *id = gc->proto_data; |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
502 GSList *l = id->thru_serv; |
2012
5748a6faa461
[gaim-migrate @ 2022]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2011
diff
changeset
|
503 long who = atol(c->name); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
504 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
505 button = gtk_check_button_new_with_label("Send message through server"); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
506 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
|
507 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
|
508 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
2011
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
509 while (l) { |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
510 if (who == (long)l->data) |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
511 break; |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
512 l = l->next; |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
513 } |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
514 if (l) |
8195d67364a4
[gaim-migrate @ 2021]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1912
diff
changeset
|
515 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
516 gtk_widget_show(button); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
517 } |
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 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
|
520 { |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
521 while (GTK_BOX(c->lbox)->children) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
522 gtk_container_remove(GTK_CONTAINER(c->lbox), |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
523 ((GtkBoxChild *)GTK_BOX(c->lbox)->children->data)->widget); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
524 } |
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 static struct prpl *my_protocol = NULL; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
527 |
1152 | 528 static void icq_init(struct prpl *ret) { |
529 ret->protocol = PROTO_ICQ; | |
530 ret->name = icq_name; | |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
531 ret->list_icon = icq_list_icon; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1374
diff
changeset
|
532 ret->away_states = icq_away_states; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1498
diff
changeset
|
533 ret->buddy_menu = icq_buddy_menu; |
1336
f3303fc05572
[gaim-migrate @ 1346]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1335
diff
changeset
|
534 ret->user_opts = icq_user_opts; |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
535 ret->insert_convo = icq_insert_convo; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
536 ret->remove_convo = icq_remove_convo; |
1152 | 537 ret->login = icq_login; |
538 ret->close = icq_close; | |
539 ret->send_im = icq_send_msg; | |
540 ret->add_buddy = icq_add_buddy; | |
541 ret->add_buddies = icq_add_buddies; | |
542 ret->remove_buddy = icq_rem_buddy; | |
1220
16ea7a3fdbb6
[gaim-migrate @ 1230]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1167
diff
changeset
|
543 ret->get_info = icq_get_info; |
1152 | 544 ret->set_away = icq_set_away; |
545 ret->keepalive = icq_keepalive; | |
546 | |
547 my_protocol = ret; | |
548 } | |
549 | |
550 char *gaim_plugin_init(GModule *handle) { | |
1493
e12fa57b9ef9
[gaim-migrate @ 1503]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1487
diff
changeset
|
551 icq_SocketNotify = icq_sock_notify; |
1498
0ef6603d986e
[gaim-migrate @ 1508]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
552 icq_SetTimeout = icq_set_timeout; |
1443
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1433
diff
changeset
|
553 load_protocol(icq_init, sizeof(struct prpl)); |
1152 | 554 return NULL; |
555 } | |
556 | |
557 void gaim_plugin_remove() { | |
558 struct prpl *p = find_prpl(PROTO_ICQ); | |
559 if (p == my_protocol) | |
560 unload_protocol(p); | |
561 } | |
562 | |
563 char *name() { | |
564 return "ICQ"; | |
565 } | |
566 | |
567 char *description() { | |
568 return "Allows gaim to use the ICQ protocol"; | |
569 } |