Changeset 6b9d22a for skype/skype.c


Ignore:
Timestamp:
2009-01-07T02:10:29Z (15 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
62f51ee9
Parents:
9580a6f
Message:

remove unnecessary big if blocks, use return instead

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skype/skype.c

    r9580a6f r6b9d22a  
    482482        char *id = strchr(line, ' ');
    483483
    484         if (++id) {
    485                 char *info = strchr(id, ' ');
    486 
    487                 if (!info)
    488                         return;
    489                 *info = '\0';
    490                 info++;
    491                 if (!strcmp(info, "STATUS RECEIVED")) {
    492                         /* New message ID:
    493                          * (1) Request its from field
    494                          * (2) Request its body
    495                          * (3) Request its type
    496                          * (4) Query chatname
    497                          */
    498                         g_snprintf(buf, 1024, "GET CHATMESSAGE %s FROM_HANDLE\n", id);
    499                         skype_write(ic, buf);
    500                         g_snprintf(buf, 1024, "GET CHATMESSAGE %s BODY\n", id);
    501                         skype_write(ic, buf);
    502                         g_snprintf(buf, 1024, "GET CHATMESSAGE %s TYPE\n", id);
    503                         skype_write(ic, buf);
    504                         g_snprintf(buf, 1024, "GET CHATMESSAGE %s CHATNAME\n", id);
    505                         skype_write(ic, buf);
    506                 } else if (!strncmp(info, "FROM_HANDLE ", 12)) {
    507                         info += 12;
    508                         /* New from field value. Store
    509                          * it, then we can later use it
    510                          * when we got the message's
    511                          * body. */
    512                         g_free(sd->handle);
    513                         sd->handle = g_strdup_printf("%s@skype.com", info);
    514                 } else if (!strncmp(info, "EDITED_BY ", 10)) {
    515                         info += 10;
    516                         /* This is the same as
    517                          * FROM_HANDLE, except that we
    518                          * never request these lines
    519                          * from Skype, we just get
    520                          * them. */
    521                         g_free(sd->handle);
    522                         sd->handle = g_strdup_printf("%s@skype.com", info);
    523                 } else if (!strncmp(info, "BODY ", 5)) {
    524                         info += 5;
    525                         sd->body = g_list_append(sd->body, g_strdup(info));
    526                 }       else if (!strncmp(info, "TYPE ", 5)) {
    527                         info += 5;
    528                         g_free(sd->type);
    529                         sd->type = g_strdup(info);
    530                 } else if (!strncmp(info, "CHATNAME ", 9)) {
    531                         info += 9;
    532                         if (sd->handle && sd->body && sd->type) {
    533                                 struct groupchat *gc = skype_chat_by_name(ic, info);
    534                                 int i;
    535                                 for (i = 0; i < g_list_length(sd->body); i++) {
    536                                         char *body = g_list_nth_data(sd->body, i);
    537                                         if (!strcmp(sd->type, "SAID") || !strcmp(sd->type, "EMOTED")) {
    538                                                 if (!strcmp(sd->type, "SAID"))
    539                                                         g_snprintf(buf, 1024, "%s", body);
    540                                                 else
    541                                                         g_snprintf(buf, 1024, "/me %s", body);
    542                                                 if (!gc)
    543                                                         /* Private message */
    544                                                         imcb_buddy_msg(ic, sd->handle, buf, 0, 0);
    545                                                 else
    546                                                         /* Groupchat message */
    547                                                         imcb_chat_msg(gc, sd->handle, buf, 0, 0);
    548                                         } else if (!strcmp(sd->type, "SETTOPIC")) {
    549                                                 if (gc)
    550                                                         imcb_chat_topic(gc, sd->handle, body, 0);
    551                                         } else if (!strcmp(sd->type, "LEFT")) {
    552                                                 if (gc)
    553                                                         imcb_chat_remove_buddy(gc, sd->handle, NULL);
    554                                         }
     484        if (!++id)
     485                return;
     486        char *info = strchr(id, ' ');
     487
     488        if (!info)
     489                return;
     490        *info = '\0';
     491        info++;
     492        if (!strcmp(info, "STATUS RECEIVED")) {
     493                /* New message ID:
     494                 * (1) Request its from field
     495                 * (2) Request its body
     496                 * (3) Request its type
     497                 * (4) Query chatname
     498                 */
     499                g_snprintf(buf, 1024, "GET CHATMESSAGE %s FROM_HANDLE\n", id);
     500                skype_write(ic, buf);
     501                g_snprintf(buf, 1024, "GET CHATMESSAGE %s BODY\n", id);
     502                skype_write(ic, buf);
     503                g_snprintf(buf, 1024, "GET CHATMESSAGE %s TYPE\n", id);
     504                skype_write(ic, buf);
     505                g_snprintf(buf, 1024, "GET CHATMESSAGE %s CHATNAME\n", id);
     506                skype_write(ic, buf);
     507        } else if (!strncmp(info, "FROM_HANDLE ", 12)) {
     508                info += 12;
     509                /* New from field value. Store
     510                 * it, then we can later use it
     511                 * when we got the message's
     512                 * body. */
     513                g_free(sd->handle);
     514                sd->handle = g_strdup_printf("%s@skype.com", info);
     515        } else if (!strncmp(info, "EDITED_BY ", 10)) {
     516                info += 10;
     517                /* This is the same as
     518                 * FROM_HANDLE, except that we
     519                 * never request these lines
     520                 * from Skype, we just get
     521                 * them. */
     522                g_free(sd->handle);
     523                sd->handle = g_strdup_printf("%s@skype.com", info);
     524        } else if (!strncmp(info, "BODY ", 5)) {
     525                info += 5;
     526                sd->body = g_list_append(sd->body, g_strdup(info));
     527        }       else if (!strncmp(info, "TYPE ", 5)) {
     528                info += 5;
     529                g_free(sd->type);
     530                sd->type = g_strdup(info);
     531        } else if (!strncmp(info, "CHATNAME ", 9)) {
     532                info += 9;
     533                if (sd->handle && sd->body && sd->type) {
     534                        struct groupchat *gc = skype_chat_by_name(ic, info);
     535                        int i;
     536                        for (i = 0; i < g_list_length(sd->body); i++) {
     537                                char *body = g_list_nth_data(sd->body, i);
     538                                if (!strcmp(sd->type, "SAID") || !strcmp(sd->type, "EMOTED")) {
     539                                        if (!strcmp(sd->type, "SAID"))
     540                                                g_snprintf(buf, 1024, "%s", body);
     541                                        else
     542                                                g_snprintf(buf, 1024, "/me %s", body);
     543                                        if (!gc)
     544                                                /* Private message */
     545                                                imcb_buddy_msg(ic, sd->handle, buf, 0, 0);
     546                                        else
     547                                                /* Groupchat message */
     548                                                imcb_chat_msg(gc, sd->handle, buf, 0, 0);
     549                                } else if (!strcmp(sd->type, "SETTOPIC")) {
     550                                        if (gc)
     551                                                imcb_chat_topic(gc, sd->handle, body, 0);
     552                                } else if (!strcmp(sd->type, "LEFT")) {
     553                                        if (gc)
     554                                                imcb_chat_remove_buddy(gc, sd->handle, NULL);
    555555                                }
    556                                 g_list_free(sd->body);
    557                                 sd->body = NULL;
    558556                        }
     557                        g_list_free(sd->body);
     558                        sd->body = NULL;
    559559                }
    560560        }
     
    567567        char buf[1024];
    568568
    569         if (++id) {
    570                 char *info = strchr(id, ' ');
    571 
    572                 if (!info)
    573                         return;
    574                 *info = '\0';
    575                 info++;
    576                 if (!strncmp(info, "FAILUREREASON ", 14))
    577                         sd->failurereason = atoi(strchr(info, ' '));
    578                 else if (!strcmp(info, "STATUS RINGING")) {
    579                         if (sd->call_id)
    580                                 g_free(sd->call_id);
    581                         sd->call_id = g_strdup(id);
    582                         g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
    583                         skype_write(ic, buf);
    584                         sd->call_status = SKYPE_CALL_RINGING;
    585                 } else if (!strcmp(info, "STATUS MISSED")) {
    586                         g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
    587                         skype_write(ic, buf);
    588                         sd->call_status = SKYPE_CALL_MISSED;
    589                 } else if (!strcmp(info, "STATUS CANCELLED")) {
    590                         g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
    591                         skype_write(ic, buf);
    592                         sd->call_status = SKYPE_CALL_CANCELLED;
    593                 } else if (!strcmp(info, "STATUS FINISHED")) {
    594                         g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
    595                         skype_write(ic, buf);
    596                         sd->call_status = SKYPE_CALL_FINISHED;
    597                 } else if (!strcmp(info, "STATUS REFUSED")) {
    598                         g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
    599                         skype_write(ic, buf);
    600                         sd->call_status = SKYPE_CALL_REFUSED;
    601                 } else if (!strcmp(info, "STATUS UNPLACED")) {
    602                         if (sd->call_id)
    603                                 g_free(sd->call_id);
    604                         /* Save the ID for later usage (Cancel/Finish). */
    605                         sd->call_id = g_strdup(id);
    606                         sd->call_out = TRUE;
    607                 } else if (!strcmp(info, "STATUS FAILED")) {
    608                         imcb_error(ic, "Call failed: %s", skype_call_strerror(sd->failurereason));
    609                         sd->call_id = NULL;
    610                 } else if (!strncmp(info, "DURATION ", 9)) {
    611                         if (sd->call_duration)
    612                                 g_free(sd->call_duration);
    613                         sd->call_duration = g_strdup(info+9);
    614                 } else if (!strncmp(info, "PARTNER_HANDLE ", 15)) {
    615                         info += 15;
    616                         if (sd->call_status) {
    617                                 switch (sd->call_status) {
    618                                 case SKYPE_CALL_RINGING:
    619                                         if (sd->call_out)
    620                                                 imcb_log(ic, "You are currently ringing the user %s.", info);
    621                                         else {
    622                                                 g_snprintf(buf, 1024, "The user %s is currently ringing you.", info);
    623                                                 skype_call_ask(ic, sd->call_id, buf);
    624                                         }
    625                                         break;
    626                                 case SKYPE_CALL_MISSED:
    627                                         imcb_log(ic, "You have missed a call from user %s.", info);
    628                                         break;
    629                                 case SKYPE_CALL_CANCELLED:
    630                                         imcb_log(ic, "You cancelled the call to the user %s.", info);
    631                                         sd->call_status = 0;
    632                                         sd->call_out = FALSE;
    633                                         break;
    634                                 case SKYPE_CALL_REFUSED:
    635                                         if (sd->call_out)
    636                                                 imcb_log(ic, "The user %s refused the call.", info);
    637                                         else
    638                                                 imcb_log(ic, "You refused the call from user %s.", info);
    639                                         sd->call_out = FALSE;
    640                                         break;
    641                                 case SKYPE_CALL_FINISHED:
    642                                         if (sd->call_duration)
    643                                                 imcb_log(ic, "You finished the call to the user %s (duration: %s seconds).", info, sd->call_duration);
    644                                         else
    645                                                 imcb_log(ic, "You finished the call to the user %s.", info);
    646                                         sd->call_out = FALSE;
    647                                         break;
    648                                 default:
    649                                         /* Don't be noisy, ignore other statuses for now. */
    650                                         break;
     569        if (!++id)
     570                return;
     571        char *info = strchr(id, ' ');
     572
     573        if (!info)
     574                return;
     575        *info = '\0';
     576        info++;
     577        if (!strncmp(info, "FAILUREREASON ", 14))
     578                sd->failurereason = atoi(strchr(info, ' '));
     579        else if (!strcmp(info, "STATUS RINGING")) {
     580                if (sd->call_id)
     581                        g_free(sd->call_id);
     582                sd->call_id = g_strdup(id);
     583                g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
     584                skype_write(ic, buf);
     585                sd->call_status = SKYPE_CALL_RINGING;
     586        } else if (!strcmp(info, "STATUS MISSED")) {
     587                g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
     588                skype_write(ic, buf);
     589                sd->call_status = SKYPE_CALL_MISSED;
     590        } else if (!strcmp(info, "STATUS CANCELLED")) {
     591                g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
     592                skype_write(ic, buf);
     593                sd->call_status = SKYPE_CALL_CANCELLED;
     594        } else if (!strcmp(info, "STATUS FINISHED")) {
     595                g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
     596                skype_write(ic, buf);
     597                sd->call_status = SKYPE_CALL_FINISHED;
     598        } else if (!strcmp(info, "STATUS REFUSED")) {
     599                g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
     600                skype_write(ic, buf);
     601                sd->call_status = SKYPE_CALL_REFUSED;
     602        } else if (!strcmp(info, "STATUS UNPLACED")) {
     603                if (sd->call_id)
     604                        g_free(sd->call_id);
     605                /* Save the ID for later usage (Cancel/Finish). */
     606                sd->call_id = g_strdup(id);
     607                sd->call_out = TRUE;
     608        } else if (!strcmp(info, "STATUS FAILED")) {
     609                imcb_error(ic, "Call failed: %s", skype_call_strerror(sd->failurereason));
     610                sd->call_id = NULL;
     611        } else if (!strncmp(info, "DURATION ", 9)) {
     612                if (sd->call_duration)
     613                        g_free(sd->call_duration);
     614                sd->call_duration = g_strdup(info+9);
     615        } else if (!strncmp(info, "PARTNER_HANDLE ", 15)) {
     616                info += 15;
     617                if (sd->call_status) {
     618                        switch (sd->call_status) {
     619                        case SKYPE_CALL_RINGING:
     620                                if (sd->call_out)
     621                                        imcb_log(ic, "You are currently ringing the user %s.", info);
     622                                else {
     623                                        g_snprintf(buf, 1024, "The user %s is currently ringing you.", info);
     624                                        skype_call_ask(ic, sd->call_id, buf);
    651625                                }
     626                                break;
     627                        case SKYPE_CALL_MISSED:
     628                                imcb_log(ic, "You have missed a call from user %s.", info);
     629                                break;
     630                        case SKYPE_CALL_CANCELLED:
     631                                imcb_log(ic, "You cancelled the call to the user %s.", info);
    652632                                sd->call_status = 0;
     633                                sd->call_out = FALSE;
     634                                break;
     635                        case SKYPE_CALL_REFUSED:
     636                                if (sd->call_out)
     637                                        imcb_log(ic, "The user %s refused the call.", info);
     638                                else
     639                                        imcb_log(ic, "You refused the call from user %s.", info);
     640                                sd->call_out = FALSE;
     641                                break;
     642                        case SKYPE_CALL_FINISHED:
     643                                if (sd->call_duration)
     644                                        imcb_log(ic, "You finished the call to the user %s (duration: %s seconds).", info, sd->call_duration);
     645                                else
     646                                        imcb_log(ic, "You finished the call to the user %s.", info);
     647                                sd->call_out = FALSE;
     648                                break;
     649                        default:
     650                                /* Don't be noisy, ignore other statuses for now. */
     651                                break;
    653652                        }
     653                        sd->call_status = 0;
    654654                }
    655655        }
     
    662662        char *id = strchr(line, ' ');
    663663
    664         if (++id) {
    665                 char *info = strchr(id, ' ');
    666 
    667                 if (!info)
    668                         return;
    669                 *info = '\0';
    670                 info++;
    671                 if (!strcmp(info, "STATUS NEW")) {
    672                         g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
    673                         skype_write(ic, buf);
    674                         sd->filetransfer_status = SKYPE_FILETRANSFER_NEW;
    675                 } else if (!strcmp(info, "STATUS FAILED")) {
    676                         g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
    677                         skype_write(ic, buf);
    678                         sd->filetransfer_status = SKYPE_FILETRANSFER_FAILED;
    679                 } else if (!strncmp(info, "PARTNER_HANDLE ", 15)) {
    680                         info += 15;
    681                         if (sd->filetransfer_status) {
    682                                 switch (sd->filetransfer_status) {
    683                                 case SKYPE_FILETRANSFER_NEW:
    684                                         imcb_log(ic, "The user %s offered a new file for you.", info);
    685                                         break;
    686                                 case SKYPE_FILETRANSFER_FAILED:
    687                                         imcb_log(ic, "Failed to transfer file from user %s.", info);
    688                                         break;
    689                                 }
    690                                 sd->filetransfer_status = 0;
     664        if (!++id)
     665                return;
     666        char *info = strchr(id, ' ');
     667
     668        if (!info)
     669                return;
     670        *info = '\0';
     671        info++;
     672        if (!strcmp(info, "STATUS NEW")) {
     673                g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
     674                skype_write(ic, buf);
     675                sd->filetransfer_status = SKYPE_FILETRANSFER_NEW;
     676        } else if (!strcmp(info, "STATUS FAILED")) {
     677                g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
     678                skype_write(ic, buf);
     679                sd->filetransfer_status = SKYPE_FILETRANSFER_FAILED;
     680        } else if (!strncmp(info, "PARTNER_HANDLE ", 15)) {
     681                info += 15;
     682                if (sd->filetransfer_status) {
     683                        switch (sd->filetransfer_status) {
     684                        case SKYPE_FILETRANSFER_NEW:
     685                                imcb_log(ic, "The user %s offered a new file for you.", info);
     686                                break;
     687                        case SKYPE_FILETRANSFER_FAILED:
     688                                imcb_log(ic, "Failed to transfer file from user %s.", info);
     689                                break;
    691690                        }
     691                        sd->filetransfer_status = 0;
    692692                }
    693693        }
     
    700700        char *id = strchr(line, ' ');
    701701
    702         if (++id) {
    703                 struct groupchat *gc;
    704                 char *info = strchr(id, ' ');
    705 
    706                 if (!info)
    707                         return;
    708                 *info = '\0';
    709                 info++;
    710                 /* Remove fake chat if we created one in skype_chat_with() */
    711                 gc = skype_chat_by_name(ic, "");
     702        if (!++id)
     703                return;
     704        struct groupchat *gc;
     705        char *info = strchr(id, ' ');
     706
     707        if (!info)
     708                return;
     709        *info = '\0';
     710        info++;
     711        /* Remove fake chat if we created one in skype_chat_with() */
     712        gc = skype_chat_by_name(ic, "");
     713        if (gc)
     714                imcb_chat_free(gc);
     715        if (!strcmp(info, "STATUS MULTI_SUBSCRIBED")) {
     716                imcb_chat_new(ic, id);
     717                g_snprintf(buf, 1024, "GET CHAT %s ADDER\n", id);
     718                skype_write(ic, buf);
     719                g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id);
     720                skype_write(ic, buf);
     721        } else if (!strcmp(info, "STATUS DIALOG") && sd->groupchat_with) {
     722                gc = imcb_chat_new(ic, id);
     723                /* According to the docs this
     724                 * is necessary. However it
     725                 * does not seem the situation
     726                 * and it would open an extra
     727                 * window on our client, so
     728                 * just leave it out. */
     729                /*g_snprintf(buf, 1024, "OPEN CHAT %s\n", id);
     730                  skype_write(ic, buf);*/
     731                g_snprintf(buf, 1024, "%s@skype.com", sd->groupchat_with);
     732                imcb_chat_add_buddy(gc, buf);
     733                imcb_chat_add_buddy(gc, sd->username);
     734                g_free(sd->groupchat_with);
     735                sd->groupchat_with = NULL;
     736                g_snprintf(buf, 1024, "GET CHAT %s ADDER\n", id);
     737                skype_write(ic, buf);
     738                g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id);
     739                skype_write(ic, buf);
     740        } else if (!strcmp(info, "STATUS UNSUBSCRIBED")) {
     741                gc = skype_chat_by_name(ic, id);
    712742                if (gc)
    713                         imcb_chat_free(gc);
    714                 if (!strcmp(info, "STATUS MULTI_SUBSCRIBED")) {
    715                         imcb_chat_new(ic, id);
    716                         g_snprintf(buf, 1024, "GET CHAT %s ADDER\n", id);
    717                         skype_write(ic, buf);
    718                         g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id);
    719                         skype_write(ic, buf);
    720                 } else if (!strcmp(info, "STATUS DIALOG") && sd->groupchat_with) {
    721                         gc = imcb_chat_new(ic, id);
    722                         /* According to the docs this
    723                          * is necessary. However it
    724                          * does not seem the situation
    725                          * and it would open an extra
    726                          * window on our client, so
    727                          * just leave it out. */
    728                         /*g_snprintf(buf, 1024, "OPEN CHAT %s\n", id);
    729                           skype_write(ic, buf);*/
    730                         g_snprintf(buf, 1024, "%s@skype.com", sd->groupchat_with);
    731                         imcb_chat_add_buddy(gc, buf);
     743                        gc->data = (void *)FALSE;
     744        } else if (!strncmp(info, "ADDER ", 6)) {
     745                info += 6;
     746                g_free(sd->adder);
     747                sd->adder = g_strdup_printf("%s@skype.com", info);
     748        } else if (!strncmp(info, "TOPIC ", 6)) {
     749                info += 6;
     750                gc = skype_chat_by_name(ic, id);
     751                if (gc && (sd->adder || sd->topic_wait)) {
     752                        if (sd->topic_wait) {
     753                                sd->adder = g_strdup(sd->username);
     754                                sd->topic_wait = 0;
     755                        }
     756                        imcb_chat_topic(gc, sd->adder, info, 0);
     757                        g_free(sd->adder);
     758                        sd->adder = NULL;
     759                }
     760        } else if (!strncmp(info, "ACTIVEMEMBERS ", 14)) {
     761                info += 14;
     762                gc = skype_chat_by_name(ic, id);
     763                /* Hack! We set ->data to TRUE
     764                 * while we're on the channel
     765                 * so that we won't rejoin
     766                 * after a /part. */
     767                if (gc && !gc->data) {
     768                        char **members = g_strsplit(info, " ", 0);
     769                        int i;
     770                        for (i = 0; members[i]; i++) {
     771                                if (!strcmp(members[i], sd->username))
     772                                        continue;
     773                                g_snprintf(buf, 1024, "%s@skype.com", members[i]);
     774                                if (!g_list_find_custom(gc->in_room, buf, (GCompareFunc)strcmp))
     775                                        imcb_chat_add_buddy(gc, buf);
     776                        }
    732777                        imcb_chat_add_buddy(gc, sd->username);
    733                         g_free(sd->groupchat_with);
    734                         sd->groupchat_with = NULL;
    735                         g_snprintf(buf, 1024, "GET CHAT %s ADDER\n", id);
    736                         skype_write(ic, buf);
    737                         g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id);
    738                         skype_write(ic, buf);
    739                 } else if (!strcmp(info, "STATUS UNSUBSCRIBED")) {
    740                         gc = skype_chat_by_name(ic, id);
    741                         if (gc)
    742                                 gc->data = (void *)FALSE;
    743                 } else if (!strncmp(info, "ADDER ", 6)) {
    744                         info += 6;
    745                         g_free(sd->adder);
    746                         sd->adder = g_strdup_printf("%s@skype.com", info);
    747                 } else if (!strncmp(info, "TOPIC ", 6)) {
    748                         info += 6;
    749                         gc = skype_chat_by_name(ic, id);
    750                         if (gc && (sd->adder || sd->topic_wait)) {
    751                                 if (sd->topic_wait) {
    752                                         sd->adder = g_strdup(sd->username);
    753                                         sd->topic_wait = 0;
    754                                 }
    755                                 imcb_chat_topic(gc, sd->adder, info, 0);
    756                                 g_free(sd->adder);
    757                                 sd->adder = NULL;
    758                         }
    759                 } else if (!strncmp(info, "ACTIVEMEMBERS ", 14)) {
    760                         info += 14;
    761                         gc = skype_chat_by_name(ic, id);
    762                         /* Hack! We set ->data to TRUE
    763                          * while we're on the channel
    764                          * so that we won't rejoin
    765                          * after a /part. */
    766                         if (gc && !gc->data) {
    767                                 char **members = g_strsplit(info, " ", 0);
    768                                 int i;
    769                                 for (i = 0; members[i]; i++) {
    770                                         if (!strcmp(members[i], sd->username))
    771                                                 continue;
    772                                         g_snprintf(buf, 1024, "%s@skype.com", members[i]);
    773                                         if (!g_list_find_custom(gc->in_room, buf, (GCompareFunc)strcmp))
    774                                                 imcb_chat_add_buddy(gc, buf);
    775                                 }
    776                                 imcb_chat_add_buddy(gc, sd->username);
    777                                 g_strfreev(members);
    778                         }
     778                        g_strfreev(members);
    779779                }
    780780        }
     
    858858                        if (set_getbool(&ic->acc->set, "skypeconsole_receive"))
    859859                                imcb_buddy_msg(ic, "skypeconsole", line, 0, 0);
    860                         for (i = 0; i < ARRAY_SIZE(parsers); i++) {
    861                                 if (!strncmp(line, parsers[i].k, strlen(parsers[i].k))) {
     860                        for (i = 0; i < ARRAY_SIZE(parsers); i++)
     861                                if (!strncmp(line, parsers[i].k,
     862                                        strlen(parsers[i].k))) {
    862863                                        parsers[i].v(ic, line);
    863864                                        break;
    864865                                }
    865                         }
    866866                        lineptr++;
    867867                }
Note: See TracChangeset for help on using the changeset viewer.