[7daec06] | 1 | /* |
---|
| 2 | * skype.c - Skype plugin for BitlBee |
---|
| 3 | * |
---|
[680920f] | 4 | * Copyright (c) 2007, 2008 by Miklos Vajna <vmiklos@frugalware.org> |
---|
[f06e3ac] | 5 | * |
---|
[7daec06] | 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. |
---|
[f06e3ac] | 24 | */ |
---|
[7daec06] | 25 | |
---|
[f9c3e7b] | 26 | #define _XOPEN_SOURCE |
---|
[f06e3ac] | 27 | #include <stdio.h> |
---|
[ed2e37f] | 28 | #include <poll.h> |
---|
[f06e3ac] | 29 | #include <bitlbee.h> |
---|
[c7304b2] | 30 | #include <bitlbee/ssl_client.h> |
---|
[72aa7f0] | 31 | #include <glib.h> |
---|
[f06e3ac] | 32 | |
---|
[f5aedd91] | 33 | #define SKYPE_DEFAULT_SERVER "localhost" |
---|
[4bbd9db] | 34 | #define SKYPE_DEFAULT_PORT "2727" |
---|
[f06e3ac] | 35 | |
---|
[bbba374] | 36 | /* |
---|
| 37 | * Enumerations |
---|
| 38 | */ |
---|
| 39 | |
---|
| 40 | typedef enum |
---|
| 41 | { |
---|
[df9255d] | 42 | SKYPE_CALL_RINGING = 1, |
---|
[9db0234] | 43 | SKYPE_CALL_MISSED, |
---|
[2eb4b1f] | 44 | SKYPE_CALL_CANCELLED, |
---|
[acd9478] | 45 | SKYPE_CALL_FINISHED, |
---|
[d87daf3] | 46 | SKYPE_CALL_REFUSED |
---|
[bbba374] | 47 | } skype_call_status; |
---|
| 48 | |
---|
[df9255d] | 49 | typedef enum |
---|
| 50 | { |
---|
| 51 | SKYPE_FILETRANSFER_NEW = 1, |
---|
| 52 | SKYPE_FILETRANSFER_FAILED |
---|
| 53 | } skype_filetransfer_status; |
---|
| 54 | |
---|
[7daec06] | 55 | /* |
---|
| 56 | * Structures |
---|
| 57 | */ |
---|
| 58 | |
---|
[f06e3ac] | 59 | struct skype_data |
---|
| 60 | { |
---|
| 61 | struct im_connection *ic; |
---|
[a3d6427] | 62 | char *username; |
---|
[368861e] | 63 | /* The effective file descriptor. We store it here so any function can |
---|
| 64 | * write() to it. */ |
---|
[f06e3ac] | 65 | int fd; |
---|
[368861e] | 66 | /* File descriptor returned by bitlbee. we store it so we know when |
---|
| 67 | * we're connected and when we aren't. */ |
---|
| 68 | int bfd; |
---|
[c7304b2] | 69 | /* ssl_getfd() uses this to get the file desciptor. */ |
---|
| 70 | void *ssl; |
---|
[2a0f99c] | 71 | /* When we receive a new message id, we query the properties, finally |
---|
| 72 | * the chatname. Store the properties here so that we can use |
---|
[c81d0ef] | 73 | * imcb_buddy_msg() when we got the chatname. */ |
---|
[77c1abe] | 74 | char *handle; |
---|
[a7af5f0] | 75 | /* List, because of multiline messages. */ |
---|
| 76 | GList *body; |
---|
[2a0f99c] | 77 | char *type; |
---|
[bbba374] | 78 | /* This is necessary because we send a notification when we get the |
---|
| 79 | * handle. So we store the state here and then we can send a |
---|
| 80 | * notification about the handle is in a given status. */ |
---|
| 81 | skype_call_status call_status; |
---|
[2eb4b1f] | 82 | char *call_id; |
---|
[48181f0] | 83 | char *call_duration; |
---|
[d87daf3] | 84 | /* If the call is outgoing or not */ |
---|
| 85 | int call_out; |
---|
[df9255d] | 86 | /* Same for file transfers. */ |
---|
| 87 | skype_filetransfer_status filetransfer_status; |
---|
[86278cd] | 88 | /* Using /j #nick we want to have a groupchat with two people. Usually |
---|
| 89 | * not (default). */ |
---|
| 90 | char* groupchat_with; |
---|
[f8674db] | 91 | /* The user who invited us to the chat. */ |
---|
| 92 | char* adder; |
---|
[a5f76a2] | 93 | /* If we are waiting for a confirmation about we changed the topic. */ |
---|
| 94 | int topic_wait; |
---|
[67454bd] | 95 | /* These are used by the info command. */ |
---|
| 96 | char *info_fullname; |
---|
| 97 | char *info_phonehome; |
---|
| 98 | char *info_phoneoffice; |
---|
| 99 | char *info_phonemobile; |
---|
| 100 | char *info_nrbuddies; |
---|
| 101 | char *info_tz; |
---|
| 102 | char *info_seen; |
---|
| 103 | char *info_birthday; |
---|
| 104 | char *info_sex; |
---|
| 105 | char *info_language; |
---|
| 106 | char *info_country; |
---|
| 107 | char *info_province; |
---|
| 108 | char *info_city; |
---|
| 109 | char *info_homepage; |
---|
| 110 | char *info_about; |
---|
[b054fad] | 111 | /* When a call fails, we get the reason and later we get the failure |
---|
| 112 | * event, so store the failure code here till then */ |
---|
| 113 | int failurereason; |
---|
[f06e3ac] | 114 | }; |
---|
| 115 | |
---|
[adce2de] | 116 | struct skype_away_state |
---|
| 117 | { |
---|
| 118 | char *code; |
---|
| 119 | char *full_name; |
---|
| 120 | }; |
---|
| 121 | |
---|
[7daec06] | 122 | struct skype_buddy_ask_data |
---|
| 123 | { |
---|
| 124 | struct im_connection *ic; |
---|
[e0074cb] | 125 | /* This is also used for call IDs for simplicity */ |
---|
[7daec06] | 126 | char *handle; |
---|
| 127 | }; |
---|
| 128 | |
---|
| 129 | /* |
---|
| 130 | * Tables |
---|
| 131 | */ |
---|
| 132 | |
---|
[adce2de] | 133 | const struct skype_away_state skype_away_state_list[] = |
---|
| 134 | { |
---|
| 135 | { "ONLINE", "Online" }, |
---|
| 136 | { "SKYPEME", "Skype Me" }, |
---|
| 137 | { "AWAY", "Away" }, |
---|
| 138 | { "NA", "Not available" }, |
---|
| 139 | { "DND", "Do Not Disturb" }, |
---|
| 140 | { "INVISIBLE", "Invisible" }, |
---|
[23411c6] | 141 | { "OFFLINE", "Offline" }, |
---|
| 142 | { NULL, NULL} |
---|
[adce2de] | 143 | }; |
---|
| 144 | |
---|
[7daec06] | 145 | /* |
---|
| 146 | * Functions |
---|
| 147 | */ |
---|
[d3cbd17] | 148 | |
---|
[f06e3ac] | 149 | int skype_write( struct im_connection *ic, char *buf, int len ) |
---|
| 150 | { |
---|
| 151 | struct skype_data *sd = ic->proto_data; |
---|
[1fb89e3] | 152 | struct pollfd pfd[1]; |
---|
| 153 | |
---|
| 154 | pfd[0].fd = sd->fd; |
---|
| 155 | pfd[0].events = POLLOUT; |
---|
[f06e3ac] | 156 | |
---|
[7daec06] | 157 | /* This poll is necessary or we'll get a SIGPIPE when we write() to |
---|
| 158 | * sd->fd. */ |
---|
[1fb89e3] | 159 | poll(pfd, 1, 1000); |
---|
| 160 | if(pfd[0].revents & POLLHUP) |
---|
| 161 | { |
---|
| 162 | imc_logout( ic, TRUE ); |
---|
| 163 | return FALSE; |
---|
| 164 | } |
---|
[c7304b2] | 165 | ssl_write( sd->ssl, buf, len ); |
---|
[f06e3ac] | 166 | |
---|
[9fd4241] | 167 | return TRUE; |
---|
[f06e3ac] | 168 | } |
---|
| 169 | |
---|
[d3cbd17] | 170 | static void skype_buddy_ask_yes( gpointer w, struct skype_buddy_ask_data *bla ) |
---|
| 171 | { |
---|
| 172 | char *buf = g_strdup_printf("SET USER %s ISAUTHORIZED TRUE", bla->handle); |
---|
| 173 | skype_write( bla->ic, buf, strlen( buf ) ); |
---|
| 174 | g_free(buf); |
---|
| 175 | g_free(bla->handle); |
---|
| 176 | g_free(bla); |
---|
| 177 | } |
---|
| 178 | |
---|
| 179 | static void skype_buddy_ask_no( gpointer w, struct skype_buddy_ask_data *bla ) |
---|
| 180 | { |
---|
| 181 | char *buf = g_strdup_printf("SET USER %s ISAUTHORIZED FALSE", bla->handle); |
---|
| 182 | skype_write( bla->ic, buf, strlen( buf ) ); |
---|
| 183 | g_free(buf); |
---|
| 184 | g_free(bla->handle); |
---|
| 185 | g_free(bla); |
---|
| 186 | } |
---|
| 187 | |
---|
| 188 | void skype_buddy_ask( struct im_connection *ic, char *handle, char *message) |
---|
| 189 | { |
---|
| 190 | struct skype_buddy_ask_data *bla = g_new0( struct skype_buddy_ask_data, 1 ); |
---|
| 191 | char *buf; |
---|
| 192 | |
---|
| 193 | bla->ic = ic; |
---|
| 194 | bla->handle = g_strdup(handle); |
---|
| 195 | |
---|
| 196 | buf = g_strdup_printf( "The user %s wants to add you to his/her buddy list, saying: '%s'.", handle, message); |
---|
| 197 | imcb_ask( ic, buf, bla, skype_buddy_ask_yes, skype_buddy_ask_no ); |
---|
| 198 | g_free( buf ); |
---|
| 199 | } |
---|
| 200 | |
---|
[e0074cb] | 201 | static void skype_call_ask_yes( gpointer w, struct skype_buddy_ask_data *bla ) |
---|
| 202 | { |
---|
| 203 | char *buf = g_strdup_printf("SET CALL %s STATUS INPROGRESS", bla->handle); |
---|
| 204 | skype_write( bla->ic, buf, strlen( buf ) ); |
---|
| 205 | g_free(buf); |
---|
| 206 | g_free(bla->handle); |
---|
| 207 | g_free(bla); |
---|
| 208 | } |
---|
| 209 | |
---|
| 210 | static void skype_call_ask_no( gpointer w, struct skype_buddy_ask_data *bla ) |
---|
| 211 | { |
---|
| 212 | char *buf = g_strdup_printf("SET CALL %s STATUS FINISHED", bla->handle); |
---|
| 213 | skype_write( bla->ic, buf, strlen( buf ) ); |
---|
| 214 | g_free(buf); |
---|
| 215 | g_free(bla->handle); |
---|
| 216 | g_free(bla); |
---|
| 217 | } |
---|
| 218 | |
---|
| 219 | void skype_call_ask( struct im_connection *ic, char *call_id, char *message) |
---|
| 220 | { |
---|
| 221 | struct skype_buddy_ask_data *bla = g_new0( struct skype_buddy_ask_data, 1 ); |
---|
| 222 | |
---|
| 223 | bla->ic = ic; |
---|
| 224 | bla->handle = g_strdup(call_id); |
---|
| 225 | |
---|
| 226 | imcb_ask( ic, message, bla, skype_call_ask_yes, skype_call_ask_no ); |
---|
| 227 | } |
---|
[72aa7f0] | 228 | struct groupchat *skype_chat_by_name( struct im_connection *ic, char *name ) |
---|
| 229 | { |
---|
| 230 | struct groupchat *ret; |
---|
| 231 | |
---|
[de2f05e] | 232 | for( ret = ic->groupchats; ret; ret = ret->next ) |
---|
[72aa7f0] | 233 | { |
---|
| 234 | if(strcmp(name, ret->title ) == 0 ) |
---|
| 235 | break; |
---|
| 236 | } |
---|
| 237 | |
---|
| 238 | return ret; |
---|
| 239 | } |
---|
| 240 | |
---|
[b054fad] | 241 | static char *skype_call_strerror(int err) |
---|
| 242 | { |
---|
| 243 | switch(err) { |
---|
| 244 | case 1: |
---|
| 245 | return "Miscellaneous error"; |
---|
| 246 | case 2: |
---|
| 247 | return "User or phone number does not exist."; |
---|
| 248 | case 3: |
---|
| 249 | return "User is offline"; |
---|
| 250 | case 4: |
---|
| 251 | return "No proxy found"; |
---|
| 252 | case 5: |
---|
| 253 | return "Session terminated."; |
---|
| 254 | case 6: |
---|
| 255 | return "No common codec found."; |
---|
| 256 | case 7: |
---|
| 257 | return "Sound I/O error."; |
---|
| 258 | case 8: |
---|
| 259 | return "Problem with remote sound device."; |
---|
| 260 | case 9: |
---|
| 261 | return "Call blocked by recipient."; |
---|
| 262 | case 10: |
---|
| 263 | return "Recipient not a friend."; |
---|
| 264 | case 11: |
---|
| 265 | return "Current user not authorized by recipient."; |
---|
| 266 | case 12: |
---|
| 267 | return "Sound recording error."; |
---|
| 268 | default: |
---|
| 269 | return "Unknown error"; |
---|
| 270 | } |
---|
| 271 | } |
---|
| 272 | |
---|
[1323e36] | 273 | static gboolean skype_read_callback( gpointer data, gint fd, b_input_condition cond ) |
---|
| 274 | { |
---|
| 275 | struct im_connection *ic = data; |
---|
| 276 | struct skype_data *sd = ic->proto_data; |
---|
| 277 | char buf[1024]; |
---|
| 278 | int st; |
---|
[9fd4241] | 279 | char **lines, **lineptr, *line, *ptr; |
---|
[1323e36] | 280 | |
---|
[98bca36] | 281 | if( !sd || sd->fd == -1 ) |
---|
[1323e36] | 282 | return FALSE; |
---|
[7daec06] | 283 | /* Read the whole data. */ |
---|
[c7304b2] | 284 | st = ssl_read( sd->ssl, buf, sizeof( buf ) ); |
---|
[1323e36] | 285 | if( st > 0 ) |
---|
| 286 | { |
---|
| 287 | buf[st] = '\0'; |
---|
[7daec06] | 288 | /* Then split it up to lines. */ |
---|
[9fd4241] | 289 | lines = g_strsplit(buf, "\n", 0); |
---|
| 290 | lineptr = lines; |
---|
| 291 | while((line = *lineptr)) |
---|
| 292 | { |
---|
| 293 | if(!strlen(line)) |
---|
| 294 | break; |
---|
| 295 | if(!strncmp(line, "USERS ", 6)) |
---|
| 296 | { |
---|
| 297 | char **i; |
---|
| 298 | char **nicks; |
---|
| 299 | |
---|
| 300 | nicks = g_strsplit(line + 6, ", ", 0); |
---|
| 301 | i = nicks; |
---|
| 302 | while(*i) |
---|
| 303 | { |
---|
| 304 | g_snprintf(buf, 1024, "GET USER %s ONLINESTATUS\n", *i); |
---|
| 305 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 306 | i++; |
---|
| 307 | } |
---|
| 308 | g_strfreev(nicks); |
---|
| 309 | } |
---|
| 310 | else if(!strncmp(line, "USER ", 5)) |
---|
| 311 | { |
---|
[adce2de] | 312 | int flags = 0; |
---|
[be975f8] | 313 | char *status = strrchr(line, ' '); |
---|
| 314 | char *user = strchr(line, ' '); |
---|
[adce2de] | 315 | status++; |
---|
[be975f8] | 316 | ptr = strchr(++user, ' '); |
---|
| 317 | *ptr = '\0'; |
---|
[6627d92] | 318 | ptr++; |
---|
[7daec06] | 319 | if(!strncmp(ptr, "ONLINESTATUS ", 13) && |
---|
| 320 | strcmp(user, sd->username) != 0 |
---|
| 321 | && strcmp(user, "echo123") != 0) |
---|
[a3d6427] | 322 | { |
---|
| 323 | ptr = g_strdup_printf("%s@skype.com", user); |
---|
| 324 | imcb_add_buddy(ic, ptr, NULL); |
---|
[d24b73f] | 325 | if(strcmp(status, "OFFLINE") != 0 && strcmp(status, "SKYPEOUT") != 0) |
---|
[a3d6427] | 326 | flags |= OPT_LOGGED_IN; |
---|
| 327 | if(strcmp(status, "ONLINE") != 0 && strcmp(status, "SKYPEME") != 0) |
---|
| 328 | flags |= OPT_AWAY; |
---|
| 329 | imcb_buddy_status(ic, ptr, flags, NULL, NULL); |
---|
| 330 | g_free(ptr); |
---|
| 331 | } |
---|
[d3cbd17] | 332 | else if(!strncmp(ptr, "RECEIVEDAUTHREQUEST ", 20)) |
---|
| 333 | { |
---|
| 334 | char *message = ptr + 20; |
---|
| 335 | if(strlen(message)) |
---|
| 336 | skype_buddy_ask(ic, user, message); |
---|
| 337 | } |
---|
| 338 | else if(!strncmp(ptr, "BUDDYSTATUS ", 12)) |
---|
| 339 | { |
---|
| 340 | char *st = ptr + 12; |
---|
| 341 | if(!strcmp(st, "3")) |
---|
| 342 | { |
---|
| 343 | char *buf = g_strdup_printf("%s@skype.com", user); |
---|
| 344 | imcb_add_buddy(ic, buf, NULL); |
---|
| 345 | g_free(buf); |
---|
| 346 | } |
---|
| 347 | } |
---|
[67454bd] | 348 | else if(!strncmp(ptr, "FULLNAME ", 9)) |
---|
| 349 | sd->info_fullname = g_strdup_printf("%s", ptr + 9); |
---|
[93052e1] | 350 | else if(!strncmp(ptr, "PHONE_HOME ", 11)) |
---|
| 351 | sd->info_phonehome = g_strdup_printf("%s", ptr + 11); |
---|
| 352 | else if(!strncmp(ptr, "PHONE_OFFICE ", 13)) |
---|
| 353 | sd->info_phoneoffice = g_strdup_printf("%s", ptr + 13); |
---|
| 354 | else if(!strncmp(ptr, "PHONE_MOBILE ", 13)) |
---|
| 355 | sd->info_phonemobile = g_strdup_printf("%s", ptr + 13); |
---|
| 356 | else if(!strncmp(ptr, "NROF_AUTHED_BUDDIES ", 20)) |
---|
| 357 | sd->info_nrbuddies = g_strdup_printf("%s", ptr + 20); |
---|
| 358 | else if(!strncmp(ptr, "TIMEZONE ", 9)) |
---|
| 359 | sd->info_tz = g_strdup_printf("%s", ptr + 9); |
---|
| 360 | else if(!strncmp(ptr, "LASTONLINETIMESTAMP ", 20)) |
---|
| 361 | sd->info_seen = g_strdup_printf("%s", ptr + 20); |
---|
| 362 | else if(!strncmp(ptr, "BIRTHDAY ", 9)) |
---|
| 363 | sd->info_birthday = g_strdup_printf("%s", ptr + 9); |
---|
| 364 | else if(!strncmp(ptr, "SEX ", 4)) |
---|
| 365 | sd->info_sex = g_strdup_printf("%s", ptr + 4); |
---|
| 366 | else if(!strncmp(ptr, "LANGUAGE ", 9)) |
---|
| 367 | sd->info_language = g_strdup_printf("%s", ptr + 9); |
---|
| 368 | else if(!strncmp(ptr, "COUNTRY ", 8)) |
---|
| 369 | sd->info_country = g_strdup_printf("%s", ptr + 8); |
---|
| 370 | else if(!strncmp(ptr, "PROVINCE ", 9)) |
---|
| 371 | sd->info_province = g_strdup_printf("%s", ptr + 9); |
---|
| 372 | else if(!strncmp(ptr, "CITY ", 5)) |
---|
| 373 | sd->info_city = g_strdup_printf("%s", ptr + 5); |
---|
| 374 | else if(!strncmp(ptr, "HOMEPAGE ", 9)) |
---|
| 375 | sd->info_homepage = g_strdup_printf("%s", ptr + 9); |
---|
[67454bd] | 376 | else if(!strncmp(ptr, "ABOUT ", 6)) |
---|
| 377 | { |
---|
| 378 | sd->info_about = g_strdup_printf("%s", ptr + 6); |
---|
| 379 | |
---|
[93052e1] | 380 | GString *st = g_string_new("Contact Information\n"); |
---|
[67454bd] | 381 | g_string_append_printf(st, "Skype Name: %s\n", user); |
---|
| 382 | if(sd->info_fullname) |
---|
| 383 | { |
---|
[93052e1] | 384 | if(strlen(sd->info_fullname)) |
---|
| 385 | g_string_append_printf(st, "Full Name: %s\n", sd->info_fullname); |
---|
[67454bd] | 386 | g_free(sd->info_fullname); |
---|
| 387 | } |
---|
[93052e1] | 388 | if(sd->info_phonehome) |
---|
| 389 | { |
---|
| 390 | if(strlen(sd->info_phonehome)) |
---|
| 391 | g_string_append_printf(st, "Home Phone: %s\n", sd->info_phonehome); |
---|
| 392 | g_free(sd->info_phonehome); |
---|
| 393 | } |
---|
| 394 | if(sd->info_phoneoffice) |
---|
| 395 | { |
---|
| 396 | if(strlen(sd->info_phoneoffice)) |
---|
| 397 | g_string_append_printf(st, "Office Phone: %s\n", sd->info_phoneoffice); |
---|
| 398 | g_free(sd->info_phoneoffice); |
---|
| 399 | } |
---|
| 400 | if(sd->info_phonemobile) |
---|
| 401 | { |
---|
| 402 | if(strlen(sd->info_phonemobile)) |
---|
| 403 | g_string_append_printf(st, "Mobile Phone: %s\n", sd->info_phonemobile); |
---|
| 404 | g_free(sd->info_phonemobile); |
---|
| 405 | } |
---|
| 406 | g_string_append_printf(st, "Personal Information\n"); |
---|
| 407 | if(sd->info_nrbuddies) |
---|
| 408 | { |
---|
| 409 | if(strlen(sd->info_nrbuddies)) |
---|
| 410 | g_string_append_printf(st, "Contacts: %s\n", sd->info_nrbuddies); |
---|
| 411 | g_free(sd->info_nrbuddies); |
---|
| 412 | } |
---|
| 413 | if(sd->info_tz) |
---|
| 414 | { |
---|
| 415 | if(strlen(sd->info_tz)) |
---|
[885efac6] | 416 | { |
---|
[33cac97] | 417 | char ib[256]; |
---|
| 418 | time_t t = time(NULL); |
---|
| 419 | t += atoi(sd->info_tz)-(60*60*24); |
---|
| 420 | struct tm *gt = gmtime(&t); |
---|
| 421 | strftime(ib, 256, "%H:%M:%S", gt); |
---|
| 422 | g_string_append_printf(st, "Local Time: %s\n", ib); |
---|
[885efac6] | 423 | } |
---|
[93052e1] | 424 | g_free(sd->info_tz); |
---|
| 425 | } |
---|
| 426 | if(sd->info_seen) |
---|
| 427 | { |
---|
| 428 | if(strlen(sd->info_seen)) |
---|
[885efac6] | 429 | { |
---|
[3c5aded] | 430 | char ib[256]; |
---|
| 431 | time_t it = atoi(sd->info_seen); |
---|
| 432 | struct tm *tm = localtime(&it); |
---|
| 433 | strftime(ib, 256, ("%Y. %m. %d. %H:%M"), tm); |
---|
| 434 | g_string_append_printf(st, "Last Seen: %s\n", ib); |
---|
[885efac6] | 435 | } |
---|
[93052e1] | 436 | g_free(sd->info_seen); |
---|
| 437 | } |
---|
| 438 | if(sd->info_birthday) |
---|
| 439 | { |
---|
[969f643] | 440 | if(strlen(sd->info_birthday) && strcmp(sd->info_birthday, "0")) |
---|
[885efac6] | 441 | { |
---|
[f9c3e7b] | 442 | char ib[256]; |
---|
| 443 | struct tm tm; |
---|
| 444 | strptime(sd->info_birthday, "%Y%m%d", &tm); |
---|
| 445 | strftime(ib, 256, "%B %d, %Y", &tm); |
---|
| 446 | g_string_append_printf(st, "Birthday: %s\n", ib); |
---|
[5b9847d] | 447 | |
---|
| 448 | strftime(ib, 256, "%Y", &tm); |
---|
| 449 | int year = atoi(ib); |
---|
| 450 | time_t t = time(NULL); |
---|
| 451 | struct tm *lt = localtime(&t); |
---|
| 452 | g_string_append_printf(st, "Age: %d\n", lt->tm_year+1900-year); |
---|
[885efac6] | 453 | } |
---|
[93052e1] | 454 | g_free(sd->info_birthday); |
---|
| 455 | } |
---|
| 456 | if(sd->info_sex) |
---|
| 457 | { |
---|
| 458 | if(strlen(sd->info_sex)) |
---|
[885efac6] | 459 | { |
---|
[6b43dd4] | 460 | char *iptr = sd->info_sex; |
---|
| 461 | while(*iptr++) |
---|
| 462 | *iptr = tolower(*iptr); |
---|
[93052e1] | 463 | g_string_append_printf(st, "Gender: %s\n", sd->info_sex); |
---|
[885efac6] | 464 | } |
---|
[93052e1] | 465 | g_free(sd->info_sex); |
---|
| 466 | } |
---|
| 467 | if(sd->info_language) |
---|
| 468 | { |
---|
| 469 | if(strlen(sd->info_language)) |
---|
[885efac6] | 470 | { |
---|
| 471 | char *iptr = strchr(sd->info_language, ' '); |
---|
| 472 | if(iptr) |
---|
| 473 | iptr++; |
---|
| 474 | else |
---|
| 475 | iptr = sd->info_language; |
---|
| 476 | g_string_append_printf(st, "Language: %s\n", iptr); |
---|
| 477 | } |
---|
[93052e1] | 478 | g_free(sd->info_language); |
---|
| 479 | } |
---|
| 480 | if(sd->info_country) |
---|
| 481 | { |
---|
| 482 | if(strlen(sd->info_country)) |
---|
[885efac6] | 483 | { |
---|
| 484 | char *iptr = strchr(sd->info_country, ' '); |
---|
| 485 | if(iptr) |
---|
| 486 | iptr++; |
---|
| 487 | else |
---|
| 488 | iptr = sd->info_country; |
---|
[191470d] | 489 | g_string_append_printf(st, "Country: %s\n", iptr); |
---|
[885efac6] | 490 | } |
---|
[93052e1] | 491 | g_free(sd->info_country); |
---|
| 492 | } |
---|
| 493 | if(sd->info_province) |
---|
| 494 | { |
---|
| 495 | if(strlen(sd->info_province)) |
---|
| 496 | g_string_append_printf(st, "Region: %s\n", sd->info_province); |
---|
| 497 | g_free(sd->info_province); |
---|
| 498 | } |
---|
| 499 | if(sd->info_city) |
---|
| 500 | { |
---|
| 501 | if(strlen(sd->info_city)) |
---|
| 502 | g_string_append_printf(st, "City: %s\n", sd->info_city); |
---|
| 503 | g_free(sd->info_city); |
---|
| 504 | } |
---|
| 505 | if(sd->info_homepage) |
---|
| 506 | { |
---|
| 507 | if(strlen(sd->info_homepage)) |
---|
| 508 | g_string_append_printf(st, "Homepage: %s\n", sd->info_homepage); |
---|
| 509 | g_free(sd->info_homepage); |
---|
| 510 | } |
---|
| 511 | if(sd->info_about) |
---|
| 512 | { |
---|
| 513 | if(strlen(sd->info_about)) |
---|
| 514 | g_string_append_printf(st, "%s\n", sd->info_about); |
---|
| 515 | g_free(sd->info_about); |
---|
| 516 | } |
---|
[67454bd] | 517 | imcb_log(ic, "%s", st->str); |
---|
| 518 | g_string_free(st, TRUE); |
---|
| 519 | } |
---|
[9fd4241] | 520 | } |
---|
[77c1abe] | 521 | else if(!strncmp(line, "CHATMESSAGE ", 12)) |
---|
| 522 | { |
---|
| 523 | char *id = strchr(line, ' '); |
---|
| 524 | if(++id) |
---|
| 525 | { |
---|
| 526 | char *info = strchr(id, ' '); |
---|
| 527 | *info = '\0'; |
---|
| 528 | info++; |
---|
| 529 | if(!strcmp(info, "STATUS RECEIVED")) |
---|
| 530 | { |
---|
[7daec06] | 531 | /* New message ID: |
---|
| 532 | * (1) Request its from field |
---|
| 533 | * (2) Request its body |
---|
[2a0f99c] | 534 | * (3) Request its type |
---|
| 535 | * (4) Query chatname |
---|
[7daec06] | 536 | */ |
---|
[77c1abe] | 537 | g_snprintf(buf, 1024, "GET CHATMESSAGE %s FROM_HANDLE\n", id); |
---|
| 538 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 539 | g_snprintf(buf, 1024, "GET CHATMESSAGE %s BODY\n", id); |
---|
| 540 | skype_write( ic, buf, strlen( buf ) ); |
---|
[2a0f99c] | 541 | g_snprintf(buf, 1024, "GET CHATMESSAGE %s TYPE\n", id); |
---|
| 542 | skype_write( ic, buf, strlen( buf ) ); |
---|
[c81d0ef] | 543 | g_snprintf(buf, 1024, "GET CHATMESSAGE %s CHATNAME\n", id); |
---|
| 544 | skype_write( ic, buf, strlen( buf ) ); |
---|
[77c1abe] | 545 | } |
---|
| 546 | else if(!strncmp(info, "FROM_HANDLE ", 12)) |
---|
| 547 | { |
---|
| 548 | info += 12; |
---|
[7daec06] | 549 | /* New from field value. Store |
---|
| 550 | * it, then we can later use it |
---|
| 551 | * when we got the message's |
---|
| 552 | * body. */ |
---|
[7613670] | 553 | g_free(sd->handle); |
---|
[77c1abe] | 554 | sd->handle = g_strdup_printf("%s@skype.com", info); |
---|
[5d1b0774] | 555 | } |
---|
| 556 | else if(!strncmp(info, "EDITED_BY ", 10)) |
---|
| 557 | { |
---|
| 558 | info += 10; |
---|
| 559 | /* This is the same as |
---|
| 560 | * FROM_HANDLE, except that we |
---|
| 561 | * never request these lines |
---|
| 562 | * from Skype, we just get |
---|
| 563 | * them. */ |
---|
| 564 | g_free(sd->handle); |
---|
| 565 | sd->handle = g_strdup_printf("%s@skype.com", info); |
---|
[77c1abe] | 566 | } |
---|
| 567 | else if(!strncmp(info, "BODY ", 5)) |
---|
| 568 | { |
---|
| 569 | info += 5; |
---|
[a7af5f0] | 570 | sd->body = g_list_append(sd->body, g_strdup(info)); |
---|
[c81d0ef] | 571 | } |
---|
[2a0f99c] | 572 | else if(!strncmp(info, "TYPE ", 5)) |
---|
| 573 | { |
---|
| 574 | info += 5; |
---|
| 575 | g_free(sd->type); |
---|
| 576 | sd->type = g_strdup(info); |
---|
| 577 | } |
---|
[c81d0ef] | 578 | else if(!strncmp(info, "CHATNAME ", 9)) |
---|
| 579 | { |
---|
| 580 | info += 9; |
---|
[2a0f99c] | 581 | if(sd->handle && sd->body && sd->type) |
---|
[7daec06] | 582 | { |
---|
[31870ae] | 583 | struct groupchat *gc = skype_chat_by_name(ic, info); |
---|
[a7af5f0] | 584 | int i; |
---|
| 585 | for(i=0;i<g_list_length(sd->body);i++) |
---|
[2a0f99c] | 586 | { |
---|
[a7af5f0] | 587 | char *body = g_list_nth_data(sd->body, i); |
---|
[54e6207] | 588 | if(!strcmp(sd->type, "SAID") || !strcmp(sd->type, "EMOTED")) |
---|
[a7af5f0] | 589 | { |
---|
[54e6207] | 590 | char *st; |
---|
| 591 | if(!strcmp(sd->type, "SAID")) |
---|
| 592 | st = g_strdup(body); |
---|
| 593 | else |
---|
| 594 | { |
---|
| 595 | st = g_strdup_printf("/me %s", body); |
---|
| 596 | } |
---|
[a7af5f0] | 597 | if(!gc) |
---|
| 598 | /* Private message */ |
---|
[54e6207] | 599 | imcb_buddy_msg(ic, sd->handle, st, 0, 0); |
---|
[a7af5f0] | 600 | else |
---|
| 601 | /* Groupchat message */ |
---|
[54e6207] | 602 | imcb_chat_msg(gc, sd->handle, st, 0, 0); |
---|
| 603 | g_free(st); |
---|
[a7af5f0] | 604 | } |
---|
| 605 | else if(!strcmp(sd->type, "SETTOPIC")) |
---|
| 606 | { |
---|
| 607 | if(gc) |
---|
[de2f05e] | 608 | imcb_chat_topic(gc, sd->handle, body, 0); |
---|
[a7af5f0] | 609 | } |
---|
| 610 | else if(!strcmp(sd->type, "LEFT")) |
---|
| 611 | { |
---|
| 612 | if(gc) |
---|
| 613 | imcb_chat_remove_buddy(gc, sd->handle, NULL); |
---|
| 614 | } |
---|
[2a0f99c] | 615 | } |
---|
[a7af5f0] | 616 | g_list_free(sd->body); |
---|
| 617 | sd->body = NULL; |
---|
[7daec06] | 618 | } |
---|
[77c1abe] | 619 | } |
---|
| 620 | } |
---|
| 621 | } |
---|
[ecfbc5d] | 622 | else if(!strncmp(line, "CALL ", 5)) |
---|
| 623 | { |
---|
| 624 | char *id = strchr(line, ' '); |
---|
| 625 | if(++id) |
---|
| 626 | { |
---|
| 627 | char *info = strchr(id, ' '); |
---|
| 628 | *info = '\0'; |
---|
| 629 | info++; |
---|
[b054fad] | 630 | if(!strncmp(info, "FAILUREREASON ", 14)) |
---|
| 631 | sd->failurereason = atoi(strchr(info, ' ')); |
---|
| 632 | else if(!strcmp(info, "STATUS RINGING")) |
---|
[ecfbc5d] | 633 | { |
---|
[e0074cb] | 634 | if(sd->call_id) |
---|
| 635 | g_free(sd->call_id); |
---|
| 636 | sd->call_id = g_strdup(id); |
---|
[ecfbc5d] | 637 | g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id); |
---|
| 638 | skype_write( ic, buf, strlen( buf ) ); |
---|
[d87daf3] | 639 | sd->call_status = SKYPE_CALL_RINGING; |
---|
[bbba374] | 640 | } |
---|
| 641 | else if(!strcmp(info, "STATUS MISSED")) |
---|
| 642 | { |
---|
| 643 | g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id); |
---|
| 644 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 645 | sd->call_status = SKYPE_CALL_MISSED; |
---|
[ecfbc5d] | 646 | } |
---|
[2eb4b1f] | 647 | else if(!strcmp(info, "STATUS CANCELLED")) |
---|
| 648 | { |
---|
[d87daf3] | 649 | g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id); |
---|
| 650 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 651 | sd->call_status = SKYPE_CALL_CANCELLED; |
---|
[2eb4b1f] | 652 | } |
---|
[acd9478] | 653 | else if(!strcmp(info, "STATUS FINISHED")) |
---|
| 654 | { |
---|
| 655 | g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id); |
---|
| 656 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 657 | sd->call_status = SKYPE_CALL_FINISHED; |
---|
| 658 | } |
---|
[a92fb07] | 659 | else if(!strcmp(info, "STATUS REFUSED")) |
---|
| 660 | { |
---|
| 661 | g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id); |
---|
| 662 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 663 | sd->call_status = SKYPE_CALL_REFUSED; |
---|
| 664 | } |
---|
[9db0234] | 665 | else if(!strcmp(info, "STATUS UNPLACED")) |
---|
[2eb4b1f] | 666 | { |
---|
| 667 | if(sd->call_id) |
---|
| 668 | g_free(sd->call_id); |
---|
| 669 | /* Save the ID for later usage (Cancel/Finish). */ |
---|
| 670 | sd->call_id = g_strdup(id); |
---|
[d87daf3] | 671 | sd->call_out = TRUE; |
---|
[2eb4b1f] | 672 | } |
---|
[b054fad] | 673 | else if(!strcmp(info, "STATUS FAILED")) |
---|
| 674 | { |
---|
| 675 | imcb_error(ic, "Call failed: %s", skype_call_strerror(sd->failurereason)); |
---|
[76eb071] | 676 | sd->call_id = NULL; |
---|
[b054fad] | 677 | } |
---|
[48181f0] | 678 | else if(!strncmp(info, "DURATION ", 9)) |
---|
| 679 | { |
---|
| 680 | if(sd->call_duration) |
---|
| 681 | g_free(sd->call_duration); |
---|
| 682 | sd->call_duration = g_strdup(info+9); |
---|
| 683 | } |
---|
[ecfbc5d] | 684 | else if(!strncmp(info, "PARTNER_HANDLE ", 15)) |
---|
| 685 | { |
---|
| 686 | info += 15; |
---|
[df9255d] | 687 | if(sd->call_status) { |
---|
| 688 | switch(sd->call_status) |
---|
| 689 | { |
---|
| 690 | case SKYPE_CALL_RINGING: |
---|
[d87daf3] | 691 | if(sd->call_out) |
---|
| 692 | imcb_log(ic, "You are currently ringing the user %s.", info); |
---|
| 693 | else |
---|
[e0074cb] | 694 | { |
---|
| 695 | g_snprintf(buf, 1024, "The user %s is currently ringing you.", info); |
---|
| 696 | skype_call_ask(ic, sd->call_id, buf); |
---|
| 697 | } |
---|
[df9255d] | 698 | break; |
---|
| 699 | case SKYPE_CALL_MISSED: |
---|
| 700 | imcb_log(ic, "You have missed a call from user %s.", info); |
---|
| 701 | break; |
---|
[2eb4b1f] | 702 | case SKYPE_CALL_CANCELLED: |
---|
| 703 | imcb_log(ic, "You cancelled the call to the user %s.", info); |
---|
[d87daf3] | 704 | sd->call_status = 0; |
---|
| 705 | sd->call_out = FALSE; |
---|
[acd9478] | 706 | break; |
---|
[a92fb07] | 707 | case SKYPE_CALL_REFUSED: |
---|
[d87daf3] | 708 | if(sd->call_out) |
---|
| 709 | imcb_log(ic, "The user %s refused the call.", info); |
---|
| 710 | else |
---|
| 711 | imcb_log(ic, "You refused the call from user %s.", info); |
---|
| 712 | sd->call_out = FALSE; |
---|
[a92fb07] | 713 | break; |
---|
[acd9478] | 714 | case SKYPE_CALL_FINISHED: |
---|
[48181f0] | 715 | if(sd->call_duration) |
---|
| 716 | imcb_log(ic, "You finished the call to the user %s (duration: %s seconds).", info, sd->call_duration); |
---|
| 717 | else |
---|
| 718 | imcb_log(ic, "You finished the call to the user %s.", info); |
---|
[d87daf3] | 719 | sd->call_out = FALSE; |
---|
[2eb4b1f] | 720 | break; |
---|
[9db0234] | 721 | default: |
---|
| 722 | /* Don't be noisy, ignore other statuses for now. */ |
---|
| 723 | break; |
---|
[df9255d] | 724 | } |
---|
| 725 | sd->call_status = 0; |
---|
| 726 | } |
---|
| 727 | } |
---|
| 728 | } |
---|
| 729 | } |
---|
| 730 | else if(!strncmp(line, "FILETRANSFER ", 13)) |
---|
| 731 | { |
---|
| 732 | char *id = strchr(line, ' '); |
---|
| 733 | if(++id) |
---|
| 734 | { |
---|
| 735 | char *info = strchr(id, ' '); |
---|
| 736 | *info = '\0'; |
---|
| 737 | info++; |
---|
| 738 | if(!strcmp(info, "STATUS NEW")) |
---|
| 739 | { |
---|
| 740 | g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id); |
---|
| 741 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 742 | sd->filetransfer_status = SKYPE_FILETRANSFER_NEW; |
---|
| 743 | } |
---|
| 744 | else if(!strcmp(info, "STATUS FAILED")) |
---|
| 745 | { |
---|
| 746 | g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id); |
---|
| 747 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 748 | sd->filetransfer_status = SKYPE_FILETRANSFER_FAILED; |
---|
| 749 | } |
---|
| 750 | else if(!strncmp(info, "PARTNER_HANDLE ", 15)) |
---|
| 751 | { |
---|
| 752 | info += 15; |
---|
| 753 | if(sd->filetransfer_status) { |
---|
| 754 | switch(sd->filetransfer_status) |
---|
| 755 | { |
---|
| 756 | case SKYPE_FILETRANSFER_NEW: |
---|
| 757 | imcb_log(ic, "The user %s offered a new file for you.", info); |
---|
| 758 | break; |
---|
| 759 | case SKYPE_FILETRANSFER_FAILED: |
---|
| 760 | imcb_log(ic, "Failed to transfer file from user %s.", info); |
---|
| 761 | break; |
---|
| 762 | } |
---|
| 763 | sd->filetransfer_status = 0; |
---|
[bbba374] | 764 | } |
---|
[ecfbc5d] | 765 | } |
---|
| 766 | } |
---|
| 767 | } |
---|
[2d07803] | 768 | else if(!strncmp(line, "CHAT ", 5)) |
---|
| 769 | { |
---|
| 770 | char *id = strchr(line, ' '); |
---|
| 771 | if(++id) |
---|
| 772 | { |
---|
| 773 | char *info = strchr(id, ' '); |
---|
[86f2683] | 774 | if(info) |
---|
| 775 | *info = '\0'; |
---|
[2d07803] | 776 | info++; |
---|
[5652d43] | 777 | /* Remove fake chat if we created one in skype_chat_with() */ |
---|
| 778 | struct groupchat *gc = skype_chat_by_name(ic, ""); |
---|
| 779 | if(gc) |
---|
| 780 | imcb_chat_free(gc); |
---|
[5a61e43f] | 781 | if(!strcmp(info, "STATUS MULTI_SUBSCRIBED")) |
---|
[72aa7f0] | 782 | { |
---|
[86278cd] | 783 | imcb_chat_new( ic, id ); |
---|
[f8674db] | 784 | g_snprintf(buf, 1024, "GET CHAT %s ADDER\n", id); |
---|
| 785 | skype_write(ic, buf, strlen(buf)); |
---|
| 786 | g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id); |
---|
| 787 | skype_write(ic, buf, strlen(buf)); |
---|
[86278cd] | 788 | } |
---|
| 789 | else if(!strcmp(info, "STATUS DIALOG") && sd->groupchat_with) |
---|
| 790 | { |
---|
[5652d43] | 791 | gc = imcb_chat_new( ic, id ); |
---|
[86278cd] | 792 | /* According to the docs this |
---|
| 793 | * is necessary. However it |
---|
| 794 | * does not seem the situation |
---|
| 795 | * and it would open an extra |
---|
| 796 | * window on our client, so |
---|
| 797 | * just leave it out. */ |
---|
| 798 | /*g_snprintf(buf, 1024, "OPEN CHAT %s\n", id); |
---|
| 799 | skype_write(ic, buf, strlen(buf));*/ |
---|
| 800 | g_snprintf(buf, 1024, "%s@skype.com", sd->groupchat_with); |
---|
| 801 | imcb_chat_add_buddy(gc, buf); |
---|
| 802 | imcb_chat_add_buddy(gc, sd->username); |
---|
| 803 | g_free(sd->groupchat_with); |
---|
| 804 | sd->groupchat_with = NULL; |
---|
[f8674db] | 805 | g_snprintf(buf, 1024, "GET CHAT %s ADDER\n", id); |
---|
| 806 | skype_write(ic, buf, strlen(buf)); |
---|
| 807 | g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id); |
---|
| 808 | skype_write(ic, buf, strlen(buf)); |
---|
[72aa7f0] | 809 | } |
---|
[ec159f1] | 810 | else if(!strcmp(info, "STATUS UNSUBSCRIBED")) |
---|
| 811 | { |
---|
[5652d43] | 812 | gc = skype_chat_by_name(ic, id); |
---|
[ec159f1] | 813 | if(gc) |
---|
| 814 | gc->data = (void*)FALSE; |
---|
| 815 | } |
---|
[f8674db] | 816 | else if(!strncmp(info, "ADDER ", 6)) |
---|
| 817 | { |
---|
| 818 | info += 6; |
---|
| 819 | g_free(sd->adder); |
---|
| 820 | sd->adder = g_strdup_printf("%s@skype.com", info); |
---|
| 821 | } |
---|
[d601f9b] | 822 | else if(!strncmp(info, "TOPIC ", 6)) |
---|
| 823 | { |
---|
| 824 | info += 6; |
---|
[5652d43] | 825 | gc = skype_chat_by_name(ic, id); |
---|
[a5f76a2] | 826 | if(gc && (sd->adder || sd->topic_wait)) |
---|
[f8674db] | 827 | { |
---|
[a5f76a2] | 828 | if(sd->topic_wait) |
---|
| 829 | { |
---|
| 830 | sd->adder = g_strdup(sd->username); |
---|
| 831 | sd->topic_wait = 0; |
---|
| 832 | } |
---|
| 833 | imcb_chat_topic(gc, sd->adder, info, 0); |
---|
[f8674db] | 834 | g_free(sd->adder); |
---|
| 835 | sd->adder = NULL; |
---|
| 836 | } |
---|
[d601f9b] | 837 | } |
---|
[72aa7f0] | 838 | else if(!strncmp(info, "ACTIVEMEMBERS ", 14)) |
---|
| 839 | { |
---|
| 840 | info += 14; |
---|
[5652d43] | 841 | gc = skype_chat_by_name(ic, id); |
---|
[ec159f1] | 842 | /* Hack! We set ->data to TRUE |
---|
| 843 | * while we're on the channel |
---|
| 844 | * so that we won't rejoin |
---|
| 845 | * after a /part. */ |
---|
| 846 | if(gc && !gc->data) |
---|
[72aa7f0] | 847 | { |
---|
[349ee4a] | 848 | char **members = g_strsplit(info, " ", 0); |
---|
| 849 | int i; |
---|
| 850 | for(i=0;members[i];i++) |
---|
| 851 | { |
---|
| 852 | if(!strcmp(members[i], sd->username)) |
---|
| 853 | continue; |
---|
| 854 | g_snprintf(buf, 1024, "%s@skype.com", members[i]); |
---|
[c09d327] | 855 | if(!g_list_find_custom(gc->in_room, buf, (GCompareFunc)strcmp)) |
---|
| 856 | imcb_chat_add_buddy(gc, buf); |
---|
[349ee4a] | 857 | } |
---|
| 858 | imcb_chat_add_buddy(gc, sd->username); |
---|
| 859 | g_strfreev(members); |
---|
[72aa7f0] | 860 | } |
---|
| 861 | } |
---|
[2d07803] | 862 | } |
---|
| 863 | } |
---|
[c7304b2] | 864 | else if(!strncmp(line, "PASSWORD ", 9)) |
---|
| 865 | { |
---|
| 866 | if(!strncmp(line+9, "OK", 2)) |
---|
| 867 | imcb_connected(ic); |
---|
| 868 | else |
---|
| 869 | { |
---|
| 870 | imcb_error(ic, "Authentication Failed"); |
---|
| 871 | imc_logout( ic, TRUE ); |
---|
| 872 | } |
---|
| 873 | } |
---|
[b7d3dff7] | 874 | else if(!strncmp(line, "PROFILE PSTN_BALANCE ", 21)) |
---|
| 875 | { |
---|
| 876 | imcb_log(ic, "SkypeOut balance value is '%s'.", line+21); |
---|
| 877 | } |
---|
[9fd4241] | 878 | lineptr++; |
---|
| 879 | } |
---|
| 880 | g_strfreev(lines); |
---|
[1323e36] | 881 | } |
---|
| 882 | else if( st == 0 || ( st < 0 && !sockerr_again() ) ) |
---|
| 883 | { |
---|
| 884 | closesocket( sd->fd ); |
---|
| 885 | sd->fd = -1; |
---|
| 886 | |
---|
| 887 | imcb_error( ic, "Error while reading from server" ); |
---|
| 888 | imc_logout( ic, TRUE ); |
---|
| 889 | return FALSE; |
---|
| 890 | } |
---|
| 891 | return TRUE; |
---|
| 892 | } |
---|
| 893 | |
---|
[f06e3ac] | 894 | gboolean skype_start_stream( struct im_connection *ic ) |
---|
| 895 | { |
---|
[1323e36] | 896 | struct skype_data *sd = ic->proto_data; |
---|
[f06e3ac] | 897 | char *buf; |
---|
| 898 | int st; |
---|
| 899 | |
---|
[1fb89e3] | 900 | if(!sd) |
---|
| 901 | return FALSE; |
---|
| 902 | |
---|
[368861e] | 903 | if( sd->bfd <= 0 ) |
---|
| 904 | sd->bfd = b_input_add( sd->fd, GAIM_INPUT_READ, skype_read_callback, ic ); |
---|
[1323e36] | 905 | |
---|
[a0b206b] | 906 | /* Log in */ |
---|
| 907 | buf = g_strdup_printf("USERNAME %s\n", ic->acc->user); |
---|
| 908 | st = skype_write( ic, buf, strlen( buf ) ); |
---|
| 909 | g_free(buf); |
---|
| 910 | buf = g_strdup_printf("PASSWORD %s\n", ic->acc->pass); |
---|
| 911 | st = skype_write( ic, buf, strlen( buf ) ); |
---|
| 912 | g_free(buf); |
---|
| 913 | |
---|
[7daec06] | 914 | /* This will download all buddies. */ |
---|
[9fd4241] | 915 | buf = g_strdup_printf("SEARCH FRIENDS\n"); |
---|
[f06e3ac] | 916 | st = skype_write( ic, buf, strlen( buf ) ); |
---|
| 917 | g_free(buf); |
---|
[348a3a2] | 918 | buf = g_strdup_printf("SET USERSTATUS ONLINE\n"); |
---|
| 919 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 920 | g_free(buf); |
---|
[f06e3ac] | 921 | return st; |
---|
| 922 | } |
---|
| 923 | |
---|
[c7304b2] | 924 | gboolean skype_connected( gpointer data, void *source, b_input_condition cond ) |
---|
[f06e3ac] | 925 | { |
---|
| 926 | struct im_connection *ic = data; |
---|
[c7304b2] | 927 | struct skype_data *sd = ic->proto_data; |
---|
| 928 | if(!source) |
---|
| 929 | { |
---|
| 930 | sd->ssl = NULL; |
---|
| 931 | imcb_error( ic, "Could not connect to server" ); |
---|
| 932 | imc_logout( ic, TRUE ); |
---|
| 933 | return FALSE; |
---|
| 934 | } |
---|
| 935 | imcb_log( ic, "Connected to server, logging in" ); |
---|
[f06e3ac] | 936 | return skype_start_stream(ic); |
---|
| 937 | } |
---|
| 938 | |
---|
| 939 | static void skype_login( account_t *acc ) |
---|
| 940 | { |
---|
| 941 | struct im_connection *ic = imcb_new( acc ); |
---|
| 942 | struct skype_data *sd = g_new0( struct skype_data, 1 ); |
---|
| 943 | |
---|
| 944 | ic->proto_data = sd; |
---|
| 945 | |
---|
| 946 | imcb_log( ic, "Connecting" ); |
---|
[c7304b2] | 947 | sd->ssl = ssl_connect(set_getstr( &acc->set, "server" ), set_getint( &acc->set, "port" ), skype_connected, ic ); |
---|
| 948 | sd->fd = sd->ssl ? ssl_getfd( sd->ssl ) : -1; |
---|
[a3d6427] | 949 | sd->username = g_strdup( acc->user ); |
---|
[f06e3ac] | 950 | |
---|
| 951 | sd->ic = ic; |
---|
| 952 | } |
---|
| 953 | |
---|
| 954 | static void skype_logout( struct im_connection *ic ) |
---|
| 955 | { |
---|
| 956 | struct skype_data *sd = ic->proto_data; |
---|
[98bca36] | 957 | char *buf; |
---|
| 958 | |
---|
| 959 | buf = g_strdup_printf("SET USERSTATUS OFFLINE\n"); |
---|
| 960 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 961 | g_free(buf); |
---|
| 962 | |
---|
[a3d6427] | 963 | g_free(sd->username); |
---|
[7613670] | 964 | g_free(sd->handle); |
---|
[f06e3ac] | 965 | g_free(sd); |
---|
[98bca36] | 966 | ic->proto_data = NULL; |
---|
[f06e3ac] | 967 | } |
---|
| 968 | |
---|
[93ece66] | 969 | static int skype_buddy_msg( struct im_connection *ic, char *who, char *message, int flags ) |
---|
| 970 | { |
---|
[77c1abe] | 971 | char *buf, *ptr, *nick; |
---|
[93ece66] | 972 | int st; |
---|
| 973 | |
---|
[cbec0d6] | 974 | nick = g_strdup(who); |
---|
[77c1abe] | 975 | ptr = strchr(nick, '@'); |
---|
[0bb1b7f] | 976 | if(ptr) |
---|
| 977 | *ptr = '\0'; |
---|
[93ece66] | 978 | |
---|
[77c1abe] | 979 | buf = g_strdup_printf("MESSAGE %s %s\n", nick, message); |
---|
| 980 | g_free(nick); |
---|
[93ece66] | 981 | st = skype_write( ic, buf, strlen( buf ) ); |
---|
| 982 | g_free(buf); |
---|
| 983 | |
---|
| 984 | return st; |
---|
| 985 | } |
---|
| 986 | |
---|
[23411c6] | 987 | const struct skype_away_state *skype_away_state_by_name( char *name ) |
---|
| 988 | { |
---|
| 989 | int i; |
---|
| 990 | |
---|
| 991 | for( i = 0; skype_away_state_list[i].full_name; i ++ ) |
---|
| 992 | if( g_strcasecmp( skype_away_state_list[i].full_name, name ) == 0 ) |
---|
| 993 | return( skype_away_state_list + i ); |
---|
| 994 | |
---|
| 995 | return NULL; |
---|
| 996 | } |
---|
| 997 | |
---|
[f06e3ac] | 998 | static void skype_set_away( struct im_connection *ic, char *state_txt, char *message ) |
---|
| 999 | { |
---|
[23411c6] | 1000 | const struct skype_away_state *state; |
---|
| 1001 | char *buf; |
---|
| 1002 | |
---|
| 1003 | if( strcmp( state_txt, GAIM_AWAY_CUSTOM ) == 0 ) |
---|
| 1004 | state = skype_away_state_by_name( "Away" ); |
---|
| 1005 | else |
---|
| 1006 | state = skype_away_state_by_name( state_txt ); |
---|
| 1007 | buf = g_strdup_printf("SET USERSTATUS %s\n", state->code); |
---|
| 1008 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 1009 | g_free(buf); |
---|
[f06e3ac] | 1010 | } |
---|
| 1011 | |
---|
| 1012 | static GList *skype_away_states( struct im_connection *ic ) |
---|
| 1013 | { |
---|
[de2f05e] | 1014 | static GList *l = NULL; |
---|
[adce2de] | 1015 | int i; |
---|
| 1016 | |
---|
[de2f05e] | 1017 | if( l == NULL ) |
---|
| 1018 | for( i = 0; skype_away_state_list[i].full_name; i ++ ) |
---|
| 1019 | l = g_list_append( l, (void*) skype_away_state_list[i].full_name ); |
---|
[adce2de] | 1020 | |
---|
[f06e3ac] | 1021 | return l; |
---|
| 1022 | } |
---|
| 1023 | |
---|
[93dffea] | 1024 | static char *skype_set_display_name( set_t *set, char *value ) |
---|
| 1025 | { |
---|
| 1026 | account_t *acc = set->data; |
---|
| 1027 | struct im_connection *ic = acc->ic; |
---|
| 1028 | char *buf; |
---|
| 1029 | |
---|
[fcef6e6] | 1030 | buf = g_strdup_printf("SET PROFILE FULLNAME %s", value); |
---|
[93dffea] | 1031 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 1032 | g_free(buf); |
---|
| 1033 | return(value); |
---|
| 1034 | } |
---|
| 1035 | |
---|
[2af671a] | 1036 | static char *skype_set_balance( set_t *set, char *value ) |
---|
| 1037 | { |
---|
| 1038 | account_t *acc = set->data; |
---|
| 1039 | struct im_connection *ic = acc->ic; |
---|
| 1040 | char *buf; |
---|
| 1041 | |
---|
| 1042 | buf = g_strdup_printf("GET PROFILE PSTN_BALANCE"); |
---|
| 1043 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 1044 | g_free(buf); |
---|
| 1045 | return(value); |
---|
| 1046 | } |
---|
| 1047 | |
---|
[b68b023] | 1048 | static char *skype_set_call( set_t *set, char *value ) |
---|
| 1049 | { |
---|
| 1050 | account_t *acc = set->data; |
---|
| 1051 | struct im_connection *ic = acc->ic; |
---|
[2eb4b1f] | 1052 | struct skype_data *sd = ic->proto_data; |
---|
[b68b023] | 1053 | char *nick, *ptr, *buf; |
---|
| 1054 | |
---|
[2eb4b1f] | 1055 | if(value) |
---|
[b68b023] | 1056 | { |
---|
[2eb4b1f] | 1057 | user_t *u = user_find(acc->irc, value); |
---|
| 1058 | /* We are starting a call */ |
---|
[51dc72d] | 1059 | if(!u) |
---|
| 1060 | nick = g_strdup(value); |
---|
[a317ba6] | 1061 | else |
---|
| 1062 | nick = g_strdup(u->handle); |
---|
[2eb4b1f] | 1063 | ptr = strchr(nick, '@'); |
---|
| 1064 | if(ptr) |
---|
| 1065 | *ptr = '\0'; |
---|
| 1066 | |
---|
| 1067 | buf = g_strdup_printf("CALL %s", nick); |
---|
| 1068 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 1069 | g_free(buf); |
---|
| 1070 | g_free(nick); |
---|
| 1071 | } |
---|
| 1072 | else |
---|
| 1073 | { |
---|
| 1074 | /* We are ending a call */ |
---|
| 1075 | if(sd->call_id) |
---|
| 1076 | { |
---|
| 1077 | buf = g_strdup_printf("SET CALL %s STATUS FINISHED", sd->call_id); |
---|
| 1078 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 1079 | g_free(buf); |
---|
[9fd7202] | 1080 | g_free(sd->call_id); |
---|
| 1081 | sd->call_id = NULL; |
---|
[2eb4b1f] | 1082 | } |
---|
| 1083 | else |
---|
| 1084 | { |
---|
| 1085 | imcb_error(ic, "There are no active calls currently."); |
---|
| 1086 | } |
---|
[b68b023] | 1087 | } |
---|
| 1088 | return(value); |
---|
| 1089 | } |
---|
| 1090 | |
---|
[f06e3ac] | 1091 | static void skype_add_buddy( struct im_connection *ic, char *who, char *group ) |
---|
| 1092 | { |
---|
[6627d92] | 1093 | char *buf, *nick, *ptr; |
---|
| 1094 | |
---|
[cbec0d6] | 1095 | nick = g_strdup(who); |
---|
[6627d92] | 1096 | ptr = strchr(nick, '@'); |
---|
| 1097 | if(ptr) |
---|
| 1098 | *ptr = '\0'; |
---|
| 1099 | buf = g_strdup_printf("SET USER %s BUDDYSTATUS 2 Please authorize me\n", nick); |
---|
| 1100 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 1101 | g_free(nick); |
---|
[f06e3ac] | 1102 | } |
---|
| 1103 | |
---|
| 1104 | static void skype_remove_buddy( struct im_connection *ic, char *who, char *group ) |
---|
| 1105 | { |
---|
[6627d92] | 1106 | char *buf, *nick, *ptr; |
---|
| 1107 | |
---|
[cbec0d6] | 1108 | nick = g_strdup(who); |
---|
[6627d92] | 1109 | ptr = strchr(nick, '@'); |
---|
| 1110 | if(ptr) |
---|
| 1111 | *ptr = '\0'; |
---|
| 1112 | buf = g_strdup_printf("SET USER %s BUDDYSTATUS 1\n", nick); |
---|
| 1113 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 1114 | g_free(nick); |
---|
[f06e3ac] | 1115 | } |
---|
| 1116 | |
---|
[79e20f9] | 1117 | void skype_chat_msg( struct groupchat *gc, char *message, int flags ) |
---|
[66c9558] | 1118 | { |
---|
[79e20f9] | 1119 | struct im_connection *ic = gc->ic; |
---|
| 1120 | char *buf; |
---|
| 1121 | buf = g_strdup_printf("CHATMESSAGE %s %s\n", gc->title, message); |
---|
| 1122 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 1123 | g_free(buf); |
---|
[66c9558] | 1124 | } |
---|
| 1125 | |
---|
[b01dc6c] | 1126 | void skype_chat_leave( struct groupchat *gc ) |
---|
| 1127 | { |
---|
| 1128 | struct im_connection *ic = gc->ic; |
---|
| 1129 | char *buf; |
---|
| 1130 | buf = g_strdup_printf("ALTER CHAT %s LEAVE\n", gc->title); |
---|
| 1131 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 1132 | g_free(buf); |
---|
[760319d] | 1133 | gc->data = (void*)TRUE; |
---|
| 1134 | } |
---|
| 1135 | |
---|
| 1136 | void skype_chat_invite(struct groupchat *gc, char *who, char *message) |
---|
| 1137 | { |
---|
| 1138 | struct im_connection *ic = gc->ic; |
---|
| 1139 | char *buf, *ptr, *nick; |
---|
| 1140 | nick = g_strdup(message); |
---|
| 1141 | ptr = strchr(nick, '@'); |
---|
| 1142 | if(ptr) |
---|
| 1143 | *ptr = '\0'; |
---|
| 1144 | buf = g_strdup_printf("ALTER CHAT %s ADDMEMBERS %s\n", gc->title, nick); |
---|
| 1145 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 1146 | g_free(buf); |
---|
| 1147 | g_free(nick); |
---|
[b01dc6c] | 1148 | } |
---|
| 1149 | |
---|
[09e2a69] | 1150 | void skype_chat_topic(struct groupchat *gc, char *message) |
---|
| 1151 | { |
---|
| 1152 | struct im_connection *ic = gc->ic; |
---|
[a5f76a2] | 1153 | struct skype_data *sd = ic->proto_data; |
---|
[09e2a69] | 1154 | char *buf; |
---|
| 1155 | buf = g_strdup_printf("ALTER CHAT %s SETTOPIC %s\n", gc->title, message); |
---|
| 1156 | skype_write( ic, buf, strlen( buf ) ); |
---|
| 1157 | g_free(buf); |
---|
[a5f76a2] | 1158 | sd->topic_wait = 1; |
---|
[09e2a69] | 1159 | } |
---|
| 1160 | |
---|
[86278cd] | 1161 | struct groupchat *skype_chat_with(struct im_connection *ic, char *who) |
---|
| 1162 | { |
---|
| 1163 | struct skype_data *sd = ic->proto_data; |
---|
| 1164 | char *ptr, *nick, *buf; |
---|
| 1165 | nick = g_strdup(who); |
---|
| 1166 | ptr = strchr(nick, '@'); |
---|
| 1167 | if(ptr) |
---|
| 1168 | *ptr = '\0'; |
---|
| 1169 | buf = g_strdup_printf("CHAT CREATE %s\n", nick); |
---|
| 1170 | skype_write(ic, buf, strlen(buf)); |
---|
| 1171 | g_free(buf); |
---|
| 1172 | sd->groupchat_with = g_strdup(nick); |
---|
| 1173 | g_free(nick); |
---|
[5652d43] | 1174 | /* We create a fake chat for now. We will replace it with a real one in |
---|
| 1175 | * the real callback. */ |
---|
| 1176 | return(imcb_chat_new( ic, "" )); |
---|
[86278cd] | 1177 | } |
---|
| 1178 | |
---|
[67454bd] | 1179 | static void skype_get_info(struct im_connection *ic, char *who) |
---|
| 1180 | { |
---|
| 1181 | char *ptr, *nick, *buf; |
---|
| 1182 | nick = g_strdup(who); |
---|
| 1183 | ptr = strchr(nick, '@'); |
---|
| 1184 | if(ptr) |
---|
| 1185 | *ptr = '\0'; |
---|
| 1186 | buf = g_strdup_printf("GET USER %s FULLNAME\n", nick); |
---|
| 1187 | skype_write(ic, buf, strlen(buf)); |
---|
| 1188 | g_free(buf); |
---|
| 1189 | buf = g_strdup_printf("GET USER %s PHONE_HOME\n", nick); |
---|
| 1190 | skype_write(ic, buf, strlen(buf)); |
---|
| 1191 | g_free(buf); |
---|
| 1192 | buf = g_strdup_printf("GET USER %s PHONE_OFFICE\n", nick); |
---|
| 1193 | skype_write(ic, buf, strlen(buf)); |
---|
| 1194 | g_free(buf); |
---|
| 1195 | buf = g_strdup_printf("GET USER %s PHONE_MOBILE\n", nick); |
---|
| 1196 | skype_write(ic, buf, strlen(buf)); |
---|
| 1197 | g_free(buf); |
---|
| 1198 | buf = g_strdup_printf("GET USER %s NROF_AUTHED_BUDDIES\n", nick); |
---|
| 1199 | skype_write(ic, buf, strlen(buf)); |
---|
| 1200 | g_free(buf); |
---|
| 1201 | buf = g_strdup_printf("GET USER %s TIMEZONE\n", nick); |
---|
| 1202 | skype_write(ic, buf, strlen(buf)); |
---|
| 1203 | g_free(buf); |
---|
| 1204 | buf = g_strdup_printf("GET USER %s LASTONLINETIMESTAMP\n", nick); |
---|
| 1205 | skype_write(ic, buf, strlen(buf)); |
---|
| 1206 | g_free(buf); |
---|
| 1207 | buf = g_strdup_printf("GET USER %s BIRTHDAY\n", nick); |
---|
| 1208 | skype_write(ic, buf, strlen(buf)); |
---|
| 1209 | g_free(buf); |
---|
| 1210 | buf = g_strdup_printf("GET USER %s SEX\n", nick); |
---|
| 1211 | skype_write(ic, buf, strlen(buf)); |
---|
| 1212 | g_free(buf); |
---|
| 1213 | buf = g_strdup_printf("GET USER %s LANGUAGE\n", nick); |
---|
| 1214 | skype_write(ic, buf, strlen(buf)); |
---|
| 1215 | g_free(buf); |
---|
| 1216 | buf = g_strdup_printf("GET USER %s COUNTRY\n", nick); |
---|
| 1217 | skype_write(ic, buf, strlen(buf)); |
---|
| 1218 | g_free(buf); |
---|
| 1219 | buf = g_strdup_printf("GET USER %s PROVINCE\n", nick); |
---|
| 1220 | skype_write(ic, buf, strlen(buf)); |
---|
| 1221 | g_free(buf); |
---|
| 1222 | buf = g_strdup_printf("GET USER %s CITY\n", nick); |
---|
| 1223 | skype_write(ic, buf, strlen(buf)); |
---|
| 1224 | g_free(buf); |
---|
| 1225 | buf = g_strdup_printf("GET USER %s HOMEPAGE\n", nick); |
---|
| 1226 | skype_write(ic, buf, strlen(buf)); |
---|
| 1227 | g_free(buf); |
---|
| 1228 | buf = g_strdup_printf("GET USER %s ABOUT\n", nick); |
---|
| 1229 | skype_write(ic, buf, strlen(buf)); |
---|
| 1230 | g_free(buf); |
---|
| 1231 | } |
---|
| 1232 | |
---|
[93dffea] | 1233 | static void skype_set_my_name( struct im_connection *ic, char *info ) |
---|
| 1234 | { |
---|
| 1235 | skype_set_display_name( set_find( &ic->acc->set, "display_name" ), info ); |
---|
| 1236 | } |
---|
| 1237 | |
---|
| 1238 | static void skype_init( account_t *acc ) |
---|
| 1239 | { |
---|
| 1240 | set_t *s; |
---|
| 1241 | |
---|
| 1242 | s = set_add( &acc->set, "server", SKYPE_DEFAULT_SERVER, set_eval_account, acc ); |
---|
| 1243 | s->flags |= ACC_SET_OFFLINE_ONLY; |
---|
| 1244 | |
---|
| 1245 | s = set_add( &acc->set, "port", SKYPE_DEFAULT_PORT, set_eval_int, acc ); |
---|
| 1246 | s->flags |= ACC_SET_OFFLINE_ONLY; |
---|
| 1247 | |
---|
| 1248 | s = set_add( &acc->set, "display_name", NULL, skype_set_display_name, acc ); |
---|
| 1249 | s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY; |
---|
[b68b023] | 1250 | |
---|
| 1251 | s = set_add( &acc->set, "call", NULL, skype_set_call, acc ); |
---|
| 1252 | s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY; |
---|
[2af671a] | 1253 | |
---|
| 1254 | s = set_add( &acc->set, "balance", NULL, skype_set_balance, acc ); |
---|
| 1255 | s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY; |
---|
[93dffea] | 1256 | } |
---|
| 1257 | |
---|
[f06e3ac] | 1258 | void init_plugin(void) |
---|
| 1259 | { |
---|
| 1260 | struct prpl *ret = g_new0( struct prpl, 1 ); |
---|
| 1261 | |
---|
| 1262 | ret->name = "skype"; |
---|
| 1263 | ret->login = skype_login; |
---|
| 1264 | ret->init = skype_init; |
---|
| 1265 | ret->logout = skype_logout; |
---|
[93ece66] | 1266 | ret->buddy_msg = skype_buddy_msg; |
---|
[67454bd] | 1267 | ret->get_info = skype_get_info; |
---|
[93dffea] | 1268 | ret->set_my_name = skype_set_my_name; |
---|
[f06e3ac] | 1269 | ret->away_states = skype_away_states; |
---|
[7daec06] | 1270 | ret->set_away = skype_set_away; |
---|
[f06e3ac] | 1271 | ret->add_buddy = skype_add_buddy; |
---|
| 1272 | ret->remove_buddy = skype_remove_buddy; |
---|
[66c9558] | 1273 | ret->chat_msg = skype_chat_msg; |
---|
[b01dc6c] | 1274 | ret->chat_leave = skype_chat_leave; |
---|
[760319d] | 1275 | ret->chat_invite = skype_chat_invite; |
---|
[86278cd] | 1276 | ret->chat_with = skype_chat_with; |
---|
[f06e3ac] | 1277 | ret->handle_cmp = g_strcasecmp; |
---|
[09e2a69] | 1278 | ret->chat_topic = skype_chat_topic; |
---|
[f06e3ac] | 1279 | register_protocol( ret ); |
---|
| 1280 | } |
---|
[6172871] | 1281 | |
---|
| 1282 | /* vim: set ts=2 sw=2 noet: */ |
---|