Changeset 2a0f99c


Ignore:
Timestamp:
2007-10-06T22:23:49Z (16 years ago)
Author:
VMiklos <vmiklos@…>
Branches:
master
Children:
31870ae
Parents:
349ee4a
Message:

handle the topic changes in group chats correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skype/skype.c

    r349ee4a r2a0f99c  
    6161         * we're connected and when we aren't. */
    6262        int bfd;
    63         /* When we receive a new message id, we query the handle, the body and
    64          * the chatname. Store the handle and the body here so that we
     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
    6565         * imcb_buddy_msg() when we got the chatname. */
    6666        char *handle;
    6767        char *body;
     68        char *type;
    6869        /* This is necessary because we send a notification when we get the
    6970         * handle. So we store the state here and then we can send a
     
    272273                                                 * (1) Request its from field
    273274                                                 * (2) Request its body
    274                                                  * (3) Query chatname
     275                                                 * (3) Request its type
     276                                                 * (4) Query chatname
    275277                                                 */
    276278                                                g_snprintf(buf, 1024, "GET CHATMESSAGE %s FROM_HANDLE\n", id);
    277279                                                skype_write( ic, buf, strlen( buf ) );
    278280                                                g_snprintf(buf, 1024, "GET CHATMESSAGE %s BODY\n", id);
     281                                                skype_write( ic, buf, strlen( buf ) );
     282                                                g_snprintf(buf, 1024, "GET CHATMESSAGE %s TYPE\n", id);
    279283                                                skype_write( ic, buf, strlen( buf ) );
    280284                                                g_snprintf(buf, 1024, "GET CHATMESSAGE %s CHATNAME\n", id);
     
    308312                                                sd->body = g_strdup(info);
    309313                                        }
     314                                        else if(!strncmp(info, "TYPE ", 5))
     315                                        {
     316                                                info += 5;
     317                                                g_free(sd->type);
     318                                                sd->type = g_strdup(info);
     319                                        }
    310320                                        else if(!strncmp(info, "CHATNAME ", 9))
    311321                                        {
    312322                                                info += 9;
    313                                                 if(sd->handle && sd->body && strlen(info))
     323                                                if(sd->handle && sd->body && sd->type)
    314324                                                {
    315                                                         struct groupchat *gc = skype_chat_by_name(ic, info);
    316                                                         if(!gc)
    317                                                                 /* Private message */
    318                                                                 imcb_buddy_msg(ic, sd->handle, sd->body, 0, 0);
    319                                                         else
    320                                                                 /* Groupchat message */
    321                                                                 imcb_chat_msg(gc, sd->handle, sd->body, 0, 0);
     325                                                        if(!strcmp(sd->type, "SAID"))
     326                                                        {
     327                                                                struct groupchat *gc = skype_chat_by_name(ic, info);
     328                                                                if(!gc)
     329                                                                        /* Private message */
     330                                                                        imcb_buddy_msg(ic, sd->handle, sd->body, 0, 0);
     331                                                                else
     332                                                                        /* Groupchat message */
     333                                                                        imcb_chat_msg(gc, sd->handle, sd->body, 0, 0);
     334                                                        }
     335                                                        else if(!strcmp(sd->type, "SETTOPIC"))
     336                                                        {
     337                                                                struct groupchat *gc = skype_chat_by_name(ic, info);
     338                                                                if(gc)
     339                                                                        imcb_log(ic, "%s changed the topic of %s to: %s", sd->handle, gc->title, sd->body);
     340                                                        }
    322341                                                }
    323342                                        }
Note: See TracChangeset for help on using the changeset viewer.