Changeset 73cf7fd for protocols/oscar


Ignore:
Timestamp:
2006-05-22T09:11:49Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
226fce1
Parents:
619a681
Message:

Trying to fix charset issues with outgoing AIM chat messages.

Location:
protocols/oscar
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/aim.h

    r619a681 r73cf7fd  
    728728};
    729729
    730 #define AIM_CHATFLAGS_NOREFLECT 0x0001
    731 #define AIM_CHATFLAGS_AWAY      0x0002
     730#define AIM_CHATFLAGS_NOREFLECT         0x0001
     731#define AIM_CHATFLAGS_AWAY              0x0002
     732#define AIM_CHATFLAGS_UNICODE           0x0004
     733#define AIM_CHATFLAGS_ISO_8859_1        0x0008
     734
    732735int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const char *msg, int msglen);
    733736int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance);
  • protocols/oscar/chat.c

    r619a681 r73cf7fd  
    159159        if (flags & AIM_CHATFLAGS_AWAY)
    160160                aim_addtlvtochain_noval(&otl, 0x0007);
    161 
     161       
     162        /* [WvG] This wasn't there originally, but we really should send
     163                 the right charset flags, as we also do with normal
     164                 messages. Hope this will work. :-) */
     165        if (flags & AIM_CHATFLAGS_UNICODE)
     166                aimbs_put16(&fr->data, 0x0002);
     167        else if (flags & AIM_CHATFLAGS_ISO_8859_1)
     168                aimbs_put16(&fr->data, 0x0003);
     169        else
     170                aimbs_put16(&fr->data, 0x0000);
     171       
     172        aimbs_put16(&fr->data, 0x0000);
     173       
    162174        /*
    163175         * SubTLV: Type 1: Message
  • protocols/oscar/oscar.c

    r619a681 r73cf7fd  
    25022502        int ret;
    25032503        guint8 len = strlen(message);
     2504        guint16 flags;
    25042505        char *s;
    25052506       
     
    25102511                if (*s & 128)
    25112512                        break;
    2512                
     2513       
     2514        flags = AIM_CHATFLAGS_NOREFLECT;
     2515       
    25132516        /* Message contains high ASCII chars, time for some translation! */
    25142517        if (*s) {
     
    25172520                   If we can't, fall back to UTF16. */
    25182521                if ((ret = do_iconv("UTF-8", "ISO8859-1", message, s, len, BUF_LONG)) >= 0) {
     2522                        flags |= AIM_CHATFLAGS_ISO_8859_1;
    25192523                        len = ret;
    25202524                } else if ((ret = do_iconv("UTF-8", "UNICODEBIG", message, s, len, BUF_LONG)) >= 0) {
     2525                        flags |= AIM_CHATFLAGS_UNICODE;
    25212526                        len = ret;
    25222527                } else {
     
    25292534        }
    25302535               
    2531         ret = aim_chat_send_im(od->sess, ccon->conn, AIM_CHATFLAGS_NOREFLECT, s, len);
     2536        ret = aim_chat_send_im(od->sess, ccon->conn, flags, s, len);
    25322537               
    25332538        if (s != message) {     
Note: See TracChangeset for help on using the changeset viewer.