1 | /* |
---|
2 | * skype.c - Skype plugin for BitlBee |
---|
3 | * |
---|
4 | * Copyright (c) 2007 by Miklos Vajna <vmiklos@frugalware.org> |
---|
5 | * |
---|
6 | * Several ideas are used from the BitlBee Jabber plugin, which is |
---|
7 | * |
---|
8 | * Copyright (c) 2006 by Wilmer van der Gaast <wilmer@gaast.net> |
---|
9 | * |
---|
10 | * This program is free software; you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU General Public License as published by |
---|
12 | * the Free Software Foundation; either version 2 of the License, or |
---|
13 | * (at your option) any later version. |
---|
14 | * |
---|
15 | * This program is distributed in the hope that it will be useful, |
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | * GNU General Public License for more details. |
---|
19 | * |
---|
20 | * You should have received a copy of the GNU General Public License |
---|
21 | * along with this program; if not, write to the Free Software |
---|
22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
---|
23 | * USA. |
---|
24 | */ |
---|
25 | |
---|
26 | #define _XOPEN_SOURCE |
---|
27 | #include <stdio.h> |
---|
28 | #include <poll.h> |
---|
29 | #include <bitlbee.h> |
---|
30 | #include <glib.h> |
---|
31 | |
---|
32 | #define SKYPE_DEFAULT_SERVER "localhost" |
---|
33 | #define SKYPE_DEFAULT_PORT "2727" |
---|
34 | |
---|
35 | /* |
---|
36 | * Enumerations |
---|
37 | */ |
---|
38 | |
---|
39 | typedef enum |
---|
40 | { |
---|
41 | SKYPE_CALL_RINGING = 1, |
---|
42 | SKYPE_CALL_MISSED |
---|
43 | } skype_call_status; |
---|
44 | |
---|
45 | typedef enum |
---|
46 | { |
---|
47 | SKYPE_FILETRANSFER_NEW = 1, |
---|
48 | SKYPE_FILETRANSFER_FAILED |
---|
49 | } skype_filetransfer_status; |
---|
50 | |
---|
51 | /* |
---|
52 | * Structures |
---|
53 | */ |
---|
54 | |
---|
55 | struct skype_data |
---|
56 | { |
---|
57 | struct im_connection *ic; |
---|
58 | char *username; |
---|
59 | /* The effective file descriptor. We store it here so any function can |
---|
60 | * write() to it. */ |
---|
61 | int fd; |
---|
62 | /* File descriptor returned by bitlbee. we store it so we know when |
---|
63 | * we're connected and when we aren't. */ |
---|
64 | int bfd; |
---|
65 | /* When we receive a new message id, we query the properties, finally |
---|
66 | * the chatname. Store the properties here so that we can use |
---|
67 | * imcb_buddy_msg() when we got the chatname. */ |
---|
68 | char *handle; |
---|
69 | /* List, because of multiline messages. */ |
---|
70 | GList *body; |
---|
71 | char *type; |
---|
72 | /* This is necessary because we send a notification when we get the |
---|
73 | * handle. So we store the state here and then we can send a |
---|
74 | * notification about the handle is in a given status. */ |
---|
75 | skype_call_status call_status; |
---|
76 | /* Same for file transfers. */ |
---|
77 | skype_filetransfer_status filetransfer_status; |
---|
78 | /* Using /j #nick we want to have a groupchat with two people. Usually |
---|
79 | * not (default). */ |
---|
80 | char* groupchat_with; |
---|
81 | /* The user who invited us to the chat. */ |
---|
82 | char* adder; |
---|
83 | /* If we are waiting for a confirmation about we changed the topic. */ |
---|
84 | int topic_wait; |
---|
85 | /* These are used by the info command. */ |
---|
86 | char *info_fullname; |
---|
87 | char *info_phonehome; |
---|
88 | char *info_phoneoffice; |
---|
89 | char *info_phonemobile; |
---|
90 | char *info_nrbuddies; |
---|
91 | char *info_tz; |
---|
92 | char *info_seen; |
---|
93 | char *info_birthday; |
---|
94 | char *info_sex; |
---|
95 | char *info_language; |
---|
96 | char *info_country; |
---|
97 | char *info_province; |
---|
98 | char *info_city; |
---|
99 | char *info_homepage; |
---|
100 | char *info_about; |
---|
101 | }; |
---|
102 | |
---|
103 | struct skype_away_state |
---|
104 | { |
---|
105 | char *code; |
---|
106 | char *full_name; |
---|
107 | }; |
---|
108 | |
---|
109 | struct skype_buddy_ask_data |
---|
110 | { |
---|
111 | struct im_connection *ic; |
---|
112 | char *handle; |
---|
113 | }; |
---|
114 | |
---|
115 | /* |
---|
116 | * Tables |
---|
117 | */ |
---|
118 | |
---|
119 | const struct skype_away_state skype_away_state_list[] = |
---|
120 | { |
---|
121 | { "ONLINE", "Online" }, |
---|
122 | { "SKYPEME", "Skype Me" }, |
---|
123 | { "AWAY", "Away" }, |
---|
124 | { "NA", "Not available" }, |
---|
125 | { "DND", "Do Not Disturb" }, |
---|
126 | { "INVISIBLE", "Invisible" }, |
---|
127 | { "OFFLINE", "Offline" }, |
---|
128 | { NULL, NULL} |
---|
129 | }; |
---|
130 | |
---|
131 | /* |
---|
132 | * Functions |
---|
133 | */ |
---|
134 | |
---|
135 | static void skype_init( account_t *acc ) |
---|
136 | { |
---|
137 | set_t *s; |
---|
138 | |
---|
139 | s = set_add( &acc->set, "port", SKYPE_DEFAULT_PORT, set_eval_int, acc ); |
---|
140 | s->flags |= ACC_SET_OFFLINE_ONLY; |
---|
141 | |
---|
142 | s = set_add( &acc->set, "server", SKYPE_DEFAULT_SERVER, set_eval_account, acc ); |
---|
143 | s->flags |= ACC_SET_OFFLINE_ONLY; |
---|
144 | } |
---|
145 | |
---|
146 | int skype_write( struct im_connection *ic, char *buf, int len ) |
---|
147 | { |
---|
148 | struct skype_data *sd = ic->proto_data; |
---|
149 | struct pollfd pfd[1]; |
---|
150 | |
---|
151 | pfd[0].fd = sd->fd; |
---|
152 | pfd[0].events = POLLOUT; |
---|
153 | |
---|
154 | /* This poll is necessary or we'll get a SIGPIPE when we write() to |
---|
155 | * sd->fd. */ |
---|
156 | poll(pfd, 1, 1000); |
---|
157 | if(pfd[0].revents & POLLHUP) |
---|
158 | { |
---|
159 | imcb_error( ic, "Could not connect to server" ); |
---|
160 | imc_logout( ic, TRUE ); |
---|
161 | return FALSE; |
---|
162 | } |
---|
163 | write( sd->fd, buf, len ); |
---|
164 | |
---|
165 | return TRUE; |
---|
166 | } |
---|
167 | |
---|
168 | static void skype_buddy_ask_yes( gpointer w, struct skype_buddy_ask_data *bla ) |
---|
169 | { |
---|
170 | char *buf = g_strdup_printf("SET USER %s ISAUTHORIZED TRUE", bla->handle); |
---|
171 | skype_write( bla->ic, buf, strlen( buf ) ); |
---|
172 | g_free(buf); |
---|
173 | g_free(bla->handle); |
---|
174 | g_free(bla); |
---|
175 | } |
---|
176 | |
---|
177 | static void skype_buddy_ask_no( gpointer w, struct skype_buddy_ask_data *bla ) |
---|
178 | { |
---|
179 | char *buf = g_strdup_printf("SET USER %s ISAUTHORIZED FALSE", bla->handle); |
---|
180 | skype_write( bla->ic, buf, strlen( buf ) ); |
---|
181 | g_free(buf); |
---|
182 | g_free(bla->handle); |
---|
183 | g_free(bla); |
---|
184 | } |
---|
185 | |
---|
186 | void skype_buddy_ask( struct im_connection *ic, char *handle, char *message) |
---|
187 | { |
---|
188 | struct skype_buddy_ask_data *bla = g_new0( struct skype_buddy_ask_data, 1 ); |
---|
189 | char *buf; |
---|
190 | |
---|
191 | bla->ic = ic; |
---|
192 | bla->handle = g_strdup(handle); |
---|
193 | |
---|
194 | buf = g_strdup_printf( "The user %s wants to add you to his/her buddy list, saying: '%s'.", handle, message); |
---|
195 | imcb_ask( ic, buf, bla, skype_buddy_ask_yes, skype_buddy_ask_no ); |
---|
196 | g_free( buf ); |
---|
197 | } |
---|
198 | |
---|
199 | struct groupchat *skype_chat_by_name( struct im_connection *ic, char *name ) |
---|
200 | { |
---|
201 | struct groupchat *ret; |
---|
202 | |
---|
203 | for( ret = ic->groupchats; ret; ret = ret->next ) |
---|
204 | { |
---|
205 | if(strcmp(name, ret->title ) == 0 ) |
---|
206 | break; |
---|
207 | } |
---|
208 | |
---|
209 | return ret; |
---|
210 | } |
---|
211 | |
---|
212 | static gboolean skype_read_callback( gpointer data, gint fd, b_input_condition cond ) |
---|
213 | { |
---|
214 | struct im_connection *ic = data; |
---|
215 | struct skype_data *sd = ic->proto_data; |
---|
216 | char buf[1024]; |
---|
217 | int st; |
---|
218 | char **lines, **lineptr, *line, *ptr; |
---|
219 | |
---|
220 | if( !sd || sd->fd == -1 ) |
---|
221 | return FALSE; |
---|
222 | /* Read the whole data. */ |
---|
223 | st = read( sd->fd, buf, sizeof( buf ) ); |
---|
224 | if( st > 0 ) |
---|
225 | { |
---|
226 | buf[st] = '\0'; |
---|
227 | /* Then split it up to lines. */ |
---|
228 | lines = g_strsplit(buf, "\n", 0); |
---|
229 | lineptr = lines; |
---|
230 | while((line = *lineptr)) |
---|
231 | { |
---|
232 | if(!strlen(line)) |
---|
233 | break; |
---|
234 | if(!strncmp(line, "USERS ", 6)) |
---|
235 | { |
---|
236 | char **i; |
---|
237 | char **nicks; |
---|
238 | |
---|
239 | nicks = g_strsplit(line + 6, ", ", 0); |
---|
240 | i = nicks; |
---|
241 | while(*i) |
---|
242 | { |
---|
243 | g_snprintf(buf, 1024, "GET USER %s ONLINESTATUS\n", *i); |
---|
244 | skype_write( ic, buf, strlen( buf ) ); |
---|
245 | i++; |
---|
246 | } |
---|
247 | g_strfreev(nicks); |
---|
248 | } |
---|
249 | else if(!strncmp(line, "USER ", 5)) |
---|
250 | { |
---|
251 | int flags = 0; |
---|
252 | char *status = strrchr(line, ' '); |
---|
253 | char *user = strchr(line, ' '); |
---|
254 | status++; |
---|
255 | ptr = strchr(++user, ' '); |
---|
256 | *ptr = '\0'; |
---|
257 | ptr++; |
---|
258 | if(!strncmp(ptr, "ONLINESTATUS ", 13) && |
---|
259 | strcmp(user, sd->username) != 0 |
---|
260 | && strcmp(user, "echo123") != 0) |
---|
261 | { |
---|
262 | ptr = g_strdup_printf("%s@skype.com", user); |
---|
263 | imcb_add_buddy(ic, ptr, NULL); |
---|
264 | if(strcmp(status, "OFFLINE") != 0) |
---|
265 | flags |= OPT_LOGGED_IN; |
---|
266 | if(strcmp(status, "ONLINE") != 0 && strcmp(status, "SKYPEME") != 0) |
---|
267 | flags |= OPT_AWAY; |
---|
268 | imcb_buddy_status(ic, ptr, flags, NULL, NULL); |
---|
269 | g_free(ptr); |
---|
270 | } |
---|
271 | else if(!strncmp(ptr, "RECEIVEDAUTHREQUEST ", 20)) |
---|
272 | { |
---|
273 | char *message = ptr + 20; |
---|
274 | if(strlen(message)) |
---|
275 | skype_buddy_ask(ic, user, message); |
---|
276 | } |
---|
277 | else if(!strncmp(ptr, "BUDDYSTATUS ", 12)) |
---|
278 | { |
---|
279 | char *st = ptr + 12; |
---|
280 | if(!strcmp(st, "3")) |
---|
281 | { |
---|
282 | char *buf = g_strdup_printf("%s@skype.com", user); |
---|
283 | imcb_add_buddy(ic, buf, NULL); |
---|
284 | g_free(buf); |
---|
285 | } |
---|
286 | } |
---|
287 | else if(!strncmp(ptr, "FULLNAME ", 9)) |
---|
288 | sd->info_fullname = g_strdup_printf("%s", ptr + 9); |
---|
289 | else if(!strncmp(ptr, "PHONE_HOME ", 11)) |
---|
290 | sd->info_phonehome = g_strdup_printf("%s", ptr + 11); |
---|
291 | else if(!strncmp(ptr, "PHONE_OFFICE ", 13)) |
---|
292 | sd->info_phoneoffice = g_strdup_printf("%s", ptr + 13); |
---|
293 | else if(!strncmp(ptr, "PHONE_MOBILE ", 13)) |
---|
294 | sd->info_phonemobile = g_strdup_printf("%s", ptr + 13); |
---|
295 | else if(!strncmp(ptr, "NROF_AUTHED_BUDDIES ", 20)) |
---|
296 | sd->info_nrbuddies = g_strdup_printf("%s", ptr + 20); |
---|
297 | else if(!strncmp(ptr, "TIMEZONE ", 9)) |
---|
298 | sd->info_tz = g_strdup_printf("%s", ptr + 9); |
---|
299 | else if(!strncmp(ptr, "LASTONLINETIMESTAMP ", 20)) |
---|
300 | sd->info_seen = g_strdup_printf("%s", ptr + 20); |
---|
301 | else if(!strncmp(ptr, "BIRTHDAY ", 9)) |
---|
302 | sd->info_birthday = g_strdup_printf("%s", ptr + 9); |
---|
303 | else if(!strncmp(ptr, "SEX ", 4)) |
---|
304 | sd->info_sex = g_strdup_printf("%s", ptr + 4); |
---|
305 | else if(!strncmp(ptr, "LANGUAGE ", 9)) |
---|
306 | sd->info_language = g_strdup_printf("%s", ptr + 9); |
---|
307 | else if(!strncmp(ptr, "COUNTRY ", 8)) |
---|
308 | sd->info_country = g_strdup_printf("%s", ptr + 8); |
---|
309 | else if(!strncmp(ptr, "PROVINCE ", 9)) |
---|
310 | sd->info_province = g_strdup_printf("%s", ptr + 9); |
---|
311 | else if(!strncmp(ptr, "CITY ", 5)) |
---|
312 | sd->info_city = g_strdup_printf("%s", ptr + 5); |
---|
313 | else if(!strncmp(ptr, "HOMEPAGE ", 9)) |
---|
314 | sd->info_homepage = g_strdup_printf("%s", ptr + 9); |
---|
315 | else if(!strncmp(ptr, "ABOUT ", 6)) |
---|
316 | { |
---|
317 | sd->info_about = g_strdup_printf("%s", ptr + 6); |
---|
318 | |
---|
319 | GString *st = g_string_new("Contact Information\n"); |
---|
320 | g_string_append_printf(st, "Skype Name: %s\n", user); |
---|
321 | if(sd->info_fullname) |
---|
322 | { |
---|
323 | if(strlen(sd->info_fullname)) |
---|
324 | g_string_append_printf(st, "Full Name: %s\n", sd->info_fullname); |
---|
325 | g_free(sd->info_fullname); |
---|
326 | } |
---|
327 | if(sd->info_phonehome) |
---|
328 | { |
---|
329 | if(strlen(sd->info_phonehome)) |
---|
330 | g_string_append_printf(st, "Home Phone: %s\n", sd->info_phonehome); |
---|
331 | g_free(sd->info_phonehome); |
---|
332 | } |
---|
333 | if(sd->info_phoneoffice) |
---|
334 | { |
---|
335 | if(strlen(sd->info_phoneoffice)) |
---|
336 | g_string_append_printf(st, "Office Phone: %s\n", sd->info_phoneoffice); |
---|
337 | g_free(sd->info_phoneoffice); |
---|
338 | } |
---|
339 | if(sd->info_phonemobile) |
---|
340 | { |
---|
341 | if(strlen(sd->info_phonemobile)) |
---|
342 | g_string_append_printf(st, "Mobile Phone: %s\n", sd->info_phonemobile); |
---|
343 | g_free(sd->info_phonemobile); |
---|
344 | } |
---|
345 | g_string_append_printf(st, "Personal Information\n"); |
---|
346 | if(sd->info_nrbuddies) |
---|
347 | { |
---|
348 | if(strlen(sd->info_nrbuddies)) |
---|
349 | g_string_append_printf(st, "Contacts: %s\n", sd->info_nrbuddies); |
---|
350 | g_free(sd->info_nrbuddies); |
---|
351 | } |
---|
352 | if(sd->info_tz) |
---|
353 | { |
---|
354 | if(strlen(sd->info_tz)) |
---|
355 | { |
---|
356 | char ib[256]; |
---|
357 | time_t t = time(NULL); |
---|
358 | t += atoi(sd->info_tz)-(60*60*24); |
---|
359 | struct tm *gt = gmtime(&t); |
---|
360 | strftime(ib, 256, "%H:%M:%S", gt); |
---|
361 | g_string_append_printf(st, "Local Time: %s\n", ib); |
---|
362 | } |
---|
363 | g_free(sd->info_tz); |
---|
364 | } |
---|
365 | if(sd->info_seen) |
---|
366 | { |
---|
367 | if(strlen(sd->info_seen)) |
---|
368 | { |
---|
369 | char ib[256]; |
---|
370 | time_t it = atoi(sd->info_seen); |
---|
371 | struct tm *tm = localtime(&it); |
---|
372 | strftime(ib, 256, ("%Y. %m. %d. %H:%M"), tm); |
---|
373 | g_string_append_printf(st, "Last Seen: %s\n", ib); |
---|
374 | } |
---|
375 | g_free(sd->info_seen); |
---|
376 | } |
---|
377 | if(sd->info_birthday) |
---|
378 | { |
---|
379 | if(strlen(sd->info_birthday) && strcmp(sd->info_birthday, "0")) |
---|
380 | { |
---|
381 | char ib[256]; |
---|
382 | struct tm tm; |
---|
383 | strptime(sd->info_birthday, "%Y%m%d", &tm); |
---|
384 | strftime(ib, 256, "%B %d, %Y", &tm); |
---|
385 | g_string_append_printf(st, "Birthday: %s\n", ib); |
---|
386 | |
---|
387 | strftime(ib, 256, "%Y", &tm); |
---|
388 | int year = atoi(ib); |
---|
389 | time_t t = time(NULL); |
---|
390 | struct tm *lt = localtime(&t); |
---|
391 | g_string_append_printf(st, "Age: %d\n", lt->tm_year+1900-year); |
---|
392 | } |
---|
393 | g_free(sd->info_birthday); |
---|
394 | } |
---|
395 | if(sd->info_sex) |
---|
396 | { |
---|
397 | if(strlen(sd->info_sex)) |
---|
398 | { |
---|
399 | char *iptr = sd->info_sex; |
---|
400 | while(*iptr++) |
---|
401 | *iptr = tolower(*iptr); |
---|
402 | g_string_append_printf(st, "Gender: %s\n", sd->info_sex); |
---|
403 | } |
---|
404 | g_free(sd->info_sex); |
---|
405 | } |
---|
406 | if(sd->info_language) |
---|
407 | { |
---|
408 | if(strlen(sd->info_language)) |
---|
409 | { |
---|
410 | char *iptr = strchr(sd->info_language, ' '); |
---|
411 | if(iptr) |
---|
412 | iptr++; |
---|
413 | else |
---|
414 | iptr = sd->info_language; |
---|
415 | g_string_append_printf(st, "Language: %s\n", iptr); |
---|
416 | } |
---|
417 | g_free(sd->info_language); |
---|
418 | } |
---|
419 | if(sd->info_country) |
---|
420 | { |
---|
421 | if(strlen(sd->info_country)) |
---|
422 | { |
---|
423 | char *iptr = strchr(sd->info_country, ' '); |
---|
424 | if(iptr) |
---|
425 | iptr++; |
---|
426 | else |
---|
427 | iptr = sd->info_country; |
---|
428 | g_string_append_printf(st, "Country: %s\n", iptr); |
---|
429 | } |
---|
430 | g_free(sd->info_country); |
---|
431 | } |
---|
432 | if(sd->info_province) |
---|
433 | { |
---|
434 | if(strlen(sd->info_province)) |
---|
435 | g_string_append_printf(st, "Region: %s\n", sd->info_province); |
---|
436 | g_free(sd->info_province); |
---|
437 | } |
---|
438 | if(sd->info_city) |
---|
439 | { |
---|
440 | if(strlen(sd->info_city)) |
---|
441 | g_string_append_printf(st, "City: %s\n", sd->info_city); |
---|
442 | g_free(sd->info_city); |
---|
443 | } |
---|
444 | if(sd->info_homepage) |
---|
445 | { |
---|
446 | if(strlen(sd->info_homepage)) |
---|
447 | g_string_append_printf(st, "Homepage: %s\n", sd->info_homepage); |
---|
448 | g_free(sd->info_homepage); |
---|
449 | } |
---|
450 | if(sd->info_about) |
---|
451 | { |
---|
452 | if(strlen(sd->info_about)) |
---|
453 | g_string_append_printf(st, "%s\n", sd->info_about); |
---|
454 | g_free(sd->info_about); |
---|
455 | } |
---|
456 | imcb_log(ic, "%s", st->str); |
---|
457 | g_string_free(st, TRUE); |
---|
458 | } |
---|
459 | } |
---|
460 | else if(!strncmp(line, "CHATMESSAGE ", 12)) |
---|
461 | { |
---|
462 | char *id = strchr(line, ' '); |
---|
463 | if(++id) |
---|
464 | { |
---|
465 | char *info = strchr(id, ' '); |
---|
466 | *info = '\0'; |
---|
467 | info++; |
---|
468 | if(!strcmp(info, "STATUS RECEIVED")) |
---|
469 | { |
---|
470 | /* New message ID: |
---|
471 | * (1) Request its from field |
---|
472 | * (2) Request its body |
---|
473 | * (3) Request its type |
---|
474 | * (4) Query chatname |
---|
475 | */ |
---|
476 | g_snprintf(buf, 1024, "GET CHATMESSAGE %s FROM_HANDLE\n", id); |
---|
477 | skype_write( ic, buf, strlen( buf ) ); |
---|
478 | g_snprintf(buf, 1024, "GET CHATMESSAGE %s BODY\n", id); |
---|
479 | skype_write( ic, buf, strlen( buf ) ); |
---|
480 | g_snprintf(buf, 1024, "GET CHATMESSAGE %s TYPE\n", id); |
---|
481 | skype_write( ic, buf, strlen( buf ) ); |
---|
482 | g_snprintf(buf, 1024, "GET CHATMESSAGE %s CHATNAME\n", id); |
---|
483 | skype_write( ic, buf, strlen( buf ) ); |
---|
484 | } |
---|
485 | else if(!strncmp(info, "FROM_HANDLE ", 12)) |
---|
486 | { |
---|
487 | info += 12; |
---|
488 | /* New from field value. Store |
---|
489 | * it, then we can later use it |
---|
490 | * when we got the message's |
---|
491 | * body. */ |
---|
492 | g_free(sd->handle); |
---|
493 | sd->handle = g_strdup_printf("%s@skype.com", info); |
---|
494 | } |
---|
495 | else if(!strncmp(info, "EDITED_BY ", 10)) |
---|
496 | { |
---|
497 | info += 10; |
---|
498 | /* This is the same as |
---|
499 | * FROM_HANDLE, except that we |
---|
500 | * never request these lines |
---|
501 | * from Skype, we just get |
---|
502 | * them. */ |
---|
503 | g_free(sd->handle); |
---|
504 | sd->handle = g_strdup_printf("%s@skype.com", info); |
---|
505 | } |
---|
506 | else if(!strncmp(info, "BODY ", 5)) |
---|
507 | { |
---|
508 | info += 5; |
---|
509 | sd->body = g_list_append(sd->body, g_strdup(info)); |
---|
510 | } |
---|
511 | else if(!strncmp(info, "TYPE ", 5)) |
---|
512 | { |
---|
513 | info += 5; |
---|
514 | g_free(sd->type); |
---|
515 | sd->type = g_strdup(info); |
---|
516 | } |
---|
517 | else if(!strncmp(info, "CHATNAME ", 9)) |
---|
518 | { |
---|
519 | info += 9; |
---|
520 | if(sd->handle && sd->body && sd->type) |
---|
521 | { |
---|
522 | struct groupchat *gc = skype_chat_by_name(ic, info); |
---|
523 | int i; |
---|
524 | for(i=0;i<g_list_length(sd->body);i++) |
---|
525 | { |
---|
526 | char *body = g_list_nth_data(sd->body, i); |
---|
527 | if(!strcmp(sd->type, "SAID")) |
---|
528 | { |
---|
529 | if(!gc) |
---|
530 | /* Private message */ |
---|
531 | imcb_buddy_msg(ic, sd->handle, body, 0, 0); |
---|
532 | else |
---|
533 | /* Groupchat message */ |
---|
534 | imcb_chat_msg(gc, sd->handle, body, 0, 0); |
---|
535 | } |
---|
536 | else if(!strcmp(sd->type, "SETTOPIC")) |
---|
537 | { |
---|
538 | if(gc) |
---|
539 | imcb_chat_topic(gc, sd->handle, body, 0); |
---|
540 | } |
---|
541 | else if(!strcmp(sd->type, "LEFT")) |
---|
542 | { |
---|
543 | if(gc) |
---|
544 | imcb_chat_remove_buddy(gc, sd->handle, NULL); |
---|
545 | } |
---|
546 | } |
---|
547 | g_list_free(sd->body); |
---|
548 | sd->body = NULL; |
---|
549 | } |
---|
550 | } |
---|
551 | } |
---|
552 | } |
---|
553 | else if(!strncmp(line, "CALL ", 5)) |
---|
554 | { |
---|
555 | char *id = strchr(line, ' '); |
---|
556 | if(++id) |
---|
557 | { |
---|
558 | char *info = strchr(id, ' '); |
---|
559 | *info = '\0'; |
---|
560 | info++; |
---|
561 | if(!strcmp(info, "STATUS RINGING")) |
---|
562 | { |
---|
563 | g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id); |
---|
564 | skype_write( ic, buf, strlen( buf ) ); |
---|
565 | sd->call_status = SKYPE_CALL_RINGING; |
---|
566 | } |
---|
567 | else if(!strcmp(info, "STATUS MISSED")) |
---|
568 | { |
---|
569 | g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id); |
---|
570 | skype_write( ic, buf, strlen( buf ) ); |
---|
571 | sd->call_status = SKYPE_CALL_MISSED; |
---|
572 | } |
---|
573 | else if(!strncmp(info, "PARTNER_HANDLE ", 15)) |
---|
574 | { |
---|
575 | info += 15; |
---|
576 | if(sd->call_status) { |
---|
577 | switch(sd->call_status) |
---|
578 | { |
---|
579 | case SKYPE_CALL_RINGING: |
---|
580 | imcb_log(ic, "The user %s is currently ringing you.", info); |
---|
581 | break; |
---|
582 | case SKYPE_CALL_MISSED: |
---|
583 | imcb_log(ic, "You have missed a call from user %s.", info); |
---|
584 | break; |
---|
585 | } |
---|
586 | sd->call_status = 0; |
---|
587 | } |
---|
588 | } |
---|
589 | } |
---|
590 | } |
---|
591 | else if(!strncmp(line, "FILETRANSFER ", 13)) |
---|
592 | { |
---|
593 | char *id = strchr(line, ' '); |
---|
594 | if(++id) |
---|
595 | { |
---|
596 | char *info = strchr(id, ' '); |
---|
597 | *info = '\0'; |
---|
598 | info++; |
---|
599 | if(!strcmp(info, "STATUS NEW")) |
---|
600 | { |
---|
601 | g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id); |
---|
602 | skype_write( ic, buf, strlen( buf ) ); |
---|
603 | sd->filetransfer_status = SKYPE_FILETRANSFER_NEW; |
---|
604 | } |
---|
605 | else if(!strcmp(info, "STATUS FAILED")) |
---|
606 | { |
---|
607 | g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id); |
---|
608 | skype_write( ic, buf, strlen( buf ) ); |
---|
609 | sd->filetransfer_status = SKYPE_FILETRANSFER_FAILED; |
---|
610 | } |
---|
611 | else if(!strncmp(info, "PARTNER_HANDLE ", 15)) |
---|
612 | { |
---|
613 | info += 15; |
---|
614 | if(sd->filetransfer_status) { |
---|
615 | switch(sd->filetransfer_status) |
---|
616 | { |
---|
617 | case SKYPE_FILETRANSFER_NEW: |
---|
618 | imcb_log(ic, "The user %s offered a new file for you.", info); |
---|
619 | break; |
---|
620 | case SKYPE_FILETRANSFER_FAILED: |
---|
621 | imcb_log(ic, "Failed to transfer file from user %s.", info); |
---|
622 | break; |
---|
623 | } |
---|
624 | sd->filetransfer_status = 0; |
---|
625 | } |
---|
626 | } |
---|
627 | } |
---|
628 | } |
---|
629 | else if(!strncmp(line, "CHAT ", 5)) |
---|
630 | { |
---|
631 | char *id = strchr(line, ' '); |
---|
632 | if(++id) |
---|
633 | { |
---|
634 | char *info = strchr(id, ' '); |
---|
635 | if(info) |
---|
636 | *info = '\0'; |
---|
637 | info++; |
---|
638 | /* Remove fake chat if we created one in skype_chat_with() */ |
---|
639 | struct groupchat *gc = skype_chat_by_name(ic, ""); |
---|
640 | if(gc) |
---|
641 | imcb_chat_free(gc); |
---|
642 | if(!strcmp(info, "STATUS MULTI_SUBSCRIBED")) |
---|
643 | { |
---|
644 | imcb_chat_new( ic, id ); |
---|
645 | g_snprintf(buf, 1024, "GET CHAT %s ADDER\n", id); |
---|
646 | skype_write(ic, buf, strlen(buf)); |
---|
647 | g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id); |
---|
648 | skype_write(ic, buf, strlen(buf)); |
---|
649 | } |
---|
650 | else if(!strcmp(info, "STATUS DIALOG") && sd->groupchat_with) |
---|
651 | { |
---|
652 | gc = imcb_chat_new( ic, id ); |
---|
653 | /* According to the docs this |
---|
654 | * is necessary. However it |
---|
655 | * does not seem the situation |
---|
656 | * and it would open an extra |
---|
657 | * window on our client, so |
---|
658 | * just leave it out. */ |
---|
659 | /*g_snprintf(buf, 1024, "OPEN CHAT %s\n", id); |
---|
660 | skype_write(ic, buf, strlen(buf));*/ |
---|
661 | g_snprintf(buf, 1024, "%s@skype.com", sd->groupchat_with); |
---|
662 | imcb_chat_add_buddy(gc, buf); |
---|
663 | imcb_chat_add_buddy(gc, sd->username); |
---|
664 | g_free(sd->groupchat_with); |
---|
665 | sd->groupchat_with = NULL; |
---|
666 | g_snprintf(buf, 1024, "GET CHAT %s ADDER\n", id); |
---|
667 | skype_write(ic, buf, strlen(buf)); |
---|
668 | g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id); |
---|
669 | skype_write(ic, buf, strlen(buf)); |
---|
670 | } |
---|
671 | else if(!strcmp(info, "STATUS UNSUBSCRIBED")) |
---|
672 | { |
---|
673 | gc = skype_chat_by_name(ic, id); |
---|
674 | if(gc) |
---|
675 | gc->data = (void*)FALSE; |
---|
676 | } |
---|
677 | else if(!strncmp(info, "ADDER ", 6)) |
---|
678 | { |
---|
679 | info += 6; |
---|
680 | g_free(sd->adder); |
---|
681 | sd->adder = g_strdup_printf("%s@skype.com", info); |
---|
682 | } |
---|
683 | else if(!strncmp(info, "TOPIC ", 6)) |
---|
684 | { |
---|
685 | info += 6; |
---|
686 | gc = skype_chat_by_name(ic, id); |
---|
687 | if(gc && (sd->adder || sd->topic_wait)) |
---|
688 | { |
---|
689 | if(sd->topic_wait) |
---|
690 | { |
---|
691 | sd->adder = g_strdup(sd->username); |
---|
692 | sd->topic_wait = 0; |
---|
693 | } |
---|
694 | imcb_chat_topic(gc, sd->adder, info, 0); |
---|
695 | g_free(sd->adder); |
---|
696 | sd->adder = NULL; |
---|
697 | } |
---|
698 | } |
---|
699 | else if(!strncmp(info, "ACTIVEMEMBERS ", 14)) |
---|
700 | { |
---|
701 | info += 14; |
---|
702 | gc = skype_chat_by_name(ic, id); |
---|
703 | /* Hack! We set ->data to TRUE |
---|
704 | * while we're on the channel |
---|
705 | * so that we won't rejoin |
---|
706 | * after a /part. */ |
---|
707 | if(gc && !gc->data) |
---|
708 | { |
---|
709 | char **members = g_strsplit(info, " ", 0); |
---|
710 | int i; |
---|
711 | for(i=0;members[i];i++) |
---|
712 | { |
---|
713 | if(!strcmp(members[i], sd->username)) |
---|
714 | continue; |
---|
715 | g_snprintf(buf, 1024, "%s@skype.com", members[i]); |
---|
716 | if(!g_list_find_custom(gc->in_room, buf, (GCompareFunc)strcmp)) |
---|
717 | imcb_chat_add_buddy(gc, buf); |
---|
718 | } |
---|
719 | imcb_chat_add_buddy(gc, sd->username); |
---|
720 | g_strfreev(members); |
---|
721 | } |
---|
722 | } |
---|
723 | } |
---|
724 | } |
---|
725 | lineptr++; |
---|
726 | } |
---|
727 | g_strfreev(lines); |
---|
728 | } |
---|
729 | else if( st == 0 || ( st < 0 && !sockerr_again() ) ) |
---|
730 | { |
---|
731 | closesocket( sd->fd ); |
---|
732 | sd->fd = -1; |
---|
733 | |
---|
734 | imcb_error( ic, "Error while reading from server" ); |
---|
735 | imc_logout( ic, TRUE ); |
---|
736 | return FALSE; |
---|
737 | } |
---|
738 | return TRUE; |
---|
739 | } |
---|
740 | |
---|
741 | gboolean skype_start_stream( struct im_connection *ic ) |
---|
742 | { |
---|
743 | struct skype_data *sd = ic->proto_data; |
---|
744 | char *buf; |
---|
745 | int st; |
---|
746 | |
---|
747 | if(!sd) |
---|
748 | return FALSE; |
---|
749 | |
---|
750 | if( sd->bfd <= 0 ) |
---|
751 | sd->bfd = b_input_add( sd->fd, GAIM_INPUT_READ, skype_read_callback, ic ); |
---|
752 | |
---|
753 | /* This will download all buddies. */ |
---|
754 | buf = g_strdup_printf("SEARCH FRIENDS\n"); |
---|
755 | st = skype_write( ic, buf, strlen( buf ) ); |
---|
756 | g_free(buf); |
---|
757 | buf = g_strdup_printf("SET USERSTATUS ONLINE\n"); |
---|
758 | skype_write( ic, buf, strlen( buf ) ); |
---|
759 | g_free(buf); |
---|
760 | return st; |
---|
761 | } |
---|
762 | |
---|
763 | gboolean skype_connected( gpointer data, gint source, b_input_condition cond ) |
---|
764 | { |
---|
765 | struct im_connection *ic = data; |
---|
766 | imcb_connected(ic); |
---|
767 | return skype_start_stream(ic); |
---|
768 | } |
---|
769 | |
---|
770 | static void skype_login( account_t *acc ) |
---|
771 | { |
---|
772 | struct im_connection *ic = imcb_new( acc ); |
---|
773 | struct skype_data *sd = g_new0( struct skype_data, 1 ); |
---|
774 | |
---|
775 | ic->proto_data = sd; |
---|
776 | |
---|
777 | imcb_log( ic, "Connecting" ); |
---|
778 | sd->fd = proxy_connect(set_getstr( &acc->set, "server" ), set_getint( &acc->set, "port" ), skype_connected, ic ); |
---|
779 | sd->username = g_strdup( acc->user ); |
---|
780 | |
---|
781 | sd->ic = ic; |
---|
782 | } |
---|
783 | |
---|
784 | static void skype_logout( struct im_connection *ic ) |
---|
785 | { |
---|
786 | struct skype_data *sd = ic->proto_data; |
---|
787 | char *buf; |
---|
788 | |
---|
789 | buf = g_strdup_printf("SET USERSTATUS OFFLINE\n"); |
---|
790 | skype_write( ic, buf, strlen( buf ) ); |
---|
791 | g_free(buf); |
---|
792 | |
---|
793 | g_free(sd->username); |
---|
794 | g_free(sd->handle); |
---|
795 | g_free(sd); |
---|
796 | ic->proto_data = NULL; |
---|
797 | } |
---|
798 | |
---|
799 | static int skype_buddy_msg( struct im_connection *ic, char *who, char *message, int flags ) |
---|
800 | { |
---|
801 | char *buf, *ptr, *nick; |
---|
802 | int st; |
---|
803 | |
---|
804 | nick = g_strdup(who); |
---|
805 | ptr = strchr(nick, '@'); |
---|
806 | if(ptr) |
---|
807 | *ptr = '\0'; |
---|
808 | |
---|
809 | buf = g_strdup_printf("MESSAGE %s %s\n", nick, message); |
---|
810 | g_free(nick); |
---|
811 | st = skype_write( ic, buf, strlen( buf ) ); |
---|
812 | g_free(buf); |
---|
813 | |
---|
814 | return st; |
---|
815 | } |
---|
816 | |
---|
817 | const struct skype_away_state *skype_away_state_by_name( char *name ) |
---|
818 | { |
---|
819 | int i; |
---|
820 | |
---|
821 | for( i = 0; skype_away_state_list[i].full_name; i ++ ) |
---|
822 | if( g_strcasecmp( skype_away_state_list[i].full_name, name ) == 0 ) |
---|
823 | return( skype_away_state_list + i ); |
---|
824 | |
---|
825 | return NULL; |
---|
826 | } |
---|
827 | |
---|
828 | static void skype_set_away( struct im_connection *ic, char *state_txt, char *message ) |
---|
829 | { |
---|
830 | const struct skype_away_state *state; |
---|
831 | char *buf; |
---|
832 | |
---|
833 | if( strcmp( state_txt, GAIM_AWAY_CUSTOM ) == 0 ) |
---|
834 | state = skype_away_state_by_name( "Away" ); |
---|
835 | else |
---|
836 | state = skype_away_state_by_name( state_txt ); |
---|
837 | buf = g_strdup_printf("SET USERSTATUS %s\n", state->code); |
---|
838 | skype_write( ic, buf, strlen( buf ) ); |
---|
839 | g_free(buf); |
---|
840 | } |
---|
841 | |
---|
842 | static GList *skype_away_states( struct im_connection *ic ) |
---|
843 | { |
---|
844 | static GList *l = NULL; |
---|
845 | int i; |
---|
846 | |
---|
847 | if( l == NULL ) |
---|
848 | for( i = 0; skype_away_state_list[i].full_name; i ++ ) |
---|
849 | l = g_list_append( l, (void*) skype_away_state_list[i].full_name ); |
---|
850 | |
---|
851 | return l; |
---|
852 | } |
---|
853 | |
---|
854 | static void skype_add_buddy( struct im_connection *ic, char *who, char *group ) |
---|
855 | { |
---|
856 | char *buf, *nick, *ptr; |
---|
857 | |
---|
858 | nick = g_strdup(who); |
---|
859 | ptr = strchr(nick, '@'); |
---|
860 | if(ptr) |
---|
861 | *ptr = '\0'; |
---|
862 | buf = g_strdup_printf("SET USER %s BUDDYSTATUS 2 Please authorize me\n", nick); |
---|
863 | skype_write( ic, buf, strlen( buf ) ); |
---|
864 | g_free(nick); |
---|
865 | } |
---|
866 | |
---|
867 | static void skype_remove_buddy( struct im_connection *ic, char *who, char *group ) |
---|
868 | { |
---|
869 | char *buf, *nick, *ptr; |
---|
870 | |
---|
871 | nick = g_strdup(who); |
---|
872 | ptr = strchr(nick, '@'); |
---|
873 | if(ptr) |
---|
874 | *ptr = '\0'; |
---|
875 | buf = g_strdup_printf("SET USER %s BUDDYSTATUS 1\n", nick); |
---|
876 | skype_write( ic, buf, strlen( buf ) ); |
---|
877 | g_free(nick); |
---|
878 | } |
---|
879 | |
---|
880 | void skype_chat_msg( struct groupchat *gc, char *message, int flags ) |
---|
881 | { |
---|
882 | struct im_connection *ic = gc->ic; |
---|
883 | char *buf; |
---|
884 | buf = g_strdup_printf("CHATMESSAGE %s %s\n", gc->title, message); |
---|
885 | skype_write( ic, buf, strlen( buf ) ); |
---|
886 | g_free(buf); |
---|
887 | } |
---|
888 | |
---|
889 | void skype_chat_leave( struct groupchat *gc ) |
---|
890 | { |
---|
891 | struct im_connection *ic = gc->ic; |
---|
892 | char *buf; |
---|
893 | buf = g_strdup_printf("ALTER CHAT %s LEAVE\n", gc->title); |
---|
894 | skype_write( ic, buf, strlen( buf ) ); |
---|
895 | g_free(buf); |
---|
896 | gc->data = (void*)TRUE; |
---|
897 | } |
---|
898 | |
---|
899 | void skype_chat_invite(struct groupchat *gc, char *who, char *message) |
---|
900 | { |
---|
901 | struct im_connection *ic = gc->ic; |
---|
902 | char *buf, *ptr, *nick; |
---|
903 | nick = g_strdup(message); |
---|
904 | ptr = strchr(nick, '@'); |
---|
905 | if(ptr) |
---|
906 | *ptr = '\0'; |
---|
907 | buf = g_strdup_printf("ALTER CHAT %s ADDMEMBERS %s\n", gc->title, nick); |
---|
908 | skype_write( ic, buf, strlen( buf ) ); |
---|
909 | g_free(buf); |
---|
910 | g_free(nick); |
---|
911 | } |
---|
912 | |
---|
913 | void skype_chat_topic(struct groupchat *gc, char *message) |
---|
914 | { |
---|
915 | struct im_connection *ic = gc->ic; |
---|
916 | struct skype_data *sd = ic->proto_data; |
---|
917 | char *buf; |
---|
918 | buf = g_strdup_printf("ALTER CHAT %s SETTOPIC %s\n", gc->title, message); |
---|
919 | skype_write( ic, buf, strlen( buf ) ); |
---|
920 | g_free(buf); |
---|
921 | sd->topic_wait = 1; |
---|
922 | } |
---|
923 | |
---|
924 | struct groupchat *skype_chat_with(struct im_connection *ic, char *who) |
---|
925 | { |
---|
926 | struct skype_data *sd = ic->proto_data; |
---|
927 | char *ptr, *nick, *buf; |
---|
928 | nick = g_strdup(who); |
---|
929 | ptr = strchr(nick, '@'); |
---|
930 | if(ptr) |
---|
931 | *ptr = '\0'; |
---|
932 | buf = g_strdup_printf("CHAT CREATE %s\n", nick); |
---|
933 | skype_write(ic, buf, strlen(buf)); |
---|
934 | g_free(buf); |
---|
935 | sd->groupchat_with = g_strdup(nick); |
---|
936 | g_free(nick); |
---|
937 | /* We create a fake chat for now. We will replace it with a real one in |
---|
938 | * the real callback. */ |
---|
939 | return(imcb_chat_new( ic, "" )); |
---|
940 | } |
---|
941 | |
---|
942 | static void skype_get_info(struct im_connection *ic, char *who) |
---|
943 | { |
---|
944 | char *ptr, *nick, *buf; |
---|
945 | nick = g_strdup(who); |
---|
946 | ptr = strchr(nick, '@'); |
---|
947 | if(ptr) |
---|
948 | *ptr = '\0'; |
---|
949 | buf = g_strdup_printf("GET USER %s FULLNAME\n", nick); |
---|
950 | skype_write(ic, buf, strlen(buf)); |
---|
951 | g_free(buf); |
---|
952 | buf = g_strdup_printf("GET USER %s PHONE_HOME\n", nick); |
---|
953 | skype_write(ic, buf, strlen(buf)); |
---|
954 | g_free(buf); |
---|
955 | buf = g_strdup_printf("GET USER %s PHONE_OFFICE\n", nick); |
---|
956 | skype_write(ic, buf, strlen(buf)); |
---|
957 | g_free(buf); |
---|
958 | buf = g_strdup_printf("GET USER %s PHONE_MOBILE\n", nick); |
---|
959 | skype_write(ic, buf, strlen(buf)); |
---|
960 | g_free(buf); |
---|
961 | buf = g_strdup_printf("GET USER %s NROF_AUTHED_BUDDIES\n", nick); |
---|
962 | skype_write(ic, buf, strlen(buf)); |
---|
963 | g_free(buf); |
---|
964 | buf = g_strdup_printf("GET USER %s TIMEZONE\n", nick); |
---|
965 | skype_write(ic, buf, strlen(buf)); |
---|
966 | g_free(buf); |
---|
967 | buf = g_strdup_printf("GET USER %s LASTONLINETIMESTAMP\n", nick); |
---|
968 | skype_write(ic, buf, strlen(buf)); |
---|
969 | g_free(buf); |
---|
970 | buf = g_strdup_printf("GET USER %s BIRTHDAY\n", nick); |
---|
971 | skype_write(ic, buf, strlen(buf)); |
---|
972 | g_free(buf); |
---|
973 | buf = g_strdup_printf("GET USER %s SEX\n", nick); |
---|
974 | skype_write(ic, buf, strlen(buf)); |
---|
975 | g_free(buf); |
---|
976 | buf = g_strdup_printf("GET USER %s LANGUAGE\n", nick); |
---|
977 | skype_write(ic, buf, strlen(buf)); |
---|
978 | g_free(buf); |
---|
979 | buf = g_strdup_printf("GET USER %s COUNTRY\n", nick); |
---|
980 | skype_write(ic, buf, strlen(buf)); |
---|
981 | g_free(buf); |
---|
982 | buf = g_strdup_printf("GET USER %s PROVINCE\n", nick); |
---|
983 | skype_write(ic, buf, strlen(buf)); |
---|
984 | g_free(buf); |
---|
985 | buf = g_strdup_printf("GET USER %s CITY\n", nick); |
---|
986 | skype_write(ic, buf, strlen(buf)); |
---|
987 | g_free(buf); |
---|
988 | buf = g_strdup_printf("GET USER %s HOMEPAGE\n", nick); |
---|
989 | skype_write(ic, buf, strlen(buf)); |
---|
990 | g_free(buf); |
---|
991 | buf = g_strdup_printf("GET USER %s ABOUT\n", nick); |
---|
992 | skype_write(ic, buf, strlen(buf)); |
---|
993 | g_free(buf); |
---|
994 | } |
---|
995 | |
---|
996 | void init_plugin(void) |
---|
997 | { |
---|
998 | struct prpl *ret = g_new0( struct prpl, 1 ); |
---|
999 | |
---|
1000 | ret->name = "skype"; |
---|
1001 | ret->login = skype_login; |
---|
1002 | ret->init = skype_init; |
---|
1003 | ret->logout = skype_logout; |
---|
1004 | ret->buddy_msg = skype_buddy_msg; |
---|
1005 | ret->get_info = skype_get_info; |
---|
1006 | ret->away_states = skype_away_states; |
---|
1007 | ret->set_away = skype_set_away; |
---|
1008 | ret->add_buddy = skype_add_buddy; |
---|
1009 | ret->remove_buddy = skype_remove_buddy; |
---|
1010 | ret->chat_msg = skype_chat_msg; |
---|
1011 | ret->chat_leave = skype_chat_leave; |
---|
1012 | ret->chat_invite = skype_chat_invite; |
---|
1013 | ret->chat_with = skype_chat_with; |
---|
1014 | ret->handle_cmp = g_strcasecmp; |
---|
1015 | ret->chat_topic = skype_chat_topic; |
---|
1016 | register_protocol( ret ); |
---|
1017 | } |
---|