Changeset e200daf for skype


Ignore:
Timestamp:
2009-01-07T01:26:08Z (15 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
c35bf7a
Parents:
9f2f25f
Message:

introduce skype_parse_filetransfer()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skype/skype.c

    r9f2f25f re200daf  
    655655}
    656656
     657static void skype_parse_filetransfer(struct im_connection *ic, char *line)
     658{
     659        struct skype_data *sd = ic->proto_data;
     660        char buf[1024];
     661        char *id = strchr(line, ' ');
     662
     663        if (++id) {
     664                char *info = strchr(id, ' ');
     665
     666                if (!info)
     667                        return;
     668                *info = '\0';
     669                info++;
     670                if (!strcmp(info, "STATUS NEW")) {
     671                        g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
     672                        skype_write(ic, buf);
     673                        sd->filetransfer_status = SKYPE_FILETRANSFER_NEW;
     674                } else if (!strcmp(info, "STATUS FAILED")) {
     675                        g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
     676                        skype_write(ic, buf);
     677                        sd->filetransfer_status = SKYPE_FILETRANSFER_FAILED;
     678                } else if (!strncmp(info, "PARTNER_HANDLE ", 15)) {
     679                        info += 15;
     680                        if (sd->filetransfer_status) {
     681                                switch (sd->filetransfer_status) {
     682                                        case SKYPE_FILETRANSFER_NEW:
     683                                                imcb_log(ic, "The user %s offered a new file for you.", info);
     684                                                break;
     685                                        case SKYPE_FILETRANSFER_FAILED:
     686                                                imcb_log(ic, "Failed to transfer file from user %s.", info);
     687                                                break;
     688                                }
     689                                sd->filetransfer_status = 0;
     690                        }
     691                }
     692        }
     693}
     694
    657695static gboolean skype_read_callback(gpointer data, gint fd,
    658696                                    b_input_condition cond)
     
    686724                        else if (!strncmp(line, "CALL ", 5))
    687725                                skype_parse_call(ic, line);
    688                         else if (!strncmp(line, "FILETRANSFER ", 13)) {
    689                                 char *id = strchr(line, ' ');
    690                                 if (++id) {
    691                                         char *info = strchr(id, ' ');
    692                                         *info = '\0';
    693                                         info++;
    694                                         if (!strcmp(info, "STATUS NEW")) {
    695                                                 g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
    696                                                 skype_write(ic, buf);
    697                                                 sd->filetransfer_status = SKYPE_FILETRANSFER_NEW;
    698                                         } else if (!strcmp(info, "STATUS FAILED")) {
    699                                                 g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
    700                                                 skype_write(ic, buf);
    701                                                 sd->filetransfer_status = SKYPE_FILETRANSFER_FAILED;
    702                                         } else if (!strncmp(info, "PARTNER_HANDLE ", 15)) {
    703                                                 info += 15;
    704                                                 if (sd->filetransfer_status) {
    705                                                         switch (sd->filetransfer_status) {
    706                                                         case SKYPE_FILETRANSFER_NEW:
    707                                                                 imcb_log(ic, "The user %s offered a new file for you.", info);
    708                                                                 break;
    709                                                         case SKYPE_FILETRANSFER_FAILED:
    710                                                                 imcb_log(ic, "Failed to transfer file from user %s.", info);
    711                                                                 break;
    712                                                         }
    713                                                         sd->filetransfer_status = 0;
    714                                                 }
    715                                         }
    716                                 }
    717                         } else if (!strncmp(line, "CHAT ", 5)) {
     726                        else if (!strncmp(line, "FILETRANSFER ", 13))
     727                                skype_parse_filetransfer(ic, line);
     728                        else if (!strncmp(line, "CHAT ", 5)) {
    718729                                char *id = strchr(line, ' ');
    719730                                if (++id) {
Note: See TracChangeset for help on using the changeset viewer.