source: skype/skype.c @ 6adca511

Last change on this file since 6adca511 was 86278cd, checked in by VMiklos <vmiklos@…>, at 2007-10-07T14:36:03Z

implement skype_chat_with()
so that '/j #nick' is possible: we can start a group chat now, too

  • Property mode set to 100644
File size: 17.8 KB
Line 
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#include <stdio.h>
27#include <poll.h>
28#include <bitlbee.h>
29#include <glib.h>
30
31#define SKYPE_PORT_DEFAULT "2727"
32
33/*
34 * Enumerations
35 */
36
37typedef enum
38{
39        SKYPE_CALL_RINGING = 1,
40        SKYPE_CALL_MISSED
41} skype_call_status;
42
43typedef enum
44{
45        SKYPE_FILETRANSFER_NEW = 1,
46        SKYPE_FILETRANSFER_FAILED
47} skype_filetransfer_status;
48
49/*
50 * Structures
51 */
52
53struct skype_data
54{
55        struct im_connection *ic;
56        char *username;
57        /* The effective file descriptor. We store it here so any function can
58         * write() to it. */
59        int fd;
60        /* File descriptor returned by bitlbee. we store it so we know when
61         * we're connected and when we aren't. */
62        int bfd;
63        /* When we receive a new message id, we query the properties, finally
64         * the chatname. Store the properties here so that we can use
65         * imcb_buddy_msg() when we got the chatname. */
66        char *handle;
67        char *body;
68        char *type;
69        /* This is necessary because we send a notification when we get the
70         * handle. So we store the state here and then we can send a
71         * notification about the handle is in a given status. */
72        skype_call_status call_status;
73        /* Same for file transfers. */
74        skype_filetransfer_status filetransfer_status;
75        /* Using /j #nick we want to have a groupchat with two people. Usually
76         * not (default). */
77        char* groupchat_with;
78};
79
80struct skype_away_state
81{
82        char *code;
83        char *full_name;
84};
85
86struct skype_buddy_ask_data
87{
88        struct im_connection *ic;
89        char *handle;
90};
91
92/*
93 * Tables
94 */
95
96const struct skype_away_state skype_away_state_list[] =
97{
98        { "ONLINE",  "Online" },
99        { "SKYPEME",  "Skype Me" },
100        { "AWAY",   "Away" },
101        { "NA",    "Not available" },
102        { "DND",      "Do Not Disturb" },
103        { "INVISIBLE",      "Invisible" },
104        { "OFFLINE",      "Offline" },
105        { NULL, NULL}
106};
107
108/*
109 * Functions
110 */
111
112static void skype_init( account_t *acc )
113{
114        set_t *s;
115
116        s = set_add( &acc->set, "port", SKYPE_PORT_DEFAULT, set_eval_int, acc );
117        s->flags |= ACC_SET_OFFLINE_ONLY;
118
119        s = set_add( &acc->set, "server", NULL, set_eval_account, acc );
120        s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
121}
122
123int skype_write( struct im_connection *ic, char *buf, int len )
124{
125        struct skype_data *sd = ic->proto_data;
126        struct pollfd pfd[1];
127
128        pfd[0].fd = sd->fd;
129        pfd[0].events = POLLOUT;
130
131        /* This poll is necessary or we'll get a SIGPIPE when we write() to
132         * sd->fd. */
133        poll(pfd, 1, 1000);
134        if(pfd[0].revents & POLLHUP)
135        {
136                imcb_error( ic, "Could not connect to server" );
137                imc_logout( ic, TRUE );
138                return FALSE;
139        }
140        write( sd->fd, buf, len );
141
142        return TRUE;
143}
144
145static void skype_buddy_ask_yes( gpointer w, struct skype_buddy_ask_data *bla )
146{
147        char *buf = g_strdup_printf("SET USER %s ISAUTHORIZED TRUE", bla->handle);
148        skype_write( bla->ic, buf, strlen( buf ) );
149        g_free(buf);
150        g_free(bla->handle);
151        g_free(bla);
152}
153
154static void skype_buddy_ask_no( gpointer w, struct skype_buddy_ask_data *bla )
155{
156        char *buf = g_strdup_printf("SET USER %s ISAUTHORIZED FALSE", bla->handle);
157        skype_write( bla->ic, buf, strlen( buf ) );
158        g_free(buf);
159        g_free(bla->handle);
160        g_free(bla);
161}
162
163void skype_buddy_ask( struct im_connection *ic, char *handle, char *message)
164{
165        struct skype_buddy_ask_data *bla = g_new0( struct skype_buddy_ask_data, 1 );
166        char *buf;
167
168        bla->ic = ic;
169        bla->handle = g_strdup(handle);
170
171        buf = g_strdup_printf( "The user %s wants to add you to his/her buddy list, saying: '%s'.", handle, message);
172        imcb_ask( ic, buf, bla, skype_buddy_ask_yes, skype_buddy_ask_no );
173        g_free( buf );
174}
175
176struct groupchat *skype_chat_by_name( struct im_connection *ic, char *name )
177{
178        struct groupchat *ret;
179
180        for( ret = ic->conversations; ret; ret = ret->next )
181        {
182                if(strcmp(name, ret->title ) == 0 )
183                        break;
184        }
185
186        return ret;
187}
188
189static gboolean skype_read_callback( gpointer data, gint fd, b_input_condition cond )
190{
191        struct im_connection *ic = data;
192        struct skype_data *sd = ic->proto_data;
193        char buf[1024];
194        int st;
195        char **lines, **lineptr, *line, *ptr;
196
197        if( !sd || sd->fd == -1 )
198                return FALSE;
199        /* Read the whole data. */
200        st = read( sd->fd, buf, sizeof( buf ) );
201        if( st > 0 )
202        {
203                buf[st] = '\0';
204                /* Then split it up to lines. */
205                lines = g_strsplit(buf, "\n", 0);
206                lineptr = lines;
207                while((line = *lineptr))
208                {
209                        if(!strlen(line))
210                                break;
211                        if(!strncmp(line, "USERS ", 6))
212                        {
213                                char **i;
214                                char **nicks;
215
216                                nicks = g_strsplit(line + 6, ", ", 0);
217                                i = nicks;
218                                while(*i)
219                                {
220                                        g_snprintf(buf, 1024, "GET USER %s ONLINESTATUS\n", *i);
221                                        skype_write( ic, buf, strlen( buf ) );
222                                        i++;
223                                }
224                                g_strfreev(nicks);
225                        }
226                        else if(!strncmp(line, "USER ", 5))
227                        {
228                                int flags = 0;
229                                char *status = strrchr(line, ' ');
230                                char *user = strchr(line, ' ');
231                                status++;
232                                ptr = strchr(++user, ' ');
233                                *ptr = '\0';
234                                ptr++;
235                                if(!strncmp(ptr, "ONLINESTATUS ", 13) &&
236                                                strcmp(user, sd->username) != 0
237                                                && strcmp(user, "echo123") != 0)
238                                {
239                                        ptr = g_strdup_printf("%s@skype.com", user);
240                                        imcb_add_buddy(ic, ptr, NULL);
241                                        if(strcmp(status, "OFFLINE") != 0)
242                                                flags |= OPT_LOGGED_IN;
243                                        if(strcmp(status, "ONLINE") != 0 && strcmp(status, "SKYPEME") != 0)
244                                                flags |= OPT_AWAY;
245                                        imcb_buddy_status(ic, ptr, flags, NULL, NULL);
246                                        g_free(ptr);
247                                }
248                                else if(!strncmp(ptr, "RECEIVEDAUTHREQUEST ", 20))
249                                {
250                                        char *message = ptr + 20;
251                                        if(strlen(message))
252                                                skype_buddy_ask(ic, user, message);
253                                }
254                                else if(!strncmp(ptr, "BUDDYSTATUS ", 12))
255                                {
256                                        char *st = ptr + 12;
257                                        if(!strcmp(st, "3"))
258                                        {
259                                                char *buf = g_strdup_printf("%s@skype.com", user);
260                                                imcb_add_buddy(ic, buf, NULL);
261                                                g_free(buf);
262                                        }
263                                }
264                        }
265                        else if(!strncmp(line, "CHATMESSAGE ", 12))
266                        {
267                                char *id = strchr(line, ' ');
268                                if(++id)
269                                {
270                                        char *info = strchr(id, ' ');
271                                        *info = '\0';
272                                        info++;
273                                        if(!strcmp(info, "STATUS RECEIVED"))
274                                        {
275                                                /* New message ID:
276                                                 * (1) Request its from field
277                                                 * (2) Request its body
278                                                 * (3) Request its type
279                                                 * (4) Query chatname
280                                                 */
281                                                g_snprintf(buf, 1024, "GET CHATMESSAGE %s FROM_HANDLE\n", id);
282                                                skype_write( ic, buf, strlen( buf ) );
283                                                g_snprintf(buf, 1024, "GET CHATMESSAGE %s BODY\n", id);
284                                                skype_write( ic, buf, strlen( buf ) );
285                                                g_snprintf(buf, 1024, "GET CHATMESSAGE %s TYPE\n", id);
286                                                skype_write( ic, buf, strlen( buf ) );
287                                                g_snprintf(buf, 1024, "GET CHATMESSAGE %s CHATNAME\n", id);
288                                                skype_write( ic, buf, strlen( buf ) );
289                                        }
290                                        else if(!strncmp(info, "FROM_HANDLE ", 12))
291                                        {
292                                                info += 12;
293                                                /* New from field value. Store
294                                                 * it, then we can later use it
295                                                 * when we got the message's
296                                                 * body. */
297                                                g_free(sd->handle);
298                                                sd->handle = g_strdup_printf("%s@skype.com", info);
299                                        }
300                                        else if(!strncmp(info, "EDITED_BY ", 10))
301                                        {
302                                                info += 10;
303                                                /* This is the same as
304                                                 * FROM_HANDLE, except that we
305                                                 * never request these lines
306                                                 * from Skype, we just get
307                                                 * them. */
308                                                g_free(sd->handle);
309                                                sd->handle = g_strdup_printf("%s@skype.com", info);
310                                        }
311                                        else if(!strncmp(info, "BODY ", 5))
312                                        {
313                                                info += 5;
314                                                g_free(sd->body);
315                                                sd->body = g_strdup(info);
316                                        }
317                                        else if(!strncmp(info, "TYPE ", 5))
318                                        {
319                                                info += 5;
320                                                g_free(sd->type);
321                                                sd->type = g_strdup(info);
322                                        }
323                                        else if(!strncmp(info, "CHATNAME ", 9))
324                                        {
325                                                info += 9;
326                                                if(sd->handle && sd->body && sd->type)
327                                                {
328                                                        struct groupchat *gc = skype_chat_by_name(ic, info);
329                                                        if(!strcmp(sd->type, "SAID"))
330                                                        {
331                                                                if(!gc)
332                                                                        /* Private message */
333                                                                        imcb_buddy_msg(ic, sd->handle, sd->body, 0, 0);
334                                                                else
335                                                                        /* Groupchat message */
336                                                                        imcb_chat_msg(gc, sd->handle, sd->body, 0, 0);
337                                                        }
338                                                        else if(!strcmp(sd->type, "SETTOPIC"))
339                                                        {
340                                                                if(gc)
341                                                                        imcb_log(ic, "%s changed the topic of %s to: %s", sd->handle, gc->title, sd->body);
342                                                        }
343                                                        else if(!strcmp(sd->type, "LEFT"))
344                                                        {
345                                                                if(gc)
346                                                                        imcb_chat_remove_buddy(gc, sd->handle, NULL);
347                                                        }
348                                                }
349                                        }
350                                }
351                        }
352                        else if(!strncmp(line, "CALL ", 5))
353                        {
354                                char *id = strchr(line, ' ');
355                                if(++id)
356                                {
357                                        char *info = strchr(id, ' ');
358                                        *info = '\0';
359                                        info++;
360                                        if(!strcmp(info, "STATUS RINGING"))
361                                        {
362                                                g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
363                                                skype_write( ic, buf, strlen( buf ) );
364                                                sd->call_status = SKYPE_CALL_RINGING;
365                                        }
366                                        else if(!strcmp(info, "STATUS MISSED"))
367                                        {
368                                                g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
369                                                skype_write( ic, buf, strlen( buf ) );
370                                                sd->call_status = SKYPE_CALL_MISSED;
371                                        }
372                                        else if(!strncmp(info, "PARTNER_HANDLE ", 15))
373                                        {
374                                                info += 15;
375                                                if(sd->call_status) {
376                                                        switch(sd->call_status)
377                                                        {
378                                                                case SKYPE_CALL_RINGING:
379                                                                        imcb_log(ic, "The user %s is currently ringing you.", info);
380                                                                        break;
381                                                                case SKYPE_CALL_MISSED:
382                                                                        imcb_log(ic, "You have missed a call from user %s.", info);
383                                                                        break;
384                                                        }
385                                                        sd->call_status = 0;
386                                                }
387                                        }
388                                }
389                        }
390                        else if(!strncmp(line, "FILETRANSFER ", 13))
391                        {
392                                char *id = strchr(line, ' ');
393                                if(++id)
394                                {
395                                        char *info = strchr(id, ' ');
396                                        *info = '\0';
397                                        info++;
398                                        if(!strcmp(info, "STATUS NEW"))
399                                        {
400                                                g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
401                                                skype_write( ic, buf, strlen( buf ) );
402                                                sd->filetransfer_status = SKYPE_FILETRANSFER_NEW;
403                                        }
404                                        else if(!strcmp(info, "STATUS FAILED"))
405                                        {
406                                                g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
407                                                skype_write( ic, buf, strlen( buf ) );
408                                                sd->filetransfer_status = SKYPE_FILETRANSFER_FAILED;
409                                        }
410                                        else if(!strncmp(info, "PARTNER_HANDLE ", 15))
411                                        {
412                                                info += 15;
413                                                if(sd->filetransfer_status) {
414                                                        switch(sd->filetransfer_status)
415                                                        {
416                                                                case SKYPE_FILETRANSFER_NEW:
417                                                                        imcb_log(ic, "The user %s offered a new file for you.", info);
418                                                                        break;
419                                                                case SKYPE_FILETRANSFER_FAILED:
420                                                                        imcb_log(ic, "Failed to transfer file from user %s.", info);
421                                                                        break;
422                                                        }
423                                                        sd->filetransfer_status = 0;
424                                                }
425                                        }
426                                }
427                        }
428                        else if(!strncmp(line, "CHAT ", 5))
429                        {
430                                char *id = strchr(line, ' ');
431                                if(++id)
432                                {
433                                        char *info = strchr(id, ' ');
434                                        if(info)
435                                                *info = '\0';
436                                        info++;
437                                        if(!strcmp(info, "STATUS MULTI_SUBSCRIBED"))
438                                        {
439                                                imcb_chat_new( ic, id );
440                                        }
441                                        else if(!strcmp(info, "STATUS DIALOG") && sd->groupchat_with)
442                                        {
443                                                struct groupchat *gc = imcb_chat_new( ic, id );
444                                                /* According to the docs this
445                                                 * is necessary. However it
446                                                 * does not seem the situation
447                                                 * and it would open an extra
448                                                 * window on our client, so
449                                                 * just leave it out. */
450                                                /*g_snprintf(buf, 1024, "OPEN CHAT %s\n", id);
451                                                skype_write(ic, buf, strlen(buf));*/
452                                                g_snprintf(buf, 1024, "%s@skype.com", sd->groupchat_with);
453                                                imcb_chat_add_buddy(gc, buf);
454                                                imcb_chat_add_buddy(gc, sd->username);
455                                                g_free(sd->groupchat_with);
456                                                sd->groupchat_with = NULL;
457                                        }
458                                        else if(!strcmp(info, "STATUS UNSUBSCRIBED"))
459                                        {
460                                                struct groupchat *gc = skype_chat_by_name(ic, id);
461                                                if(gc)
462                                                        gc->data = (void*)FALSE;
463                                        }
464                                        else if(!strncmp(info, "ACTIVEMEMBERS ", 14))
465                                        {
466                                                info += 14;
467                                                struct groupchat *gc = skype_chat_by_name(ic, id);
468                                                /* Hack! We set ->data to TRUE
469                                                 * while we're on the channel
470                                                 * so that we won't rejoin
471                                                 * after a /part. */
472                                                if(gc && !gc->data)
473                                                {
474                                                        char **members = g_strsplit(info, " ", 0);
475                                                        int i;
476                                                        for(i=0;members[i];i++)
477                                                        {
478                                                                if(!strcmp(members[i], sd->username))
479                                                                        continue;
480                                                                g_snprintf(buf, 1024, "%s@skype.com", members[i]);
481                                                                if(!g_list_find_custom(gc->in_room, buf, (GCompareFunc)strcmp))
482                                                                        imcb_chat_add_buddy(gc, buf);
483                                                        }
484                                                        imcb_chat_add_buddy(gc, sd->username);
485                                                        g_strfreev(members);
486                                                }
487                                        }
488                                }
489                        }
490                        lineptr++;
491                }
492                g_strfreev(lines);
493        }
494        else if( st == 0 || ( st < 0 && !sockerr_again() ) )
495        {
496                closesocket( sd->fd );
497                sd->fd = -1;
498
499                imcb_error( ic, "Error while reading from server" );
500                imc_logout( ic, TRUE );
501                return FALSE;
502        }
503        return TRUE;
504}
505
506gboolean skype_start_stream( struct im_connection *ic )
507{
508        struct skype_data *sd = ic->proto_data;
509        char *buf;
510        int st;
511
512        if(!sd)
513                return FALSE;
514
515        if( sd->bfd <= 0 )
516                sd->bfd = b_input_add( sd->fd, GAIM_INPUT_READ, skype_read_callback, ic );
517
518        /* This will download all buddies. */
519        buf = g_strdup_printf("SEARCH FRIENDS\n");
520        st = skype_write( ic, buf, strlen( buf ) );
521        g_free(buf);
522        buf = g_strdup_printf("SET USERSTATUS ONLINE\n");
523        skype_write( ic, buf, strlen( buf ) );
524        g_free(buf);
525        return st;
526}
527
528gboolean skype_connected( gpointer data, gint source, b_input_condition cond )
529{
530        struct im_connection *ic = data;
531        imcb_connected(ic);
532        return skype_start_stream(ic);
533}
534
535static void skype_login( account_t *acc )
536{
537        struct im_connection *ic = imcb_new( acc );
538        struct skype_data *sd = g_new0( struct skype_data, 1 );
539
540        ic->proto_data = sd;
541
542        imcb_log( ic, "Connecting" );
543        sd->fd = proxy_connect(acc->server, set_getint( &acc->set, "port" ), skype_connected, ic );
544        sd->username = g_strdup( acc->user );
545
546        sd->ic = ic;
547}
548
549static void skype_logout( struct im_connection *ic )
550{
551        struct skype_data *sd = ic->proto_data;
552        char *buf;
553
554        buf = g_strdup_printf("SET USERSTATUS OFFLINE\n");
555        skype_write( ic, buf, strlen( buf ) );
556        g_free(buf);
557
558        g_free(sd->username);
559        g_free(sd->handle);
560        g_free(sd);
561        ic->proto_data = NULL;
562}
563
564static int skype_buddy_msg( struct im_connection *ic, char *who, char *message, int flags )
565{
566        char *buf, *ptr, *nick;
567        int st;
568
569        nick = g_strdup(who);
570        ptr = strchr(nick, '@');
571        if(ptr)
572                *ptr = '\0';
573
574        buf = g_strdup_printf("MESSAGE %s %s\n", nick, message);
575        g_free(nick);
576        st = skype_write( ic, buf, strlen( buf ) );
577        g_free(buf);
578
579        return st;
580}
581
582const struct skype_away_state *skype_away_state_by_name( char *name )
583{
584        int i;
585
586        for( i = 0; skype_away_state_list[i].full_name; i ++ )
587                if( g_strcasecmp( skype_away_state_list[i].full_name, name ) == 0 )
588                        return( skype_away_state_list + i );
589
590        return NULL;
591}
592
593static void skype_set_away( struct im_connection *ic, char *state_txt, char *message )
594{
595        const struct skype_away_state *state;
596        char *buf;
597
598        if( strcmp( state_txt, GAIM_AWAY_CUSTOM ) == 0 )
599                state = skype_away_state_by_name( "Away" );
600        else
601                state = skype_away_state_by_name( state_txt );
602        buf = g_strdup_printf("SET USERSTATUS %s\n", state->code);
603        skype_write( ic, buf, strlen( buf ) );
604        g_free(buf);
605}
606
607static GList *skype_away_states( struct im_connection *ic )
608{
609        GList *l = NULL;
610        int i;
611       
612        for( i = 0; skype_away_state_list[i].full_name; i ++ )
613                l = g_list_append( l, (void*) skype_away_state_list[i].full_name );
614       
615        return l;
616}
617
618static void skype_add_buddy( struct im_connection *ic, char *who, char *group )
619{
620        char *buf, *nick, *ptr;
621
622        nick = g_strdup(who);
623        ptr = strchr(nick, '@');
624        if(ptr)
625                *ptr = '\0';
626        buf = g_strdup_printf("SET USER %s BUDDYSTATUS 2 Please authorize me\n", nick);
627        skype_write( ic, buf, strlen( buf ) );
628        g_free(nick);
629}
630
631static void skype_remove_buddy( struct im_connection *ic, char *who, char *group )
632{
633        char *buf, *nick, *ptr;
634
635        nick = g_strdup(who);
636        ptr = strchr(nick, '@');
637        if(ptr)
638                *ptr = '\0';
639        buf = g_strdup_printf("SET USER %s BUDDYSTATUS 1\n", nick);
640        skype_write( ic, buf, strlen( buf ) );
641        g_free(nick);
642}
643
644void skype_chat_msg( struct groupchat *gc, char *message, int flags )
645{
646        struct im_connection *ic = gc->ic;
647        char *buf;
648        buf = g_strdup_printf("CHATMESSAGE %s %s\n", gc->title, message);
649        skype_write( ic, buf, strlen( buf ) );
650        g_free(buf);
651}
652
653void skype_chat_leave( struct groupchat *gc )
654{
655        struct im_connection *ic = gc->ic;
656        char *buf;
657        buf = g_strdup_printf("ALTER CHAT %s LEAVE\n", gc->title);
658        skype_write( ic, buf, strlen( buf ) );
659        g_free(buf);
660        gc->data = (void*)TRUE;
661}
662
663void skype_chat_invite(struct groupchat *gc, char *who, char *message)
664{
665        struct im_connection *ic = gc->ic;
666        char *buf, *ptr, *nick;
667        nick = g_strdup(message);
668        ptr = strchr(nick, '@');
669        if(ptr)
670                *ptr = '\0';
671        buf = g_strdup_printf("ALTER CHAT %s ADDMEMBERS %s\n", gc->title, nick);
672        skype_write( ic, buf, strlen( buf ) );
673        g_free(buf);
674        g_free(nick);
675}
676
677struct groupchat *skype_chat_with(struct im_connection *ic, char *who)
678{
679        struct skype_data *sd = ic->proto_data;
680        char *ptr, *nick, *buf;
681        nick = g_strdup(who);
682        ptr = strchr(nick, '@');
683        if(ptr)
684                *ptr = '\0';
685        buf = g_strdup_printf("CHAT CREATE %s\n", nick);
686        skype_write(ic, buf, strlen(buf));
687        g_free(buf);
688        sd->groupchat_with = g_strdup(nick);
689        g_free(nick);
690        return(NULL);
691}
692
693void init_plugin(void)
694{
695        struct prpl *ret = g_new0( struct prpl, 1 );
696
697        ret->name = "skype";
698        ret->login = skype_login;
699        ret->init = skype_init;
700        ret->logout = skype_logout;
701        ret->buddy_msg = skype_buddy_msg;
702        ret->away_states = skype_away_states;
703        ret->set_away = skype_set_away;
704        ret->add_buddy = skype_add_buddy;
705        ret->remove_buddy = skype_remove_buddy;
706        ret->chat_msg = skype_chat_msg;
707        ret->chat_leave = skype_chat_leave;
708        ret->chat_invite = skype_chat_invite;
709        ret->chat_with = skype_chat_with;
710        ret->handle_cmp = g_strcasecmp;
711        register_protocol( ret );
712}
Note: See TracBrowser for help on using the repository browser.