Ignore:
Timestamp:
2008-08-04T14:45:24Z (16 years ago)
Author:
ulim <a.sporto+bee@…>
Branches:
master
Children:
87f525e
Parents:
4ac647d (diff), 718e05f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merged in upstream r410.

Only conflict was the correction of jabber normalization which I had already done.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/oscar.c

    r4ac647d r8661caa  
    6060
    6161#define OSCAR_GROUP "Friends"
     62
     63#define BUF_LEN 2048
     64#define BUF_LONG ( BUF_LEN * 2 )
    6265
    6366/* Don't know if support for UTF8 is really working. For now it's UTF16 here.
     
    240243};
    241244static int msgerrreasonlen = 25;
     245
     246/* Hurray, this function is NOT thread-safe \o/ */
     247static char *normalize(const char *s)
     248{
     249        static char buf[BUF_LEN];
     250        char *t, *u;
     251        int x = 0;
     252
     253        g_return_val_if_fail((s != NULL), NULL);
     254
     255        u = t = g_strdup(s);
     256
     257        strcpy(t, s);
     258        g_strdown(t);
     259
     260        while (*t && (x < BUF_LEN - 1)) {
     261                if (*t != ' ' && *t != '!') {
     262                        buf[x] = *t;
     263                        x++;
     264                }
     265                t++;
     266        }
     267        buf[x] = '\0';
     268        g_free(u);
     269        return buf;
     270}
    242271
    243272static gboolean oscar_callback(gpointer data, gint source,
     
    10021031        }
    10031032
    1004         tmp = g_strdup(normalize(ic->acc->user));
    1005         if (!strcmp(tmp, normalize(info->sn)))
     1033        if (!aim_sncmp(ic->acc->user, info->sn))
    10061034                g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn);
    1007         g_free(tmp);
    1008 
    1009         imcb_buddy_status(ic, info->sn, flags, state_string, NULL);
    1010         /* imcb_buddy_times(ic, info->sn, signon, time_idle); */
     1035
     1036        tmp = normalize(info->sn);
     1037        imcb_buddy_status(ic, tmp, flags, state_string, NULL);
     1038        /* imcb_buddy_times(ic, tmp, signon, time_idle); */
     1039
    10111040
    10121041        return 1;
     
    10221051        va_end(ap);
    10231052
    1024         imcb_buddy_status(ic, info->sn, 0, NULL, NULL );
     1053        imcb_buddy_status(ic, normalize(info->sn), 0, NULL, NULL );
    10251054
    10261055        return 1;
     
    10781107       
    10791108        strip_linefeed(tmp);
    1080         imcb_buddy_msg(ic, userinfo->sn, tmp, flags, 0);
     1109        imcb_buddy_msg(ic, normalize(userinfo->sn), tmp, flags, 0);
    10811110        g_free(tmp);
    10821111       
     
    11771206                        message = g_strdup(args->msg);
    11781207                        strip_linefeed(message);
    1179                         imcb_buddy_msg(ic, uin, message, 0, 0);
     1208                        imcb_buddy_msg(ic, normalize(uin), message, 0, 0);
    11801209                        g_free(uin);
    11811210                        g_free(message);
     
    11961225
    11971226                        strip_linefeed(message);
    1198                         imcb_buddy_msg(ic, uin, message, 0, 0);
     1227                        imcb_buddy_msg(ic, normalize(uin), message, 0, 0);
    11991228                        g_free(uin);
    12001229                        g_free(m);
     
    14711500
    14721501        for (i = 0; i < count; i++)
    1473                 imcb_chat_add_buddy(c->cnv, info[i].sn);
     1502                imcb_chat_add_buddy(c->cnv, normalize(info[i].sn));
    14741503
    14751504        return 1;
     
    14941523
    14951524        for (i = 0; i < count; i++)
    1496                 imcb_chat_remove_buddy(c->cnv, info[i].sn, NULL);
     1525                imcb_chat_remove_buddy(c->cnv, normalize(info[i].sn), NULL);
    14971526
    14981527        return 1;
     
    15451574        tmp = g_malloc(BUF_LONG);
    15461575        g_snprintf(tmp, BUF_LONG, "%s", msg);
    1547         imcb_chat_msg(ccon->cnv, info->sn, tmp, 0, 0);
     1576        imcb_chat_msg(ccon->cnv, normalize(info->sn), tmp, 0, 0);
    15481577        g_free(tmp);
    15491578
     
    17581787                        g_snprintf(sender, sizeof(sender), "%u", msg->sender);
    17591788                        strip_linefeed(dialog_msg);
    1760                         imcb_buddy_msg(ic, sender, dialog_msg, 0, t);
     1789                        imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t);
    17611790                        g_free(dialog_msg);
    17621791                } break;
     
    17791808
    17801809                        strip_linefeed(dialog_msg);
    1781                         imcb_buddy_msg(ic, sender, dialog_msg, 0, t);
     1810                        imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t);
    17821811                        g_free(dialog_msg);
    17831812                        g_free(m);
     
    20172046        struct aim_ssi_item *curitem;
    20182047        int tmp;
     2048        char *nrm;
    20192049
    20202050        /* Add from server list to local list */
    20212051        tmp = 0;
    20222052        for (curitem=sess->ssi.items; curitem; curitem=curitem->next) {
     2053                nrm = curitem->name ? normalize(curitem->name) : NULL;
     2054               
    20232055                switch (curitem->type) {
    20242056                        case 0x0000: /* Buddy */
    2025                                 if ((curitem->name) && (!imcb_find_buddy(ic, curitem->name))) {
     2057                                if ((curitem->name) && (!imcb_find_buddy(ic, nrm))) {
    20262058                                        char *realname = NULL;
    20272059
     
    20292061                                                    realname = aim_gettlv_str(curitem->data, 0x0131, 1);
    20302062                                               
    2031                                         imcb_add_buddy(ic, curitem->name, NULL);
     2063                                        imcb_add_buddy(ic, nrm, NULL);
    20322064                                       
    20332065                                        if (realname) {
    2034                                                 imcb_buddy_nick_hint(ic, curitem->name, realname);
    2035                                                 imcb_rename_buddy(ic, curitem->name, realname);
     2066                                                imcb_buddy_nick_hint(ic, nrm, realname);
     2067                                                imcb_rename_buddy(ic, nrm, realname);
    20362068                                                g_free(realname);
    20372069                                        }
     
    20452077                                        if (!list) {
    20462078                                                char *name;
    2047                                                 name = g_strdup(normalize(curitem->name));
     2079                                                name = g_strdup(nrm);
    20482080                                                ic->permit = g_slist_append(ic->permit, name);
    20492081                                                tmp++;
     
    20582090                                        if (!list) {
    20592091                                                char *name;
    2060                                                 name = g_strdup(normalize(curitem->name));
     2092                                                name = g_strdup(nrm);
    20612093                                                ic->deny = g_slist_append(ic->deny, name);
    20622094                                                tmp++;
     
    21202152                        if( st == 0x00 )
    21212153                        {
    2122                                 imcb_add_buddy( sess->aux_data, list, NULL );
     2154                                imcb_add_buddy( sess->aux_data, normalize(list), NULL );
    21232155                        }
    21242156                        else if( st == 0x0E )
     
    24502482        if(type2 == 0x0002) {
    24512483                /* User is typing */
    2452                 imcb_buddy_typing(ic, sn, OPT_TYPING);
     2484                imcb_buddy_typing(ic, normalize(sn), OPT_TYPING);
    24532485        }
    24542486        else if (type2 == 0x0001) {
    24552487                /* User has typed something, but is not actively typing (stale) */
    2456                 imcb_buddy_typing(ic, sn, OPT_THINKING);
     2488                imcb_buddy_typing(ic, normalize(sn), OPT_THINKING);
    24572489        }
    24582490        else {
    24592491                /* User has stopped typing */
    2460                 imcb_buddy_typing(ic, sn, 0);
     2492                imcb_buddy_typing(ic, normalize(sn), 0);
    24612493        }
    24622494       
Note: See TracChangeset for help on using the changeset viewer.