Ignore:
Timestamp:
2015-10-13T05:05:22Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
0b1ae59
Parents:
fdc6d84
Message:

skype: create groupchat as soon as a message is received

Before this commit, the bee_chat_by_title() call just failed when
receiving a message in a groupchat we didn't know about, which is
probably something skype broke in their api at some point.

I'm fixing this since apparently the only way to access p2p based chats
is through the official skype desktop client (they won't be supported
through msnp24 or skypeweb. It's broken in mobile clients already), so
this plugin is probably the best way to access those.

This breaks the 'msg' test - now all chats are groupchats and there's no
way to tell them apart.

However, in reality, private messages aren't delivered at all over the
api, or at least I never managed to get them working. Probably if you
talk with someone who has a very old patched skype client.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/skype/skype.c

    rfdc6d84 r64bed24  
    323323}
    324324
     325static struct groupchat *skype_chat_get_or_create(struct im_connection *ic, char *id)
     326{
     327        struct skype_data *sd = ic->proto_data;
     328        struct groupchat *gc = bee_chat_by_title(ic->bee, ic, id);
     329
     330        if (!gc) {
     331                gc = imcb_chat_new(ic, id);
     332                imcb_chat_name_hint(gc, id);
     333                imcb_chat_add_buddy(gc, sd->username);
     334
     335                skype_printf(ic, "GET CHAT %s ADDER\n", id);
     336                skype_printf(ic, "GET CHAT %s TOPIC\n", id);
     337                skype_printf(ic, "GET CHAT %s ACTIVEMEMBERS\n", id);
     338        }
     339
     340        return gc;
     341}
     342
    325343static void skype_parse_users(struct im_connection *ic, char *line)
    326344{
     
    687705                info += 9;
    688706                if (sd->handle && sd->body && sd->type) {
    689                         struct groupchat *gc = bee_chat_by_title(ic->bee, ic, info);
     707                        struct groupchat *gc = skype_chat_get_or_create(ic, info);
    690708                        int i;
    691709                        for (i = 0; i < g_list_length(sd->body); i++) {
     
    10251043        }
    10261044        if (!strcmp(info, "STATUS MULTI_SUBSCRIBED")) {
    1027                 gc = bee_chat_by_title(ic->bee, ic, id);
    1028                 if (!gc) {
    1029                         gc = imcb_chat_new(ic, id);
    1030                         imcb_chat_name_hint(gc, id);
    1031                 }
    1032                 skype_printf(ic, "GET CHAT %s ADDER\n", id);
    1033                 skype_printf(ic, "GET CHAT %s TOPIC\n", id);
     1045                skype_chat_get_or_create(ic, id);
    10341046        } else if (!strcmp(info, "STATUS DIALOG") && sd->groupchat_with) {
    1035                 gc = imcb_chat_new(ic, id);
    1036                 imcb_chat_name_hint(gc, id);
     1047                gc = skype_chat_get_or_create(ic, id);
    10371048                /* According to the docs this
    10381049                 * is necessary. However it
     
    10451056                           sd->groupchat_with);
    10461057                imcb_chat_add_buddy(gc, buf);
    1047                 imcb_chat_add_buddy(gc, sd->username);
    10481058                g_free(sd->groupchat_with);
    10491059                sd->groupchat_with = NULL;
    1050                 skype_printf(ic, "GET CHAT %s ADDER\n", id);
    1051                 skype_printf(ic, "GET CHAT %s TOPIC\n", id);
    10521060        } else if (!strcmp(info, "STATUS UNSUBSCRIBED")) {
    10531061                gc = bee_chat_by_title(ic->bee, ic, id);
Note: See TracChangeset for help on using the changeset viewer.