Changeset 46641bf


Ignore:
Timestamp:
2011-01-03T03:13:00Z (14 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
2b183e4
Parents:
46e9822
Message:

skype_add_buddy: handle the case when /invite is used on a new group

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skype/skype.c

    r46e9822 r46641bf  
    110110        /* List of struct skype_group* */
    111111        GList *groups;
     112        /* Pending user which has to be added to the next group which is
     113         * created. */
     114        char *pending_user;
    112115};
    113116
     
    865868                        log_message(LOGLVL_ERROR,
    866869                                "No skype group with id %s. That's probably a bug.", id);
    867         } else if (!strncmp(info, "NROFUSERS ", 10))
    868                 /* Number of users changed in this group, query its type to see
    869                  * if it's a custom one we should care about. */
    870                 skype_printf(ic, "GET GROUP %s TYPE", id);
     870        } else if (!strncmp(info, "NROFUSERS ", 10)) {
     871                if (!sd->pending_user) {
     872                        /* Number of users changed in this group, query its type to see
     873                         * if it's a custom one we should care about. */
     874                        skype_printf(ic, "GET GROUP %s TYPE", id);
     875                        return;
     876                }
     877
     878                /* This is a newly created group, we have a single user
     879                 * to add. */
     880                struct skype_group *sg = skype_group_by_id(ic, atoi(id));
     881
     882                if (sg) {
     883                        skype_printf(ic, "ALTER GROUP %d ADDUSER %s", sg->id, sd->pending_user);
     884                        g_free(sd->pending_user);
     885                        sd->pending_user = NULL;
     886                } else
     887                        log_message(LOGLVL_ERROR,
     888                                        "No skype group with id %s. That's probably a bug.", id);
     889        }
    871890        else if (!strcmp(info, "TYPE CUSTOM_GROUP"))
    872891                /* This one is interesting, query its users. */
     
    13111330static void skype_add_buddy(struct im_connection *ic, char *who, char *group)
    13121331{
     1332        struct skype_data *sd = ic->proto_data;
    13131333        char *nick, *ptr;
    13141334
     
    13261346
    13271347                if (!sg) {
    1328                         // TODO
    13291348                        /* No such group, we need to create it, then have to
    13301349                         * add the user once it's created. */
    1331                         //skype_printf(ic, "CREATE GROUP %s", group);
     1350                        skype_printf(ic, "CREATE GROUP %s", group);
     1351                        sd->pending_user = g_strdup(nick);
    13321352                } else {
    13331353                        skype_printf(ic, "ALTER GROUP %d ADDUSER %s", sg->id, nick);
Note: See TracChangeset for help on using the changeset viewer.