Changeset cf02dd6 for libfaim/oscar.c


Ignore:
Timestamp:
Dec 10, 2003, 3:20:45 PM (20 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
b1fe407
Parents:
8c46404
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfaim/oscar.c

    r07ab1cb rcf02dd6  
    3131#include "buddyicon.h"
    3232#include "conversation.h"
     33#include "core.h"
    3334#include "debug.h"
    3435#include "ft.h"
     
    4142#include "request.h"
    4243#include "util.h"
    43 #include "html.h"
    4444
    4545#include "aim.h"
    4646#include "md5.h"
    47 
    48 /* XXX CORE/UI */
    49 #include "gtkinternal.h"
    50 #include "gaim.h"
    51 
    5247
    5348#define UC_AOL          0x02
     
    6156#define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3"
    6257
     58#define OSCAR_CONNECT_STEPS 6
     59
    6360static GaimPlugin *my_protocol = NULL;
    6461
    65 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE;
    66 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE;
     62static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT;
     63static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT;
    6764
    6865static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02};
    6966static fu8_t features_icq[] = {0x01, 0x06};
    7067
    71 struct oscar_data {
     68typedef struct _OscarData OscarData;
     69struct _OscarData {
    7270        aim_session_t *sess;
    7371        aim_conn_t *conn;
     
    10199        gboolean killme;
    102100        gboolean icq;
    103         GSList *evilhack;
    104101        guint icontimer;
    105102        guint getblisttimer;
     
    151148};
    152149
    153 /* Various PRPL-specific buddy info that we want to keep track of */
     150/*
     151 * Various PRPL-specific buddy info that we want to keep track of
     152 * Some other info is maintained by locate.c, and I'd like to move
     153 * the rest of this to libfaim, mostly im.c
     154 */
    154155struct buddyinfo {
    155         time_t signon;
    156         int caps;
    157156        gboolean typingnot;
    158157        gchar *availmsg;
     
    168167        time_t ico_time;
    169168        gboolean ico_need;
    170 
    171         fu16_t iconcsumlen;
    172         fu8_t *iconcsum;
     169        gboolean ico_sent;
    173170};
    174171
     
    219216static int gaim_parse_misses     (aim_session_t *, aim_frame_t *, ...);
    220217static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...);
    221 static int gaim_parse_user_info  (aim_session_t *, aim_frame_t *, ...);
     218static int gaim_parse_userinfo   (aim_session_t *, aim_frame_t *, ...);
    222219static int gaim_parse_motd       (aim_session_t *, aim_frame_t *, ...);
    223220static int gaim_chatnav_info     (aim_session_t *, aim_frame_t *, ...);
    224 static int gaim_chat_join        (aim_session_t *, aim_frame_t *, ...);
    225 static int gaim_chat_leave       (aim_session_t *, aim_frame_t *, ...);
    226 static int gaim_chat_info_update (aim_session_t *, aim_frame_t *, ...);
    227 static int gaim_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...);
     221static int gaim_conv_chat_join        (aim_session_t *, aim_frame_t *, ...);
     222static int gaim_conv_chat_leave       (aim_session_t *, aim_frame_t *, ...);
     223static int gaim_conv_chat_info_update (aim_session_t *, aim_frame_t *, ...);
     224static int gaim_conv_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...);
    228225static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...);
    229226static int gaim_icon_error       (aim_session_t *, aim_frame_t *, ...);
     
    284281
    285282/* prpl actions - remove this at some point */
     283/* Because I don't like forward declarations?  I think that was why... */
    286284static void oscar_set_info(GaimConnection *gc, const char *text);
    287285
     
    295293        struct buddyinfo *bi = data;
    296294        g_free(bi->availmsg);
    297         g_free(bi->iconcsum);
    298295        g_free(bi);
    299296}
     
    384381}
    385382
    386 static struct direct_im *find_direct_im(struct oscar_data *od, const char *who) {
     383static struct direct_im *find_direct_im(OscarData *od, const char *who) {
    387384        GSList *d = od->direct_ims;
    388385        struct direct_im *m = NULL;
     
    428425
    429426static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) {
    430         GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
     427        GSList *g = ((OscarData *)gc->proto_data)->oscar_chats;
    431428        struct chat_connection *c = NULL;
    432429
     
    444441static struct chat_connection *find_oscar_chat_by_conn(GaimConnection *gc,
    445442                                                        aim_conn_t *conn) {
    446         GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
     443        GSList *g = ((OscarData *)gc->proto_data)->oscar_chats;
    447444        struct chat_connection *c = NULL;
    448445
     
    460457static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) {
    461458        GaimConnection *gc = sess->aux_data;
    462         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     459        OscarData *od = (OscarData *)gc->proto_data;
    463460        GaimConversation *cnv;
    464461        struct direct_im *dim;
     
    496493        aim_session_t *sess = aim_conn_getsess(conn);
    497494        GaimConnection *gc = sess ? sess->aux_data : NULL;
    498         struct oscar_data *od;
     495        OscarData *od;
    499496
    500497        if (!gc) {
    501                 /* gc is null. we return, else we seg SIGSEG on next line. */
    502498                gaim_debug(GAIM_DEBUG_INFO, "oscar",
    503499                                   "oscar callback for closed connection (1).\n");
     
    505501        }
    506502     
    507         od = (struct oscar_data *)gc->proto_data;
     503        od = (OscarData *)gc->proto_data;
    508504
    509505        if (!g_list_find(gaim_connections_get_all(), gc)) {
     
    606602
    607603static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) {
    608         char *s = g_strdup_vprintf(format, va);
    609         char buf[256];
    610         char *t;
    611604        GaimConnection *gc = sess->aux_data;
    612 
    613         g_snprintf(buf, sizeof(buf), "%s %d: ", gaim_account_get_username(gaim_connection_get_account(gc)), level);
    614         t = g_strconcat(buf, s, NULL);
    615         gaim_debug(GAIM_DEBUG_INFO, "oscar", t);
    616         if (t[strlen(t)-1] != '\n')
     605        gchar *s = g_strdup_vprintf(format, va);
     606        gchar *buf;
     607
     608        buf = g_strdup_printf("%s %d: %s", gaim_account_get_username(gaim_connection_get_account(gc)), level, s);
     609        gaim_debug(GAIM_DEBUG_INFO, "oscar", buf);
     610        if (buf[strlen(buf)-1] != '\n')
    617611                gaim_debug(GAIM_DEBUG_INFO, NULL, "\n");
    618         g_free(t);
     612        g_free(buf);
    619613        g_free(s);
    620614}
     
    623617{
    624618        GaimConnection *gc = data;
    625         struct oscar_data *od;
     619        OscarData *od;
    626620        aim_session_t *sess;
    627621        aim_conn_t *conn;
     
    635629        sess = od->sess;
    636630        conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
    637        
    638631        conn->fd = source;
    639632
     
    645638        aim_conn_completeconnect(sess, conn);
    646639        gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn);
     640        aim_request_login(sess, conn, gaim_account_get_username(gaim_connection_get_account(gc)));
     641
    647642        gaim_debug(GAIM_DEBUG_INFO, "oscar",
    648                            "Password sent, waiting for response\n");
     643                           "Screen name sent, waiting for response\n");
     644        gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS);
    649645}
    650646
     
    652648        aim_session_t *sess;
    653649        aim_conn_t *conn;
    654         char buf[256];
    655650        GaimConnection *gc = gaim_account_get_connection(account);
    656         struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1);
     651        OscarData *od = gc->proto_data = g_new0(OscarData, 1);
    657652
    658653        gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc);
     
    667662
    668663        sess = g_new0(aim_session_t, 1);
    669 
    670         aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0);
     664        aim_session_init(sess, TRUE, 0);
    671665        aim_setdebuggingcb(sess, oscar_debug);
    672 
    673         /* we need an immediate queue because we don't use a while-loop to
    674          * see if things need to be sent. */
     666        /*
     667         * We need an immediate queue because we don't use a while-loop
     668         * to see if things need to be sent.
     669         */
    675670        aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL);
    676671        od->sess = sess;
     
    685680        }
    686681
    687         g_snprintf(buf, sizeof(buf), _("Signon: %s"), gaim_account_get_username(account));
    688         gaim_connection_update_progress(gc, buf, 2, 5);
    689 
    690682        aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0);
    691683        aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
     
    699691                return;
    700692        }
    701         aim_request_login(sess, conn, gaim_account_get_username(account));
     693
     694        gaim_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS);
    702695}
    703696
    704697static void oscar_close(GaimConnection *gc) {
    705         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     698        OscarData *od = (OscarData *)gc->proto_data;
    706699
    707700        while (od->oscar_chats) {
     
    733726        }
    734727        g_hash_table_destroy(od->buddyinfo);
    735         while (od->evilhack) {
    736                 g_free(od->evilhack->data);
    737                 od->evilhack = g_slist_remove(od->evilhack, od->evilhack->data);
    738         }
    739728        while (od->create_rooms) {
    740729                struct create_room *cr = od->create_rooms->data;
     
    773762static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
    774763        GaimConnection *gc = data;
    775         struct oscar_data *od;
     764        OscarData *od;
    776765        aim_session_t *sess;
    777766        aim_conn_t *bosconn;
     
    794783        aim_conn_completeconnect(sess, bosconn);
    795784        gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn);
     785
    796786        gaim_connection_update_progress(gc,
    797                         _("Connection established, cookie sent"), 4, 5);
     787                        _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS);
    798788}
    799789
     
    834824        struct aim_oft_info *oft_info = xfer->data;
    835825        GaimConnection *gc = oft_info->sess->aux_data;
    836         struct oscar_data *od = gc->proto_data;
     826        OscarData *od = gc->proto_data;
    837827
    838828        if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) {
     
    900890        struct aim_oft_info *oft_info = xfer->data;
    901891        GaimConnection *gc = oft_info->sess->aux_data;
    902         struct oscar_data *od = gc->proto_data;
     892        OscarData *od = gc->proto_data;
    903893
    904894        gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n");
     
    919909        struct aim_oft_info *oft_info = xfer->data;
    920910        GaimConnection *gc = oft_info->sess->aux_data;
    921         struct oscar_data *od = gc->proto_data;
     911        OscarData *od = gc->proto_data;
    922912
    923913        gaim_debug(GAIM_DEBUG_INFO, "oscar",
     
    936926        struct aim_oft_info *oft_info = xfer->data;
    937927        GaimConnection *gc = oft_info->sess->aux_data;
    938         struct oscar_data *od = gc->proto_data;
     928        OscarData *od = gc->proto_data;
    939929
    940930        gaim_debug(GAIM_DEBUG_INFO, "oscar",
     
    1007997
    1008998static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) {
    1009         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     999        OscarData *od = (OscarData *)gc->proto_data;
    10101000        GaimXfer *xfer;
    10111001        struct aim_oft_info *oft_info;
     
    10381028static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {
    10391029        GaimConnection *gc = sess->aux_data;
    1040         struct oscar_data *od = gc->proto_data;
     1030        OscarData *od = gc->proto_data;
    10411031        GaimAccount *account = gc->account;
    10421032        aim_conn_t *bosconn;
     
    11361126        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0);
    11371127        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0);
    1138         aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_user_info, 0);
     1128        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_userinfo, 0);
    11391129        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0);
    11401130        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0);
     
    11631153#endif
    11641154
    1165         ((struct oscar_data *)gc->proto_data)->conn = bosconn;
     1155        od->conn = bosconn;
    11661156        for (i = 0; i < (int)strlen(info->bosip); i++) {
    11671157                if (info->bosip[i] == ':') {
     
    11821172        gaim_input_remove(gc->inpa);
    11831173
     1174        gaim_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS);
     1175
    11841176        return 1;
    11851177}
    11861178
     1179/* XXX - Should use gaim_url_fetch for the below stuff */
    11871180struct pieceofcrap {
    11881181        GaimConnection *gc;
     
    11981191{
    11991192        struct pieceofcrap *pos = data;
    1200         struct oscar_data *od = pos->gc->proto_data;
     1193        OscarData *od = pos->gc->proto_data;
    12011194        char in = '\0';
    12021195        int x = 0;
     
    12171210                        "this is fixed.  Check %s for updates."), GAIM_WEBSITE);
    12181211                gaim_notify_warning(pos->gc, NULL,
    1219                                                         _("Gaim was Unable to get a valid AIM login hash."),
     1212                                                        _("Gaim was unable to get a valid AIM login hash."),
    12201213                                                        buf);
    12211214                gaim_input_remove(pos->inpa);
     
    12471240                        "this is fixed.  Check %s for updates."), GAIM_WEBSITE);
    12481241                gaim_notify_warning(pos->gc, NULL,
    1249                                                         _("Gaim was Unable to get a valid AIM login hash."),
     1242                                                        _("Gaim was unable to get a valid AIM login hash."),
    12501243                                                        buf);
    12511244                g_free(buf);
     
    13351328                        "this is fixed.  Check %s for updates."), GAIM_WEBSITE);
    13361329                gaim_notify_warning(pos->gc, NULL,
    1337                                                         _("Gaim was Unable to get a valid login hash."),
     1330                                                        _("Gaim was unable to get a valid login hash."),
    13381331                                                        buf);
    13391332        }
     
    13431336
    13441337static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) {
    1345         char *key;
    1346         va_list ap;
    13471338        GaimConnection *gc = sess->aux_data;
     1339        OscarData *od = gc->proto_data;
    13481340        GaimAccount *account = gaim_connection_get_account(gc);
    13491341        GaimAccount *ac = gaim_connection_get_account(gc);
    1350         struct oscar_data *od = gc->proto_data;
     1342#if 0
     1343        struct client_info_s info = {"gaim", 7, 3, 2003, "us", "en", 0x0004, 0x0000, 0x04b};
     1344#endif
     1345        va_list ap;
     1346        char *key;
    13511347
    13521348        va_start(ap, fr);
     
    13591355                                           gaim_account_get_password(account), &info, key);
    13601356        } else {
    1361 #if 0
    1362                 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b};
    1363 #endif
    13641357                struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD;
    13651358                aim_send_login(sess, fr->conn, gaim_account_get_username(ac),
    13661359                                           gaim_account_get_password(account), &info, key);
    13671360        }
     1361
     1362        gaim_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS);
    13681363
    13691364        return 1;
     
    13761371
    13771372        aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, 0x0001, gaim_parse_genericerr, 0);
    1378         aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0);
    1379         aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_chat_leave, 0);
    1380         aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0);
    1381         aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0);
     1373        aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_conv_chat_join, 0);
     1374        aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_conv_chat_leave, 0);
     1375        aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_conv_chat_info_update, 0);
     1376        aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_conv_chat_incoming_msg, 0);
    13821377
    13831378        aim_clientready(sess, fr->conn);
     
    14071402        aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0);
    14081403
    1409         aim_email_sendcookies(sess, fr->conn);
    1410         aim_email_activate(sess, fr->conn);
     1404        aim_email_sendcookies(sess);
     1405        aim_email_activate(sess);
    14111406        aim_clientready(sess, fr->conn);
    14121407
     
    14161411static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) {
    14171412        GaimConnection *gc = sess->aux_data;
    1418         struct oscar_data *od = gc->proto_data;
     1413        OscarData *od = gc->proto_data;
    14191414
    14201415        aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0);
     
    14351430static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {
    14361431        GaimConnection *gc = data;
    1437         struct oscar_data *od;
     1432        OscarData *od;
    14381433        aim_session_t *sess;
    14391434        aim_conn_t *tstconn;
     
    14641459{
    14651460        GaimConnection *gc = data;
    1466         struct oscar_data *od;
     1461        OscarData *od;
    14671462        aim_session_t *sess;
    14681463        aim_conn_t *tstconn;
     
    14941489        struct chat_connection *ccon = data;
    14951490        GaimConnection *gc = ccon->gc;
    1496         struct oscar_data *od;
     1491        OscarData *od;
    14971492        aim_session_t *sess;
    14981493        aim_conn_t *tstconn;
     
    15261521static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) {
    15271522        GaimConnection *gc = data;
    1528         struct oscar_data *od;
     1523        OscarData *od;
    15291524        aim_session_t *sess;
    15301525        aim_conn_t *tstconn;
     
    15551550static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) {
    15561551        GaimConnection *gc = data;
    1557         struct oscar_data *od;
     1552        OscarData *od;
    15581553        aim_session_t *sess;
    15591554        aim_conn_t *tstconn;
     
    17481743static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
    17491744        GaimConnection *gc = sess->aux_data;
    1750         struct oscar_data *od = gc->proto_data;
     1745        OscarData *od = gc->proto_data;
    17511746        struct buddyinfo *bi;
    17521747        time_t time_idle = 0, signon = 0;
     
    17891784        }
    17901785
    1791         if (caps & AIM_CAPS_ICQ)
    1792                 caps ^= AIM_CAPS_ICQ;
     1786        if (caps & AIM_CAPS_ICQ_DIRECT)
     1787                caps ^= AIM_CAPS_ICQ_DIRECT;
    17931788
    17941789        if (info->present & AIM_USERINFO_PRESENT_IDLE) {
     
    18051800                gaim_connection_set_display_name(gc, info->sn);
    18061801
    1807         bi = g_hash_table_lookup(od->buddyinfo, normalize(info->sn));
     1802        bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, info->sn));
    18081803        if (!bi) {
    18091804                bi = g_new0(struct buddyinfo, 1);
    1810                 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(info->sn)), bi);
    1811         }
    1812         bi->signon = info->onlinesince ? info->onlinesince : (info->sessionlen + time(NULL));
    1813         if (caps)
    1814                 bi->caps = caps;
     1805                g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, info->sn)), bi);
     1806        }
    18151807        bi->typingnot = FALSE;
    18161808        bi->ico_informed = FALSE;
     
    18191811        /* Available message stuff */
    18201812        free(bi->availmsg);
    1821         if (info->availmsg)
    1822                 if (info->availmsg_encoding) {
    1823                         gchar *enc = g_strdup_printf("charset=\"%s\"", info->availmsg_encoding);
    1824                         bi->availmsg = oscar_encoding_to_utf8(enc, info->availmsg, info->availmsg_len);
     1813        if (info->avail != NULL)
     1814                if (info->avail_encoding) {
     1815                        gchar *enc = g_strdup_printf("charset=\"%s\"", info->avail_encoding);
     1816                        bi->availmsg = oscar_encoding_to_utf8(enc, info->avail, info->avail_len);
    18251817                        g_free(enc);
    18261818                } else {
    18271819                        /* No explicit encoding means utf8.  Yay. */
    1828                         bi->availmsg = g_strdup(info->availmsg);
     1820                        bi->availmsg = g_strdup(info->avail);
    18291821                }
    18301822        else
     
    18331825        /* Server stored icon stuff */
    18341826        if (info->iconcsumlen) {
    1835                 char *b16, *saved_b16;
    1836                 GaimBuddy *b;
    1837 
    1838                 free(bi->iconcsum);
    1839                 bi->iconcsum = malloc(info->iconcsumlen);
    1840                 memcpy(bi->iconcsum, info->iconcsum, info->iconcsumlen);
    1841                 bi->iconcsumlen = info->iconcsumlen;
    1842                 b16 = tobase16(bi->iconcsum, bi->iconcsumlen);
     1827                const char *filename = NULL, *saved_b16 = NULL;
     1828                char *b16 = NULL;
     1829                GaimBuddy *b = NULL;
     1830
     1831                b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen);
    18431832                b = gaim_find_buddy(gc->account, info->sn);
    1844                 saved_b16 = gaim_buddy_get_setting(b, "icon_checksum");
     1833                /*
     1834                 * If for some reason the checksum is valid, but cached file is not..
     1835                 * we want to know.
     1836                 */
     1837                filename = gaim_buddy_get_setting(b, "buddy_icon");
     1838                if (filename != NULL) {
     1839                        if (g_file_test(filename, G_FILE_TEST_EXISTS))
     1840                                saved_b16 = gaim_buddy_get_setting(b, "icon_checksum");
     1841                } else
     1842                        saved_b16 = NULL;
     1843
    18451844                if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) {
    18461845                        GSList *cur = od->requesticon;
     
    18481847                                cur = cur->next;
    18491848                        if (!cur) {
    1850                                 od->requesticon = g_slist_append(od->requesticon, strdup(normalize(info->sn)));
     1849                                od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(gc->account, info->sn)));
    18511850                                if (od->icontimer)
    18521851                                        g_source_remove(od->icontimer);
     
    18541853                        }
    18551854                }
    1856                 g_free(saved_b16);
    18571855                g_free(b16);
    18581856        }
     
    18651863static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) {
    18661864        GaimConnection *gc = sess->aux_data;
    1867         struct oscar_data *od = gc->proto_data;
     1865        OscarData *od = gc->proto_data;
    18681866        va_list ap;
    18691867        aim_userinfo_t *info;
     
    18751873        serv_got_update(gc, info->sn, 0, 0, 0, 0, 0);
    18761874
    1877         g_hash_table_remove(od->buddyinfo, normalize(info->sn));
     1875        g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn));
    18781876
    18791877        return 1;
     
    18901888        struct direct_im *dim = data;
    18911889        GaimConnection *gc = dim->gc;
    1892         struct oscar_data *od = gc->proto_data;
     1890        OscarData *od = gc->proto_data;
    18931891        GaimConversation *cnv;
    18941892        char buf[256];
     
    19291927static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) {
    19301928        GaimConnection *gc = sess->aux_data;
    1931         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     1929        OscarData *od = (OscarData *)gc->proto_data;
    19321930        GaimXfer *xfer;
    19331931        struct aim_oft_info *oft_info;
     
    20022000static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) {
    20032001        GaimConnection *gc = sess->aux_data;
    2004         struct oscar_data *od = gc->proto_data;
     2002        OscarData *od = gc->proto_data;
    20052003        GaimXfer *xfer;
    20062004        struct aim_oft_info *oft_info;
     
    20472045static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) {
    20482046        GaimConnection *gc = sess->aux_data;
    2049         struct oscar_data *od = gc->proto_data;
     2047        OscarData *od = gc->proto_data;
    20502048        GaimXfer *xfer;
    20512049        va_list ap;
     
    20792077static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) {
    20802078        GaimConnection *gc = sess->aux_data;
    2081         struct oscar_data *od = gc->proto_data;
     2079        OscarData *od = gc->proto_data;
    20822080        GaimXfer *xfer;
    20832081        va_list ap;
     
    21042102static void accept_direct_im(struct ask_direct *d) {
    21052103        GaimConnection *gc = d->gc;
    2106         struct oscar_data *od;
     2104        OscarData *od;
    21072105        struct direct_im *dim;
    21082106        char *host; int port = 4443;
     
    21142112        }
    21152113
    2116         od = (struct oscar_data *)gc->proto_data;
     2114        od = (OscarData *)gc->proto_data;
    21172115        gaim_debug(GAIM_DEBUG_INFO, "oscar", "Accepted DirectIM.\n");
    21182116
     
    21632161static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
    21642162        GaimConnection *gc = sess->aux_data;
    2165         struct oscar_data *od = gc->proto_data;
    2166         char *tmp;
    2167         GaimImFlags flags = 0;
     2163        OscarData *od = gc->proto_data;
     2164        gchar *tmp;
     2165        GaimConvImFlags flags = 0;
    21682166        gsize convlen;
    21692167        GError *err = NULL;
     
    21712169        const char *iconfile;
    21722170
    2173         bi = g_hash_table_lookup(od->buddyinfo, normalize(userinfo->sn));
     2171        bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, userinfo->sn));
    21742172        if (!bi) {
    21752173                bi = g_new0(struct buddyinfo, 1);
    2176                 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(userinfo->sn)), bi);
     2174                g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, userinfo->sn)), bi);
    21772175        }
    21782176
    21792177        if (args->icbmflags & AIM_IMFLAGS_AWAY)
    2180                 flags |= GAIM_IM_AUTO_RESP;
     2178                flags |= GAIM_CONV_IM_AUTO_RESP;
    21812179
    21822180        if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT)
     
    21972195
    21982196        if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc))) &&
    2199             (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) {
     2197            (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) {
    22002198                FILE *file;
    22012199                struct stat st;
     
    22412239                        gaim_debug(GAIM_DEBUG_INFO, "oscar",
    22422240                                           "Unicode IM conversion: %s\n", err->message);
    2243                         tmp = strdup(_("(There was an error receiving this message)"));
     2241                        tmp = g_strdup(_("(There was an error receiving this message)"));
    22442242                        g_error_free(err);
    22452243                }
     
    22632261                        gaim_debug(GAIM_DEBUG_INFO, "oscar",
    22642262                                           "ISO-8859-1 IM conversion: %s\n", err->message);
    2265                         tmp = strdup(_("(There was an error receiving this message)"));
     2263                        tmp = g_strdup(_("(There was an error receiving this message)"));
    22662264                        g_error_free(err);
    22672265                }
    22682266        }
    22692267
    2270         /* strip_linefeed(tmp); */
     2268        /* gaim_str_strip_cr(tmp); */
    22712269        serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL));
    22722270        g_free(tmp);
     
    22772275static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) {
    22782276        GaimConnection *gc = sess->aux_data;
    2279         struct oscar_data *od = gc->proto_data;
     2277        OscarData *od = gc->proto_data;
    22802278        const char *username = gaim_account_get_username(gaim_connection_get_account(gc));
    22812279
     
    24382436
    24392437        if (g_list_find(gaim_connections_get_all(), gc)) {
    2440                 struct oscar_data *od = gc->proto_data;
     2438                OscarData *od = gc->proto_data;
    24412439                GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name);
    24422440                GaimGroup *group = gaim_find_buddys_group(buddy);
     
    24642462
    24652463        if (g_list_find(gaim_connections_get_all(), gc)) {
    2466                 /* struct oscar_data *od = gc->proto_data; */
     2464                /* OscarData *od = gc->proto_data; */
    24672465                /* XXX - Take the buddy out of our buddy list */
    24682466        }
     
    25022500
    25032501        if (g_list_find(gaim_connections_get_all(), gc)) {
    2504                 struct oscar_data *od = gc->proto_data;
     2502                OscarData *od = gc->proto_data;
    25052503#ifdef NOSSI
    25062504                GaimBuddy *buddy;
     
    25092507                buddy = gaim_find_buddy(gc->account, data->name);
    25102508                aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHGRANTED, &message);
    2511                 show_got_added(gc, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL);
     2509                gaim_account_notify_added(gc->account, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL);
    25122510#else
    25132511                aim_ssi_sendauthreply(od->sess, data->name, 0x01, NULL);
     
    25232521
    25242522        if (g_list_find(gaim_connections_get_all(), gc)) {
    2525                 struct oscar_data *od = gc->proto_data;
     2523                OscarData *od = gc->proto_data;
    25262524#ifdef NOSSI
    25272525                aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given."));
     
    25402538}
    25412539
    2542 /* When someone sends you contacts */
    2543 static void gaim_icq_contactadd(struct name_data *data) {
     2540/* When someone sends you buddies */
     2541static void gaim_icq_buddyadd(struct name_data *data) {
    25442542        GaimConnection *gc = data->gc;
    25452543
    25462544        if (g_list_find(gaim_connections_get_all(), gc)) {
    2547                 show_add_buddy(gc, data->name, NULL, data->nick);
     2545                gaim_blist_request_add_buddy(gaim_connection_get_account(gc), data->name, NULL, data->nick);
    25482546        }
    25492547
     
    25682566        msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *));
    25692567        for (i=0; msg1[i]; i++) {
    2570                 strip_linefeed(msg1[i]);
     2568                gaim_str_strip_cr(msg1[i]);
    25712569                msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err);
    25722570                if (err) {
     
    25952593                case 0x04: { /* Someone sent you a URL */
    25962594                        if (i >= 2) {
    2597                                 gchar *uin = g_strdup_printf("%u", args->uin);
    2598                                 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", msg2[1], msg2[0]);
    2599                                 serv_got_im(gc, uin, message, 0, time(NULL));
    2600                                 g_free(uin);
    2601                                 g_free(message);
     2595                                if (msg2[1] != NULL) {
     2596                                        gchar *uin = g_strdup_printf("%u", args->uin);
     2597                                        gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>",
     2598                                                                                                         msg2[1],
     2599                                                                                                         (msg2[0] && msg2[0][0]) ? msg2[0] : msg2[1]);
     2600                                        serv_got_im(gc, uin, message, 0, time(NULL));
     2601                                        g_free(uin);
     2602                                        g_free(message);
     2603                                }
    26022604                        }
    26032605                } break;
     
    26262628                case 0x07: { /* Someone has denied you authorization */
    26272629                        if (i >= 1) {
    2628                                 gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your contact list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given."));
     2630                                gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your buddy list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given."));
    26292631                                gaim_notify_info(gc, NULL, _("ICQ authorization denied."),
    26302632                                                                 dialog_msg);
     
    26342636
    26352637                case 0x08: { /* Someone has granted you authorization */
    2636                         gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your contact list."), args->uin);
     2638                        gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your buddy list."), args->uin);
    26372639                        gaim_notify_info(gc, NULL, "ICQ authorization accepted.",
    26382640                                                         dialog_msg);
     
    26662668                case 0x12: {
    26672669                        /* Ack for authorizing/denying someone.  Or possibly an ack for sending any system notice */
    2668                         /* Someone added you to their contact list? */
     2670                        /* Someone added you to their buddy list? */
    26692671                } break;
    26702672
    2671                 case 0x13: { /* Someone has sent you some ICQ contacts */
     2673                case 0x13: { /* Someone has sent you some ICQ buddies */
    26722674                        int i, num;
    26732675                        gchar **text;
     
    26792681                                for (i=0; i<num; i++) {
    26802682                                        struct name_data *data = g_new(struct name_data, 1);
    2681                                         gchar *message = g_strdup_printf(_("ICQ user %u has sent you a contact: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]);
     2683                                        gchar *message = g_strdup_printf(_("ICQ user %u has sent you a buddy: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]);
    26822684                                        data->gc = gc;
    26832685                                        data->name = g_strdup(text[i*2+1]);
     
    26852687
    26862688                                        gaim_request_action(gc, NULL, message,
    2687                                                                                 _("Do you want to add this contact "
    2688                                                                                   "to your Buddy List?"),
     2689                                                                                _("Do you want to add this buddy "
     2690                                                                                  "to your buddy list?"),
    26892691                                                                                0, data, 2,
    2690                                                                                 _("Add"), G_CALLBACK(gaim_icq_contactadd),
     2692                                                                                _("Add"), G_CALLBACK(gaim_icq_buddyadd),
    26912693                                                                                _("Decline"), G_CALLBACK(oscar_free_name_data));
    26922694                                        g_free(message);
     
    26962698                } break;
    26972699
    2698                 case 0x1a: { /* Someone has sent you a greeting card or requested contacts? */
     2700                case 0x1a: { /* Someone has sent you a greeting card or requested buddies? */
    26992701                        /* This is boring and silly. */
    27002702                } break;
     
    28512853static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) {
    28522854        GaimConnection *gc = sess->aux_data;
    2853         struct oscar_data *od = gc->proto_data;
     2855        OscarData *od = gc->proto_data;
    28542856
    28552857/* BBB */
     
    28812883                        char *status_msg = gaim_icq_status(state);
    28822884                        char *dialog_msg, **splitmsg;
    2883                         struct oscar_data *od = gc->proto_data;
    2884                         GSList *l = od->evilhack;
    2885                         gboolean evilhack = FALSE;
    28862885
    28872886                        /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */
    28882887                        splitmsg = g_strsplit(msg, "\r\n", 0);
    28892888
    2890                         /* If who is in od->evilhack, then we're just getting the away message, otherwise this
    2891                          * will just get appended to the info box (which is already showing). */
    2892                         while (l) {
    2893                                 char *x = l->data;
    2894                                 if (!strcmp(x, normalize(who))) {
    2895                                         evilhack = TRUE;
    2896                                         g_free(x);
    2897                                         od->evilhack = g_slist_remove(od->evilhack, x);
    2898                                         break;
    2899                                 }
    2900                                 l = l->next;
    2901                         }
    2902 
    2903                         if (evilhack)
    2904                                 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg));
    2905                         else
    2906                                 dialog_msg = g_strdup_printf(_("<B>Status:</B> %s<HR>%s"), status_msg, g_strjoinv("<BR>", splitmsg));
    2907                         g_show_info_text(gc, who, 2, dialog_msg, NULL);
     2889                        dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg));
     2890                        gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, dialog_msg, NULL, NULL);
    29082891
    29092892                        g_free(status_msg);
     
    29742957#if 0
    29752958        GaimConnection *gc = sess->aux_data;
    2976         struct oscar_data *od = gc->proto_data;
     2959        OscarData *od = gc->proto_data;
    29772960        GaimXfer *xfer;
    29782961#endif
     
    30403023}
    30413024
     3025/*
     3026 * We get this error when there was an error in the locate family.  This
     3027 * happens when you request info of someone who is offline.
     3028 */
    30423029static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) {
    3043         char *buf;
     3030        gchar *buf;
    30443031        va_list ap;
    30453032        fu16_t reason;
     
    30513038        va_end(ap);
    30523039
    3053         buf = g_strdup_printf(_("User information for %s unavailable:"), destn);
    3054         gaim_notify_error(sess->aux_data, NULL, buf,
    3055                                           (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given."));
    3056         g_free(buf);
     3040        if (destn != NULL) {
     3041                buf = g_strdup_printf(_("User information for %s unavailable:"), destn);
     3042                gaim_notify_error(sess->aux_data, NULL, buf,
     3043                                                  (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given."));
     3044                g_free(buf);
     3045        }
    30573046
    30583047        return 1;
     
    30923081                                break;
    30933082                        case AIM_CAPS_DIRECTIM:
    3094                                 tmp = _("Direct IM");
     3083                                tmp = _("AIM Direct IM");
    30953084                                break;
    30963085                        case AIM_CAPS_CHAT:
     
    31133102                                tmp = _("Send Buddy List");
    31143103                                break;
    3115                         case AIM_CAPS_ICQ:
    3116                                 tmp = _("EveryBuddy Bug");
     3104                        case AIM_CAPS_ICQ_DIRECT:
     3105                                tmp = _("ICQ Direct Connect");
    31173106                                break;
    31183107                        case AIM_CAPS_APINFO:
     
    31413130                                break;
    31423131                        case AIM_CAPS_SECUREIM:
    3143                                 tmp = _("Secure IM");
     3132                                tmp = _("Security Enabled");
     3133                                break;
     3134                        case AIM_CAPS_VIDEO:
     3135                                tmp = _("Video Chat");
    31443136                                break;
    31453137                        default:
     
    31573149}
    31583150
    3159 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) {
     3151static int gaim_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...) {
    31603152        GaimConnection *gc = sess->aux_data;
    3161         struct oscar_data *od = gc->proto_data;
    3162         gchar *header;
    3163         GSList *l = od->evilhack;
    3164         gboolean evilhack = FALSE;
    3165         gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL;
     3153        GString *text;
     3154        gchar *info_utf8 = NULL, *away_utf8 = NULL;
     3155        const char *final = NULL;
    31663156        va_list ap;
    3167         aim_userinfo_t *info;
    3168         fu16_t infotype;
    3169         char *text_enc = NULL, *text = NULL, *utf8 = NULL;
    3170         int text_len;
    3171         const char *username = gaim_account_get_username(gaim_connection_get_account(gc));
     3157        aim_userinfo_t *userinfo;
    31723158
    31733159        va_start(ap, fr);
    3174         info = va_arg(ap, aim_userinfo_t *);
    3175         infotype = (fu16_t) va_arg(ap, unsigned int);
    3176         text_enc = va_arg(ap, char *);
    3177         text = va_arg(ap, char *);
    3178         text_len = va_arg(ap, int);
     3160        userinfo = va_arg(ap, aim_userinfo_t *);
    31793161        va_end(ap);
    31803162
    3181         if (text_len > 0) {
    3182                 if (!(utf8 = oscar_encoding_to_utf8(text_enc, text, text_len))) {
    3183                         utf8 = g_strdup(_("<i>Unable to display information because it was sent in an unknown encoding.</i>"));
    3184                         gaim_debug(GAIM_DEBUG_ERROR, "oscar",
    3185                                            "Encountered an unknown encoding while parsing userinfo\n");
    3186                 }
    3187         }
    3188 
    3189         if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) {
    3190                 onlinesince = g_strdup_printf(_("Online Since : <b>%s</b><br>\n"),
    3191                                         asctime(localtime((time_t *)&info->onlinesince)));
    3192         }
    3193 
    3194         if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) {
    3195                 membersince = g_strdup_printf(_("Member Since : <b>%s</b><br>\n"),
    3196                                         asctime(localtime((time_t *)&info->membersince)));
    3197         }
    3198 
    3199         if (info->present & AIM_USERINFO_PRESENT_IDLE) {
    3200                 gchar *itime = sec_to_text(info->idletime*60);
    3201                 idle = g_strdup_printf(_("Idle : <b>%s</b>"), itime);
     3163        text = g_string_new("");
     3164        g_string_append_printf(text, _("Username: <b>%s</b><br>\n"), userinfo->sn);
     3165        g_string_append_printf(text, _("Warning Level: <b>%d%%</b><br>\n"), (int)((userinfo->warnlevel/10.0) + 0.5));
     3166
     3167        if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE)
     3168                g_string_append_printf(text, _("Online Since: <b>%s</b><br>\n"),
     3169                                        asctime(localtime((time_t *)&userinfo->onlinesince)));
     3170
     3171        if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE)
     3172                g_string_append_printf(text, _("Member Since: <b>%s</b><br>\n"),
     3173                                        asctime(localtime((time_t *)&userinfo->membersince)));
     3174
     3175        if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) {
     3176                gchar *itime = gaim_str_seconds_to_string(userinfo->idletime*60);
     3177                g_string_append_printf(text, _("Idle: <b>%s</b>"), itime);
    32023178                g_free(itime);
    32033179        } else
    3204                 idle = g_strdup(_("Idle: <b>Active</b>"));
    3205 
    3206         header = g_strdup_printf(_("Username : <b>%s</b>  %s <br>\n"
    3207                         "Warning Level : <b>%d %%</b><br>\n"
    3208                         "%s"
    3209                         "%s"
    3210                         "%s\n"
    3211                         "<hr>\n"),
    3212                         info->sn,
    3213                         /* images(info->flags), */
    3214                         "",
    3215                         (int)((info->warnlevel/10.0) + 0.5),
    3216                         onlinesince ? onlinesince : "",
    3217                         membersince ? membersince : "",
    3218                         idle ? idle : "");
    3219 
    3220         g_free(onlinesince);
    3221         g_free(membersince);
    3222         g_free(idle);
    3223 
    3224         while (l) {
    3225                 char *x = l->data;
    3226                 if (!strcmp(x, normalize(info->sn))) {
    3227                         evilhack = TRUE;
    3228                         g_free(x);
    3229                         od->evilhack = g_slist_remove(od->evilhack, x);
    3230                         break;
    3231                 }
    3232                 l = l->next;
    3233         }
    3234 
    3235         if (infotype == AIM_GETINFO_AWAYMESSAGE) {
    3236                 if (evilhack) {
    3237                         g_show_info_text(gc, info->sn, 2,
    3238                                          header,
    3239                                          (utf8 && *utf8) ? away_subs(utf8, username) :
    3240                                          _("<i>User has no away message</i>"), NULL);
    3241                 } else {
    3242                         g_show_info_text(gc, info->sn, 0,
    3243                                          header,
    3244                                          (utf8 && *utf8) ? away_subs(utf8, username) : NULL,
    3245                                          (utf8 && *utf8) ? "<hr>" : NULL,
    3246                                          NULL);
    3247                 }
    3248         } else if (infotype == AIM_GETINFO_CAPABILITIES) {
    3249                 g_show_info_text(gc, info->sn, 2,
    3250                                 header,
    3251                                 "<i>", _("Client Capabilities: "),
    3252                                 caps_string(info->capabilities),
    3253                                 "</i>",
    3254                                 NULL);
    3255         } else {
    3256                 g_show_info_text(gc, info->sn, 1,
    3257                                  (utf8 && *utf8) ? away_subs(utf8, username) : _("<i>No Information Provided</i>"),
    3258                                  NULL);
    3259         }
    3260 
    3261         g_free(header);
    3262         g_free(utf8);
     3180                g_string_append_printf(text, _("Idle: <b>Active</b>"));
     3181
     3182        if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) {
     3183                away_utf8 = oscar_encoding_to_utf8(userinfo->away_encoding, userinfo->away, userinfo->away_len);
     3184                if (away_utf8 != NULL) {
     3185                        g_string_append_printf(text, "<hr>%s", away_utf8);
     3186                        g_free(away_utf8);
     3187                }
     3188        }
     3189
     3190        if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) {
     3191                info_utf8 = oscar_encoding_to_utf8(userinfo->info_encoding, userinfo->info, userinfo->info_len);
     3192                if (info_utf8 != NULL) {
     3193                        g_string_append_printf(text, "<hr>%s", info_utf8);
     3194                        g_free(info_utf8);
     3195                }
     3196        }
     3197
     3198        final = gaim_str_sub_away_formatters(text->str, gaim_account_get_username(gaim_connection_get_account(gc)));
     3199        g_string_free(text, TRUE);
     3200        gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, final, NULL, NULL);
    32633201
    32643202        return 1;
     
    32883226        fu16_t type;
    32893227        GaimConnection *gc = sess->aux_data;
    3290         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     3228        OscarData *od = (OscarData *)gc->proto_data;
    32913229
    32923230        va_start(ap, fr);
     
    33633301}
    33643302
    3365 static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) {
     3303static int gaim_conv_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) {
    33663304        va_list ap;
    33673305        int count, i;
     
    33813319
    33823320        for (i = 0; i < count; i++)
    3383                 gaim_chat_add_user(GAIM_CHAT(c->cnv), info[i].sn, NULL);
     3321                gaim_conv_chat_add_user(GAIM_CONV_CHAT(c->cnv), info[i].sn, NULL);
    33843322
    33853323        return 1;
    33863324}
    33873325
    3388 static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) {
     3326static int gaim_conv_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) {
    33893327        va_list ap;
    33903328        int count, i;
     
    34043342
    34053343        for (i = 0; i < count; i++)
    3406                 gaim_chat_remove_user(GAIM_CHAT(c->cnv), info[i].sn, NULL);
     3344                gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c->cnv), info[i].sn, NULL);
    34073345
    34083346        return 1;
    34093347}
    34103348
    3411 static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) {
     3349static int gaim_conv_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) {
    34123350        va_list ap;
    34133351        aim_userinfo_t *userinfo;
     
    34453383}
    34463384
    3447 static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) {
     3385static int gaim_conv_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) {
    34483386        GaimConnection *gc = sess->aux_data;
    34493387        va_list ap;
     
    34673405        struct aim_emailinfo *emailinfo;
    34683406        int havenewmail;
     3407        char *alertitle, *alerturl;
    34693408
    34703409        va_start(ap, fr);
    34713410        emailinfo = va_arg(ap, struct aim_emailinfo *);
    34723411        havenewmail = va_arg(ap, int);
     3412        alertitle = va_arg(ap, char *);
     3413        alerturl  = va_arg(ap, char *);
    34733414        va_end(ap);
    34743415
     
    34793420                g_free(to);
    34803421        }
     3422       
     3423        if (alertitle)
     3424                gaim_debug(GAIM_DEBUG_MISC, "oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : "");
    34813425
    34823426        return 1;
     
    34853429static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) {
    34863430        GaimConnection *gc = sess->aux_data;
    3487         struct oscar_data *od = gc->proto_data;
     3431        OscarData *od = gc->proto_data;
    34883432        char *sn;
    34893433
     
    35033447static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) {
    35043448        GaimConnection *gc = sess->aux_data;
    3505         struct oscar_data *od = gc->proto_data;
     3449        OscarData *od = gc->proto_data;
    35063450        GSList *cur;
    35073451        va_list ap;
     
    35233467                gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc),
    35243468                                                                          sn, icon, iconlen);
    3525                 b16 = tobase16(iconcsum, iconcsumlen);
     3469                b16 = gaim_base16_encode(iconcsum, iconcsumlen);
    35263470                if (b16) {
    35273471                        gaim_buddy_set_setting(b, "icon_checksum", b16);
    35283472                        gaim_blist_save();
    3529                         free(b16);
     3473                        g_free(b16);
    35303474                }
    35313475        }
     
    35513495static gboolean gaim_icon_timerfunc(gpointer data) {
    35523496        GaimConnection *gc = data;
    3553         struct oscar_data *od = gc->proto_data;
    3554         struct buddyinfo *bi;
     3497        OscarData *od = gc->proto_data;
     3498        aim_userinfo_t *userinfo;
    35553499        aim_conn_t *conn;
    35563500
     
    35953539        }
    35963540
    3597         bi = g_hash_table_lookup(od->buddyinfo, (char *)od->requesticon->data);
    3598         if (bi && (bi->iconcsumlen > 0)) {
    3599                 aim_bart_request(od->sess, od->requesticon->data, bi->iconcsum, bi->iconcsumlen);
     3541        userinfo = aim_locate_finduserinfo(od->sess, (char *)od->requesticon->data);
     3542        if ((userinfo != NULL) && (userinfo->iconcsumlen > 0)) {
     3543                aim_bart_request(od->sess, od->requesticon->data, userinfo->iconcsum, userinfo->iconcsumlen);
    36003544                return FALSE;
    36013545        } else {
     
    36903634        va_end(ap);
    36913635
    3692         serv_got_eviled(gc, (userinfo && userinfo->sn[0]) ? userinfo->sn : NULL, (newevil/10.0) + 0.5);
     3636        serv_got_eviled(gc, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5);
    36933637
    36943638        return 1;
     
    37143658static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) {
    37153659        GaimConnection *gc = sess->aux_data;
    3716         struct oscar_data *od = gc->proto_data;
     3660        OscarData *od = gc->proto_data;
    37173661        va_list ap;
    37183662        fu16_t code;
     
    37403684
    37413685static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) {
     3686        GaimConnection *gc = sess->aux_data;
    37423687
    37433688        aim_reqpersonalinfo(sess, fr->conn);
    37443689
    37453690#ifndef NOSSI
    3746         gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting ssi list\n");
     3691        gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting rights and list\n");
    37473692        aim_ssi_reqrights(sess);
    37483693        aim_ssi_reqdata(sess);
    37493694#endif
    37503695
    3751         aim_bos_reqlocaterights(sess, fr->conn);
    3752         aim_bos_reqbuddyrights(sess, fr->conn);
     3696        aim_locate_reqrights(sess);
     3697        aim_buddylist_reqrights(sess, fr->conn);
    37533698        aim_im_reqparams(sess);
    3754         aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi? */
     3699        aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi */
    37553700
    37563701#ifdef NOSSI
     3702        gaim_debug(GAIM_DEBUG_INFO, "oscar", "bos: requesting rights\n");
     3703        aim_bos_reqrights(sess, fr->conn);
    37573704        aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS);
    37583705        aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE);
    37593706#endif
    37603707
     3708        gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS);
     3709
    37613710        return 1;
    37623711}
     
    37643713static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) {
    37653714        GaimConnection *gc = sess->aux_data;
    3766         struct oscar_data *od = gc->proto_data;
     3715        OscarData *od = gc->proto_data;
    37673716
    37683717        aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0);
     
    38393788{
    38403789        GaimConnection *gc = sess->aux_data;
    3841         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     3790        OscarData *od = (OscarData *)gc->proto_data;
    38423791        va_list ap;
    38433792        fu16_t maxsiglen;
     
    38533802
    38543803        if (od->icq)
    3855                 aim_bos_setprofile(sess, fr->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq);
     3804                aim_locate_setcaps(od->sess, caps_icq);
    38563805        else
    3857                 oscar_set_info(gc, gc->account->user_info);
     3806                aim_locate_setcaps(od->sess, caps_aim);
     3807        oscar_set_info(gc, gc->account->user_info);
    38583808
    38593809        return 1;
     
    38643814        fu16_t maxbuddies, maxwatchers;
    38653815        GaimConnection *gc = sess->aux_data;
    3866         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     3816        OscarData *od = (OscarData *)gc->proto_data;
    38673817
    38683818        va_start(ap, fr);
     
    38813831
    38823832static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) {
     3833        GaimConnection *gc = sess->aux_data;
     3834        OscarData *od = (OscarData *)gc->proto_data;
     3835        va_list ap;
    38833836        fu16_t maxpermits, maxdenies;
    3884         va_list ap;
    3885         GaimConnection *gc = sess->aux_data;
    3886         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
    38873837
    38883838        va_start(ap, fr);
     
    39043854        aim_clientready(sess, fr->conn);
    39053855        aim_srv_setavailmsg(sess, NULL);
    3906         aim_bos_setidle(sess, fr->conn, 0);
     3856        aim_srv_setidle(sess, 0);
    39073857
    39083858        if (od->icq) {
     
    39353885        args.msglen = msg->msglen;
    39363886        args.msg = msg->msg;
    3937         t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
     3887        t = gaim_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
    39383888        incomingim_chan4(sess, fr->conn, NULL, &args, t);
    39393889
     
    39463896        return 1;
    39473897}
     3898
     3899#if 0
     3900/*
     3901 * Update, 2003-11-09:
     3902 * Joseph S. Myers, a gcc dude, fixed this for gcc 3.4!  Rock on!
     3903 *
     3904 * It may not be my place to do this, but...
     3905 * I feel pretty strongly that the "last 2 digits" warning is ridiculously
     3906 * stupid, and should not exist for % switches (%x in our case) that request
     3907 * a year in the preferred representation for the current locale.  For that
     3908 * reason I've chosen to not use this workaround (n., see kluge).
     3909 *
     3910 * I have a date.  I want to show it to the user in the "preferred" way. 
     3911 * Whether that displays a 2 digit year is perfectly fine--after all, it's
     3912 * what the locale wanted.
     3913 *
     3914 * If I have a necessity for a full representation of the year in the current
     3915 * locale, then I'll use a switch that returns a full representation of the
     3916 * year.
     3917 *
     3918 * If you think the preferred locale should show 4 digits instead of 2 digits
     3919 * (because you're anal, or whatever), then change the f***ing locale.
     3920 *
     3921 * I guess the bottom line is--I'm trying to show a date to the user how they
     3922 * prefer to see it, why the hell does gcc want me to change that?
     3923 *
     3924 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3190
     3925 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8714
     3926 */
     3927
     3928/*
     3929 * This function was recommended by the STRFTIME(3) man page to remove the
     3930 * "last 2 digits" warning.
     3931 */
     3932static size_t my_strftime(char *s, size_t max, const char  *fmt, 
     3933                        const struct tm *tm)
     3934{
     3935        return strftime(s, max, fmt, tm);
     3936}
     3937#endif
    39483938
    39493939static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...)
     
    39663956        g_snprintf(who, sizeof(who), "%u", info->uin);
    39673957        buf = g_strdup_printf("<b>%s:</b> %s", _("UIN"), who);
    3968         if (info->nick && info->nick[0] && (utf8 = gaim_try_conv_to_utf8(info->nick))) {
     3958        if (info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) {
    39693959                tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Nick"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    39703960        }
    3971         if (info->first && info->first[0] && (utf8 = gaim_try_conv_to_utf8(info->first))) {
     3961        if (info->first && info->first[0] && (utf8 = gaim_utf8_try_convert(info->first))) {
    39723962                tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("First Name"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    39733963        }
    3974         if (info->last && info->last[0] && (utf8 = gaim_try_conv_to_utf8(info->last))) {
     3964        if (info->last && info->last[0] && (utf8 = gaim_utf8_try_convert(info->last))) {
    39753965                tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Last Name"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    39763966        }
    3977         if (info->email && info->email[0] && (utf8 = gaim_try_conv_to_utf8(info->email))) {
     3967        if (info->email && info->email[0] && (utf8 = gaim_utf8_try_convert(info->email))) {
    39783968                tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Email Address"), ":</b> <a href=\"mailto:", utf8, "\">", utf8, "</a>", NULL);  g_free(tmp); g_free(utf8);
    39793969        }
     
    39813971                int i;
    39823972                for (i = 0; i < info->numaddresses; i++) {
    3983                         if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_try_conv_to_utf8(info->email2[i]))) {
     3973                        if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_utf8_try_convert(info->email2[i]))) {
    39843974                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Email Address"), ":</b> <a href=\"mailto:", utf8, "\">", utf8, "</a>", NULL);  g_free(tmp); g_free(utf8);
    39853975                        }
    39863976                }
    39873977        }
    3988         if (info->mobile && info->mobile[0] && (utf8 = gaim_try_conv_to_utf8(info->mobile))) {
     3978        if (info->mobile && info->mobile[0] && (utf8 = gaim_utf8_try_convert(info->mobile))) {
    39893979                tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Mobile Phone"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    39903980        }
     
    40063996                tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Age"), ":</b> ", age, NULL);  g_free(tmp);
    40073997        }
    4008         if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_try_conv_to_utf8(info->personalwebpage))) {
     3998        if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_utf8_try_convert(info->personalwebpage))) {
    40093999                tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Personal Web Page"), ":</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL);  g_free(tmp); g_free(utf8);
    40104000        }
    4011         if (info->info && info->info[0] && (utf8 = gaim_try_conv_to_utf8(info->info))) {
     4001        if (info->info && info->info[0] && (utf8 = gaim_utf8_try_convert(info->info))) {
    40124002                tmp = buf;  buf = g_strconcat(tmp, "<hr><b>", _("Additional Information"), ":</b><br>", utf8, NULL);  g_free(tmp); g_free(utf8);
    40134003        }
     
    40154005        if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) {
    40164006                tmp = buf;  buf = g_strconcat(tmp, "<b>", _("Home Address"), ":</b>", NULL);  g_free(tmp);
    4017                 if (info->homeaddr && info->homeaddr[0] && (utf8 = gaim_try_conv_to_utf8(info->homeaddr))) {
     4007                if (info->homeaddr && info->homeaddr[0] && (utf8 = gaim_utf8_try_convert(info->homeaddr))) {
    40184008                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    40194009                }
    4020                 if (info->homecity && info->homecity[0] && (utf8 = gaim_try_conv_to_utf8(info->homecity))) {
     4010                if (info->homecity && info->homecity[0] && (utf8 = gaim_utf8_try_convert(info->homecity))) {
    40214011                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8,  NULL);  g_free(tmp); g_free(utf8);
    40224012                }
    4023                 if (info->homestate && info->homestate[0] && (utf8 = gaim_try_conv_to_utf8(info->homestate))) {
     4013                if (info->homestate && info->homestate[0] && (utf8 = gaim_utf8_try_convert(info->homestate))) {
    40244014                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    40254015                }
    4026                 if (info->homezip && info->homezip[0] && (utf8 = gaim_try_conv_to_utf8(info->homezip))) {
     4016                if (info->homezip && info->homezip[0] && (utf8 = gaim_utf8_try_convert(info->homezip))) {
    40274017                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    40284018                }
     
    40314021        if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) {
    40324022                tmp = buf;  buf = g_strconcat(tmp, "<b>", _("Work Address"), ":</b>", NULL);  g_free(tmp);
    4033                 if (info->workaddr && info->workaddr[0] && (utf8 = gaim_try_conv_to_utf8(info->workaddr))) {
     4023                if (info->workaddr && info->workaddr[0] && (utf8 = gaim_utf8_try_convert(info->workaddr))) {
    40344024                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    40354025                }
    4036                 if (info->workcity && info->workcity[0] && (utf8 = gaim_try_conv_to_utf8(info->workcity))) {
     4026                if (info->workcity && info->workcity[0] && (utf8 = gaim_utf8_try_convert(info->workcity))) {
    40374027                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    40384028                }
    4039                 if (info->workstate && info->workstate[0] && (utf8 = gaim_try_conv_to_utf8(info->workstate))) {
     4029                if (info->workstate && info->workstate[0] && (utf8 = gaim_utf8_try_convert(info->workstate))) {
    40404030                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    40414031                }
    4042                 if (info->workzip && info->workzip[0] && (utf8 = gaim_try_conv_to_utf8(info->workzip))) {
     4032                if (info->workzip && info->workzip[0] && (utf8 = gaim_utf8_try_convert(info->workzip))) {
    40434033                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    40444034                }
     
    40474037        if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) {
    40484038                tmp = buf;  buf = g_strconcat(tmp, "<b>", _("Work Information"), ":</b>", NULL);  g_free(tmp);
    4049                 if (info->workcompany && info->workcompany[0] && (utf8 = gaim_try_conv_to_utf8(info->workcompany))) {
     4039                if (info->workcompany && info->workcompany[0] && (utf8 = gaim_utf8_try_convert(info->workcompany))) {
    40504040                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Company"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    40514041                }
    4052                 if (info->workdivision && info->workdivision[0] && (utf8 = gaim_try_conv_to_utf8(info->workdivision))) {
     4042                if (info->workdivision && info->workdivision[0] && (utf8 = gaim_utf8_try_convert(info->workdivision))) {
    40534043                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Division"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    40544044                }
    4055                 if (info->workposition && info->workposition[0] && (utf8 = gaim_try_conv_to_utf8(info->workposition))) {
     4045                if (info->workposition && info->workposition[0] && (utf8 = gaim_utf8_try_convert(info->workposition))) {
    40564046                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Position"), ":</b> ", utf8, NULL);  g_free(tmp); g_free(utf8);
    40574047                }
    4058                 if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_try_conv_to_utf8(info->workwebpage))) {
     4048                if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_utf8_try_convert(info->workwebpage))) {
    40594049                        tmp = buf;  buf = g_strconcat(tmp, "\n<br><b>", _("Web Page"), ":</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL);  g_free(tmp); g_free(utf8);
    40604050                }
     
    40834073        va_end(ap);
    40844074
    4085         if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_try_conv_to_utf8(info->nick))) {
     4075        if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) {
    40864076                g_snprintf(who, sizeof(who), "%u", info->uin);
    40874077                serv_got_alias(gc, who, utf8);
     
    40984088static int gaim_popup(aim_session_t *sess, aim_frame_t *fr, ...)
    40994089{
     4090        GaimConnection *gc = sess->aux_data;
     4091        gchar *text;
     4092        va_list ap;
    41004093        char *msg, *url;
    41014094        fu16_t wid, hei, delay;
    4102         va_list ap;
    41034095
    41044096        va_start(ap, fr);
     
    41104102        va_end(ap);
    41114103
    4112         serv_got_popup(msg, url, wid, hei);
     4104        text = g_strdup_printf("%s<br><a href=\"%s\">%s</a>", msg, url, url);
     4105        gaim_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL);
     4106        g_free(text);
    41134107
    41144108        return 1;
    41154109}
    41164110
    4117 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) {
     4111static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...)
     4112{
    41184113        GaimConnection *gc = sess->aux_data;
    41194114        gchar *secondary;
     
    42484243
    42494244static void oscar_keepalive(GaimConnection *gc) {
    4250         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4245        OscarData *od = (OscarData *)gc->proto_data;
    42514246        aim_flap_nop(od->sess, od->conn);
    42524247}
    42534248
    42544249static int oscar_send_typing(GaimConnection *gc, const char *name, int typing) {
    4255         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4250        OscarData *od = (OscarData *)gc->proto_data;
    42564251        struct direct_im *dim = find_direct_im(od, name);
    42574252        if (dim)
     
    42674262                for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next);
    42684263                if (!list) {
    4269                         struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(name));
     4264                        struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name));
    42704265                        if (bi && bi->typingnot) {
    42714266                                if (typing == GAIM_TYPING)
     
    42814276}
    42824277static void oscar_ask_direct_im(GaimConnection *gc, const char *name);
    4283 static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimImFlags);
    4284 
    4285 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimImFlags imflags) {
    4286         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4278static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimConvImFlags);
     4279
     4280static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) {
     4281        OscarData *od = (OscarData *)gc->proto_data;
    42874282        struct direct_im *dim = find_direct_im(od, name);
    42884283        int ret = 0;
     
    42944289                /* If we're directly connected, send a direct IM */
    42954290                ret = gaim_odc_send_im(od->sess, dim->conn, message, imflags);
    4296         } else if (imflags & GAIM_IM_IMAGES) {
     4291        } else if (imflags & GAIM_CONV_IM_IMAGES) {
    42974292                /* Trying to send an IM image outside of a direct connection. */
    42984293                oscar_ask_direct_im(gc, name);
     
    43044299                gsize len;
    43054300
    4306                 bi = g_hash_table_lookup(od->buddyinfo, normalize(name));
     4301                bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name));
    43074302                if (!bi) {
    43084303                        bi = g_new0(struct buddyinfo, 1);
    4309                         g_hash_table_insert(od->buddyinfo, g_strdup(normalize(name)), bi);
     4304                        g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, name)), bi);
    43104305                }
    43114306
     
    43194314                        args.featureslen = sizeof(features_aim);
    43204315
    4321                         if (imflags & GAIM_IM_AUTO_RESP)
     4316                        if (imflags & GAIM_CONV_IM_AUTO_RESP)
    43224317                                args.flags |= AIM_IMFLAGS_AWAY;
    43234318                }
     
    43414336                                args.iconstamp = st.st_mtime;
    43424337
    4343                                 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time))
     4338                                if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) {
    43444339                                        bi->ico_informed = FALSE;
     4340                                        bi->ico_sent     = FALSE;
     4341                                }
    43454342
    43464343                                if (!bi->ico_informed) {
     
    43624359                /* For ICQ send newlines as CR/LF, for AIM send newlines as <BR> */
    43634360                if (isdigit(name[0]))
    4364                         tmpmsg = add_cr(message);
     4361                        tmpmsg = gaim_str_add_cr(message);
    43654362                else
    4366                         tmpmsg = strdup_withhtml(message);
     4363                        tmpmsg = gaim_strdup_withhtml(message);
    43674364                len = strlen(tmpmsg);
    43684365
     
    44214418}
    44224419
    4423 static void oscar_get_info(GaimConnection *g, const char *name) {
    4424         struct oscar_data *od = (struct oscar_data *)g->proto_data;
    4425         if (od->icq)
     4420static void oscar_get_info(GaimConnection *gc, const char *name) {
     4421        OscarData *od = (OscarData *)gc->proto_data;
     4422
     4423        if (od->icq && isdigit(name[0]))
    44264424                aim_icq_getallinfo(od->sess, name);
    44274425        else
    4428                 /* people want the away message on the top, so we get the away message
    4429                  * first and then get the regular info, since it's too difficult to
    4430                  * insert in the middle. i hate people. */
    4431                 aim_getinfo(od->sess, od->conn, name, AIM_GETINFO_AWAYMESSAGE);
    4432 }
    4433 
    4434 static void oscar_get_away(GaimConnection *g, const char *who) {
    4435         struct oscar_data *od = (struct oscar_data *)g->proto_data;
     4426                aim_locate_getinfoshort(od->sess, name, 0x00000003);
     4427}
     4428
     4429static void oscar_get_away(GaimConnection *gc, const char *who) {
     4430        OscarData *od = (OscarData *)gc->proto_data;
    44364431        if (od->icq) {
    4437                 GaimBuddy *budlight = gaim_find_buddy(g->account, who);
     4432                GaimBuddy *budlight = gaim_find_buddy(gc->account, who);
    44384433                if (budlight)
    44394434                        if ((budlight->uc & 0xffff0000) >> 16)
     
    44444439                else
    44454440                        gaim_debug(GAIM_DEBUG_ERROR, "oscar",
    4446                                            "Error: Could not find %s in local contact list, therefore unable to request status message.\n", who);
     4441                                           "Error: Could not find %s in local buddy list, therefore unable to request status message.\n", who);
    44474442        } else
    4448                 aim_getinfo(od->sess, od->conn, who, AIM_GETINFO_GENERALINFO);
    4449 }
    4450 
    4451 static void oscar_set_dir(GaimConnection *g, const char *first, const char *middle, const char *last,
     4443                aim_locate_getinfoshort(od->sess, who, 0x00000002);
     4444}
     4445
     4446static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last,
    44524447                          const char *maiden, const char *city, const char *state, const char *country, int web) {
    44534448        /* XXX - some of these things are wrong, but i'm lazy */
    4454         struct oscar_data *od = (struct oscar_data *)g->proto_data;
    4455         aim_setdirectoryinfo(od->sess, od->conn, first, middle, last,
     4449        OscarData *od = (OscarData *)gc->proto_data;
     4450        aim_locate_setdirinfo(od->sess, first, middle, last,
    44564451                                maiden, NULL, NULL, city, state, NULL, 0, web);
    44574452}
    44584453
    44594454static void oscar_set_idle(GaimConnection *gc, int time) {
    4460         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
    4461         aim_bos_setidle(od->sess, od->conn, time);
     4455        OscarData *od = (OscarData *)gc->proto_data;
     4456        aim_srv_setidle(od->sess, time);
    44624457}
    44634458
    44644459static void oscar_set_info(GaimConnection *gc, const char *text) {
    4465         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4460        OscarData *od = (OscarData *)gc->proto_data;
    44664461        fu32_t flags = 0;
    44674462        char *text_html = NULL;
     
    44764471                                                          "again when you are fully connected."));
    44774472
    4478         if (od->icq)
    4479                 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq);
    4480         else {
    4481                 if (!text) {
    4482                         aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_aim);
    4483                         return;
    4484                 }
     4473        if (!text) {
     4474                aim_locate_setprofile(od->sess, NULL, "", 0, NULL, NULL, 0);
     4475                return;
     4476        }
    44854477               
    4486                 text_html = strdup_withhtml(text);
    4487                 flags = oscar_encoding_check(text_html);
    4488                 if (flags & AIM_IMFLAGS_UNICODE) {
    4489                         msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
    4490                         aim_bos_setprofile(od->sess, od->conn, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim);
    4491                         g_free(msg);
    4492                 } else if (flags & AIM_IMFLAGS_ISO_8859_1) {
    4493                         msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL);
    4494                         aim_bos_setprofile(od->sess, od->conn, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim);
    4495                         g_free(msg);
    4496                 } else {
    4497                         msglen = strlen(text_html);
    4498                         aim_bos_setprofile(od->sess, od->conn, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim);
    4499                 }
    4500 
    4501                 if (msglen > od->rights.maxsiglen) {
    4502                         gchar *errstr;
    4503                         errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte "
    4504                                                                          "has been exceeded.  Gaim has truncated it for you.",
    4505                                                                          "The maximum profile length of %d bytes "
    4506                                                                          "has been exceeded.  Gaim has truncated it for you.",
    4507                                                                          od->rights.maxsiglen), od->rights.maxsiglen);
    4508                         gaim_notify_warning(gc, NULL, _("Profile too long."), errstr);
    4509                         g_free(errstr);
    4510                 }
    4511 
    4512                 g_free(text_html);
    4513 
    4514         }
     4478        text_html = gaim_strdup_withhtml(text);
     4479        flags = oscar_encoding_check(text_html);
     4480        if (flags & AIM_IMFLAGS_UNICODE) {
     4481                msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
     4482                aim_locate_setprofile(od->sess, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0);
     4483                g_free(msg);
     4484        } else if (flags & AIM_IMFLAGS_ISO_8859_1) {
     4485                msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL);
     4486                aim_locate_setprofile(od->sess, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0);
     4487                g_free(msg);
     4488        } else {
     4489                msglen = strlen(text_html);
     4490                aim_locate_setprofile(od->sess, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0);
     4491        }
     4492
     4493        if (msglen > od->rights.maxsiglen) {
     4494                gchar *errstr;
     4495                errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte "
     4496                                                                 "has been exceeded.  Gaim has truncated it for you.",
     4497                                                                 "The maximum profile length of %d bytes "
     4498                                                                 "has been exceeded.  Gaim has truncated it for you.",
     4499                                                                 od->rights.maxsiglen), od->rights.maxsiglen);
     4500                gaim_notify_warning(gc, NULL, _("Profile too long."), errstr);
     4501                g_free(errstr);
     4502        }
     4503
     4504        g_free(text_html);
    45154505
    45164506        return;
    45174507}
    45184508
    4519 static void oscar_set_away_aim(GaimConnection *gc, struct oscar_data *od, const char *text)
     4509static void oscar_set_away_aim(GaimConnection *gc, OscarData *od, const char *text)
    45204510{
    45214511        fu32_t flags = 0;
     
    45384528
    45394529        if (!text) {
    4540                 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, "", 0, caps_aim);
     4530                aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0);
    45414531                return;
    45424532        }
    45434533
    4544         text_html = strdup_withhtml(text);
     4534        text_html = gaim_strdup_withhtml(text);
    45454535        flags = oscar_encoding_check(text_html);
    45464536        if (flags & AIM_IMFLAGS_UNICODE) {
    45474537                msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
    4548                 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "unicode-2-0", msg,
    4549                         (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim);
     4538                aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg,
     4539                        (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen));
    45504540                g_free(msg);
    45514541                gc->away = g_strndup(text, od->rights.maxawaymsglen/2);
    45524542        } else if (flags & AIM_IMFLAGS_ISO_8859_1) {
    45534543                msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL);
    4554                 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "iso-8859-1", msg,
    4555                         (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim);
     4544                aim_locate_setprofile(od->sess, NULL, NULL, 0, "iso-8859-1", msg,
     4545                        (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen));
    45564546                g_free(msg);
    45574547                gc->away = g_strndup(text_html, od->rights.maxawaymsglen);
    45584548        } else {
    45594549                msglen = strlen(text_html);
    4560                 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "us-ascii", text_html,
    4561                         (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim);
     4550                aim_locate_setprofile(od->sess, NULL, NULL, 0, "us-ascii", text_html,
     4551                        (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen));
    45624552                gc->away = g_strndup(text_html, od->rights.maxawaymsglen);
    45634553        }
     
    45794569}
    45804570
    4581 static void oscar_set_away_icq(GaimConnection *gc, struct oscar_data *od, const char *state, const char *message)
     4571static void oscar_set_away_icq(GaimConnection *gc, OscarData *od, const char *state, const char *message)
    45824572{
    45834573        GaimAccount *account = gaim_connection_get_account(gc);
     
    46314621static void oscar_set_away(GaimConnection *gc, const char *state, const char *message)
    46324622{
    4633         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4623        OscarData *od = (OscarData *)gc->proto_data;
    46344624
    46354625        if (od->icq)
     
    46424632
    46434633static void oscar_warn(GaimConnection *gc, const char *name, int anon) {
    4644         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4634        OscarData *od = (OscarData *)gc->proto_data;
    46454635        aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0);
    46464636}
     
    46484638static void oscar_dir_search(GaimConnection *gc, const char *first, const char *middle, const char *last,
    46494639                             const char *maiden, const char *city, const char *state, const char *country, const char *email) {
    4650         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4640        OscarData *od = (OscarData *)gc->proto_data;
    46514641        if (strlen(email))
    46524642                aim_search_address(od->sess, od->conn, email);
     
    46544644
    46554645static void oscar_add_buddy(GaimConnection *gc, const char *name, GaimGroup *g) {
    4656         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4646        OscarData *od = (OscarData *)gc->proto_data;
    46574647#ifdef NOSSI
    46584648        aim_add_buddy(od->sess, od->conn, name);
     
    46734663
    46744664static void oscar_add_buddies(GaimConnection *gc, GList *buddies) {
    4675         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4665        OscarData *od = (OscarData *)gc->proto_data;
    46764666#ifdef NOSSI
    46774667        char buf[MSG_LEN];
     
    46794669        while (buddies) {
    46804670                if (n > MSG_LEN - 18) {
    4681                         aim_bos_setbuddylist(od->sess, od->conn, buf);
     4671                        aim_buddylist_set(od->sess, od->conn, buf);
    46824672                        n = 0;
    46834673                }
     
    46854675                buddies = buddies->next;
    46864676        }
    4687         aim_bos_setbuddylist(od->sess, od->conn, buf);
     4677        aim_buddylist_set(od->sess, od->conn, buf);
    46884678#else
    46894679        if (od->sess->ssi.received_data) {
    46904680                while (buddies) {
    4691                         GaimBuddy *buddy = gaim_find_buddy(gc->account, (const char *)buddies->data);
    4692                         GaimGroup *group = gaim_find_buddys_group(buddy);
    4693                         if (buddy && group) {
    4694                                 gaim_debug(GAIM_DEBUG_INFO, "oscar",
    4695                                                    "ssi: adding buddy %s to group %s\n", (const char *)buddies->data, group->name);
    4696                                 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0);
    4697                         }
     4681                        oscar_add_buddy(gc, (const char *)buddies->data, NULL);
    46984682                        buddies = buddies->next;
    46994683                }
     
    47034687
    47044688static void oscar_remove_buddy(GaimConnection *gc, const char *name, const char *group) {
    4705         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4689        OscarData *od = (OscarData *)gc->proto_data;
    47064690#ifdef NOSSI
    47074691        aim_remove_buddy(od->sess, od->conn, name);
     
    47164700
    47174701static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) {
    4718         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4702        OscarData *od = (OscarData *)gc->proto_data;
    47194703#ifdef NOSSI
    47204704        GList *cur;
     
    47354719#ifndef NOSSI
    47364720static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) {
    4737         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4721        OscarData *od = (OscarData *)gc->proto_data;
    47384722        if (od->sess->ssi.received_data && strcmp(old_group, new_group)) {
    47394723                gaim_debug(GAIM_DEBUG_INFO, "oscar",
     
    47444728
    47454729static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) {
    4746         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4730        OscarData *od = (OscarData *)gc->proto_data;
    47474731        if (od->sess->ssi.received_data) {
    47484732                char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name);
     
    47564740
    47574741static void oscar_rename_group(GaimConnection *g, const char *old_group, const char *new_group, GList *members) {
    4758         struct oscar_data *od = (struct oscar_data *)g->proto_data;
     4742        OscarData *od = (OscarData *)g->proto_data;
    47594743
    47604744        if (od->sess->ssi.received_data) {
     
    47804764static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) {
    47814765        GaimConnection *gc = sess->aux_data;
    4782         struct oscar_data *od = gc->proto_data;
     4766        OscarData *od = gc->proto_data;
    47834767        va_list ap;
    47844768        fu16_t reason;
     
    48074791static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) {
    48084792        GaimConnection *gc = sess->aux_data;
    4809         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4793        OscarData *od = (OscarData *)gc->proto_data;
    48104794        int numtypes, i;
    48114795        fu16_t *maxitems;
     
    48404824        GaimConnection *gc = sess->aux_data;
    48414825        GaimAccount *account = gaim_connection_get_account(gc);
    4842         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     4826        OscarData *od = (OscarData *)gc->proto_data;
    48434827        struct aim_ssi_item *curitem;
    48444828        int tmp;
     
    48624846        /* Add from server list to local list */
    48634847        for (curitem=sess->ssi.local; curitem; curitem=curitem->next) {
     4848                if ((curitem->name == NULL) || (g_utf8_validate(curitem->name, -1, NULL)))
    48644849                switch (curitem->type) {
    48654850                        case 0x0000: { /* Buddy */
    48664851                                if (curitem->name) {
    48674852                                        char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name);
    4868                                         char *gname_utf8 = gaim_try_conv_to_utf8(gname);
     4853                                        char *gname_utf8 = gname ? gaim_utf8_try_convert(gname) : NULL;
    48694854                                        char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name);
    4870                                         char *alias_utf8 = gaim_try_conv_to_utf8(alias);
     4855                                        char *alias_utf8 = alias ? gaim_utf8_try_convert(alias) : NULL;
    48714856                                        GaimBuddy *buddy = gaim_find_buddy(gc->account, curitem->name);
    48724857                                        /* Should gname be freed here? -- elb */
     
    48934878                                                export = TRUE;
    48944879                                        }
    4895                                         free(gname_utf8);
    4896                                         free(alias_utf8);
     4880                                        g_free(gname_utf8);
     4881                                        g_free(alias_utf8);
    48974882                                }
    48984883                        } break;
     
    49584943                GaimGroup *group;
    49594944                GaimBuddy *buddy;
    4960                 struct gaim_buddy_list *blist;
     4945                GaimBuddyList *blist;
    49614946                GSList *cur;
    49624947
     
    49754960                                                buddy = (GaimBuddy *)bnode;
    49764961                                                if (buddy->account == gc->account) {
    4977                                                         gchar *servernick = gaim_buddy_get_setting(buddy, "servernick");
    4978                                                         if (servernick) {
     4962                                                        const char *servernick = gaim_buddy_get_setting(buddy, "servernick");
     4963                                                        if (servernick)
    49794964                                                                serv_got_alias(gc, buddy->name, servernick);
    4980                                                                 g_free(servernick);
    4981                                                         }
     4965
    49824966                                                        if (aim_ssi_itemlist_exists(sess->ssi.local, buddy->name)) {
    49834967                                                                /* Store local alias on server */
     
    50615045                        }
    50625046
    5063                         case 0x000e: { /* contact requires authorization */
     5047                        case 0x000e: { /* buddy requires authorization */
    50645048                                if ((retval->action == AIM_CB_SSI_ADD) && (retval->name))
    50655049                                        gaim_auth_sendrequest(gc, retval->name);
     
    51125096        gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg,
    51135097                                                0, data,
    5114                                                 G_CALLBACK(gaim_icq_contactadd),
     5098                                                G_CALLBACK(gaim_icq_buddyadd),
    51155099                                                G_CALLBACK(oscar_free_name_data));
    51165100
     
    51855169        if (reply) {
    51865170                /* Granted */
    5187                 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your contact list."), nombre);
     5171                dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your buddy list."), nombre);
    51885172                gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg);
    51895173        } else {
    51905174                /* Denied */
    5191                 dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your contact list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given."));
     5175                dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your buddy list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given."));
    51925176                gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg);
    51935177        }
     
    52115195        gaim_debug(GAIM_DEBUG_INFO, "oscar",
    52125196                           "ssi: %s added you to their buddy list\n", sn);
    5213         show_got_added(gc, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL);
     5197        gaim_account_notify_added(gc->account, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL);
    52145198
    52155199        return 1;
     
    52385222
    52395223static void oscar_join_chat(GaimConnection *g, GHashTable *data) {
    5240         struct oscar_data *od = (struct oscar_data *)g->proto_data;
     5224        OscarData *od = (OscarData *)g->proto_data;
    52415225        aim_conn_t *cur;
    52425226        char *name, *exchange;
     
    52645248
    52655249static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) {
    5266         struct oscar_data *od = (struct oscar_data *)g->proto_data;
     5250        OscarData *od = (OscarData *)g->proto_data;
    52675251        struct chat_connection *ccon = find_oscar_chat(g, id);
    52685252       
     
    52755259
    52765260static void oscar_chat_leave(GaimConnection *g, int id) {
    5277         struct oscar_data *od = g ? (struct oscar_data *)g->proto_data : NULL;
     5261        OscarData *od = g ? (OscarData *)g->proto_data : NULL;
    52785262        GSList *bcs = g->buddy_chats;
    52795263        GaimConversation *b = NULL;
     
    52845268                count++;
    52855269                b = (GaimConversation *)bcs->data;
    5286                 if (id == gaim_chat_get_id(GAIM_CHAT(b)))
     5270                if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b)))
    52875271                        break;
    52885272                bcs = bcs->next;
     
    52965280                           "Attempting to leave room %s (currently in %d rooms)\n", b->name, count);
    52975281       
    5298         c = find_oscar_chat(g, gaim_chat_get_id(GAIM_CHAT(b)));
     5282        c = find_oscar_chat(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b)));
    52995283        if (c != NULL) {
    53005284                if (od)
     
    53095293        }
    53105294        /* we do this because with Oscar it doesn't tell us we left */
    5311         serv_got_chat_left(g, gaim_chat_get_id(GAIM_CHAT(b)));
     5295        serv_got_chat_left(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b)));
    53125296}
    53135297
    53145298static int oscar_chat_send(GaimConnection *g, int id, const char *message) {
    5315         struct oscar_data *od = (struct oscar_data *)g->proto_data;
     5299        OscarData *od = (OscarData *)g->proto_data;
    53165300        GSList *bcs = g->buddy_chats;
    53175301        GaimConversation *b = NULL;
     
    53225306        while (bcs) {
    53235307                b = (GaimConversation *)bcs->data;
    5324                 if (id == gaim_chat_get_id(GAIM_CHAT(b)))
     5308                if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b)))
    53255309                        break;
    53265310                bcs = bcs->next;
     
    53575341                return -E2BIG;
    53585342
    5359         buf2 = strip_html(buf);
     5343        buf2 = gaim_markup_strip_html(buf);
    53605344        if (strlen(buf2) > c->maxvis) {
    53615345                g_free(buf2);
     
    53845368static void oscar_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne)
    53855369{
     5370        GaimAccount *account = NULL;
     5371        GaimConnection *gc = NULL;
     5372        OscarData *od = NULL;
    53865373        char *emblems[4] = {NULL,NULL,NULL,NULL};
    53875374        int i = 0;
     5375        aim_userinfo_t *userinfo = NULL;
     5376
     5377        if (b != NULL)
     5378                account = b->account;
     5379        if (account != NULL)
     5380                gc = account->gc;
     5381        if (gc != NULL)
     5382                od = gc->proto_data;
    53885383
    53895384        if (!GAIM_BUDDY_IS_ONLINE(b)) {
    5390                 GaimAccount *account;
    5391                 GaimConnection *gc;
    5392                 struct oscar_data *od;
    53935385                char *gname;
    5394                 if ((b->name) && (account = b->account) && (gc = account->gc) &&
    5395                         (od = gc->proto_data) && (od->sess->ssi.received_data) &&
     5386                if ((b->name) && (od) && (od->sess->ssi.received_data) &&
    53965387                        (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) &&
    53975388                        (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) {
     
    54325423/*      if (b->uc & UC_UNCONFIRMED && i < 4)
    54335424                emblems[i++] = "unconfirmed"; */
     5425
     5426        if ((i < 4) && (od != NULL)) {
     5427                userinfo = aim_locate_finduserinfo(od->sess, b->name);
     5428                if ((userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_SECUREIM))
     5429                        emblems[i++] = "secure";
     5430        }
     5431
    54345432        *se = emblems[0];
    54355433        *sw = emblems[1];
     
    54405438static char *oscar_tooltip_text(GaimBuddy *b) {
    54415439        GaimConnection *gc = b->account->gc;
    5442         struct oscar_data *od = gc->proto_data;
    5443         struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name));
    5444         gchar *tmp, *yay = g_strdup("");
     5440        OscarData *od = gc->proto_data;
     5441        struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name));
     5442        aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name);
     5443        gchar *tmp = NULL, *ret = g_strdup("");
    54455444
    54465445        if (GAIM_BUDDY_IS_ONLINE(b)) {
    54475446                if (isdigit(b->name[0])) {
    5448                         char *tmp, *status;
     5447                        char *status;
    54495448                        status = gaim_icq_status((b->uc & 0xffff0000) >> 16);
    5450                         tmp = yay;
    5451                         yay = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL);
     5449                        tmp = ret;
     5450                        ret = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL);
    54525451                        g_free(tmp);
    54535452                        g_free(status);
    54545453                }
    54555454
    5456                 if (bi) {
    5457                         char *tstr = sec_to_text(time(NULL) - bi->signon +
     5455                if (userinfo != NULL) {
     5456                        char *tstr = gaim_str_seconds_to_string(time(NULL) - userinfo->onlinesince +
    54585457                                (gc->login_time_official ? gc->login_time_official - gc->login_time : 0));
    5459                         tmp = yay;
    5460                         yay = g_strconcat(tmp, _("<b>Logged In:</b> "), tstr, "\n", NULL);
    5461                         free(tmp);
    5462                         free(tstr);
    5463 
    5464                         if (bi->ipaddr) {
    5465                                 char *tstr =  g_strdup_printf("%hhd.%hhd.%hhd.%hhd",
    5466                                                                 (bi->ipaddr & 0xff000000) >> 24,
    5467                                                                 (bi->ipaddr & 0x00ff0000) >> 16,
    5468                                                                 (bi->ipaddr & 0x0000ff00) >> 8,
    5469                                                                 (bi->ipaddr & 0x000000ff));
    5470                                 tmp = yay;
    5471                                 yay = g_strconcat(tmp, _("<b>IP Address:</b> "), tstr, "\n", NULL);
    5472                                 free(tmp);
    5473                                 free(tstr);
    5474                         }
    5475 
    5476                         if (bi->caps) {
    5477                                 char *caps = caps_string(bi->caps);
    5478                                 tmp = yay;
    5479                                 yay = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL);
    5480                                 free(tmp);
    5481                         }
    5482 
    5483                         if (bi->availmsg && !(b->uc & UC_UNAVAILABLE)) {
    5484                                 gchar *escaped = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg));
    5485                                 tmp = yay;
    5486                                 yay = g_strconcat(tmp, _("<b>Available:</b> "), escaped, "\n", NULL);
    5487                                 free(tmp);
    5488                                 g_free(escaped);
     5458                        tmp = ret;
     5459                        ret = g_strconcat(tmp, _("<b>Logged In:</b> "), tstr, "\n", NULL);
     5460                        g_free(tmp);
     5461                        g_free(tstr);
     5462                }
     5463
     5464                if ((bi != NULL) && (bi->ipaddr)) {
     5465                        char *tstr =  g_strdup_printf("%hhu.%hhu.%hhu.%hhu",
     5466                                                        (bi->ipaddr & 0xff000000) >> 24,
     5467                                                        (bi->ipaddr & 0x00ff0000) >> 16,
     5468                                                        (bi->ipaddr & 0x0000ff00) >> 8,
     5469                                                        (bi->ipaddr & 0x000000ff));
     5470                        tmp = ret;
     5471                        ret = g_strconcat(tmp, _("<b>IP Address:</b> "), tstr, "\n", NULL);
     5472                        g_free(tmp);
     5473                        g_free(tstr);
     5474                }
     5475
     5476                if ((userinfo != NULL) && (userinfo->capabilities)) {
     5477                        char *caps = caps_string(userinfo->capabilities);
     5478                        tmp = ret;
     5479                        ret = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL);
     5480                        g_free(tmp);
     5481                }
     5482
     5483                if ((bi != NULL) && (bi->availmsg != NULL) && !(b->uc & UC_UNAVAILABLE)) {
     5484                        gchar *escaped = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg));
     5485                        tmp = ret;
     5486                        ret = g_strconcat(tmp, _("<b>Available:</b> "), escaped, "\n", NULL);
     5487                        g_free(tmp);
     5488                        g_free(escaped);
     5489                }
     5490
     5491                if ((userinfo != NULL) && (userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) {
     5492                        gchar *away_utf8 = oscar_encoding_to_utf8(userinfo->away_encoding, userinfo->away, userinfo->away_len);
     5493                        if (away_utf8 != NULL) {
     5494                                gchar *tmp1, *tmp2;
     5495                                const char *tmp3;
     5496                                tmp1 = gaim_strreplace(away_utf8, "<BR>", "\n");
     5497                                tmp2 = gaim_markup_strip_html(tmp1);
     5498                                g_free(tmp1);
     5499                                tmp1 = g_markup_escape_text(tmp2, strlen(tmp2));
     5500                                g_free(tmp2);
     5501                                tmp3 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc)));
     5502                                g_free(tmp1);
     5503                                tmp = ret;
     5504                                ret = g_strconcat(tmp, _("<b>Away Message:</b> "), tmp3, "\n", NULL);
     5505                                g_free(tmp);
     5506                                g_free(away_utf8);
    54895507                        }
    54905508                }
     
    54925510                char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name);
    54935511                if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) {
    5494                         tmp = yay;
    5495                         yay = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL);
     5512                        tmp = ret;
     5513                        ret = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL);
    54965514                        g_free(tmp);
    54975515                } else {
    5498                         tmp = yay;
    5499                         yay = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL);
     5516                        tmp = ret;
     5517                        ret = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL);
    55005518                        g_free(tmp);
    55015519                }
     
    55035521
    55045522        /* remove the trailing newline character */
    5505         if (yay)
    5506                 yay[strlen(yay)-1] = '\0';
    5507         return yay;
     5523        if (ret)
     5524                ret[strlen(ret)-1] = '\0';
     5525        return ret;
    55085526}
    55095527
    55105528static char *oscar_status_text(GaimBuddy *b) {
    55115529        GaimConnection *gc = b->account->gc;
    5512         struct oscar_data *od = gc->proto_data;
     5530        OscarData *od = gc->proto_data;
    55135531        gchar *ret = NULL;
    55145532
     
    55195537                        ret = g_strdup(_("Away"));
    55205538        } else if (GAIM_BUDDY_IS_ONLINE(b)) {
    5521                 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name));
     5539                struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name));
    55225540                if (bi->availmsg)
    55235541                        ret = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg));
     
    55365554static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) {
    55375555        GaimConnection *gc = sess->aux_data;
    5538         struct oscar_data *od = gc->proto_data;
     5556        OscarData *od = gc->proto_data;
    55395557        va_list ap;
    55405558        fu16_t type;
    55415559        fu8_t flags = 0, length = 0;
    55425560        char *md5 = NULL;
     5561
    55435562
    55445563        va_start(ap, fr);
     
    55985617static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) {
    55995618        GaimConnection *gc = sess->aux_data;
    5600         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     5619        OscarData *od = (OscarData *)gc->proto_data;
    56015620        GaimConversation *cnv;
    56025621        struct direct_im *dim;
     
    56465665        double percent;
    56475666        GaimConnection *gc = sess->aux_data;
    5648         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     5667        OscarData *od = (OscarData *)gc->proto_data;
    56495668        GaimConversation *c;
    56505669        struct direct_im *dim;
     
    56625681        }
    56635682        /* XXX is this really necessary? */
    5664         while (gtk_events_pending())
    5665                 gtk_main_iteration();
     5683        gaim_core_mainloop_finish_events();
    56665684
    56675685        c = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc));
     
    57055723static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) {
    57065724        GaimConnection *gc = sess->aux_data;
    5707         GaimImFlags imflags = 0;
     5725        GaimConvImFlags imflags = 0;
    57085726        GString *newmsg = g_string_new("");
    57095727        GSList *images = NULL;
     
    57265744
    57275745        if (isawaymsg)
    5728                 imflags |= GAIM_IM_AUTO_RESP;
     5746                imflags |= GAIM_CONV_IM_AUTO_RESP;
    57295747
    57305748        /* message has a binary trailer */
     
    57905808                /* set the flag if we caught any images */
    57915809                if (images)
    5792                         imflags |= GAIM_IM_IMAGES;
     5810                        imflags |= GAIM_CONV_IM_IMAGES;
    57935811        } else {
    57945812                g_string_append_len(newmsg, msg, len);
     
    58405858}
    58415859
    5842 static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, GaimImFlags imflags) {
     5860static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, GaimConvImFlags imflags) {
    58435861        char *buf;
    58445862        size_t len;
    58455863        int ret;
    58465864
    5847         if (imflags & GAIM_IM_IMAGES) {
     5865        if (imflags & GAIM_CONV_IM_IMAGES) {
    58485866                GString *msg = g_string_new("");
    58495867                GString *data = g_string_new("<BINARY>");
     
    58725890                                        g_string_append_printf(msg,
    58735891                                                "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">",
    5874                                                 image->filename, oscar_id, image->size);
     5892                                                image->filename, oscar_id, (int)image->size);
    58755893                                else
    58765894                                        g_string_append_printf(msg,
    58775895                                                "<IMG ID=\"%d\" DATASIZE=\"%d\">",
    5878                                                 oscar_id, image->size);
     5896                                                oscar_id, (int)image->size);
    58795897
    58805898                                /* ... and append the data to the binary section ... */
    58815899                                g_string_append_printf(data, "<DATA ID=\"%d\" SIZE=\"%d\">",
    5882                                         oscar_id, image->size);
     5900                                        oscar_id, (int)image->size);
    58835901                                data = g_string_append_len(data, image->data, image->size);
    58845902                                data = g_string_append(data, "</DATA>");
     
    59155933
    59165934        /* XXX - The last parameter below is the encoding.  Let Paco-Paco do something with it. */
    5917         if (imflags & GAIM_IM_AUTO_RESP)
     5935        if (imflags & GAIM_CONV_IM_AUTO_RESP)
    59185936                ret =  aim_odc_send_im(sess, conn, buf, len, 0, 1);
    59195937        else
     
    59375955static void oscar_direct_im(struct ask_do_dir_im *data) {
    59385956        GaimConnection *gc = data->gc;
    5939         struct oscar_data *od;
     5957        OscarData *od;
    59405958        struct direct_im *dim;
    59415959
     
    59465964        }
    59475965
    5948         od = (struct oscar_data *)gc->proto_data;
     5966        od = (OscarData *)gc->proto_data;
    59495967
    59505968        dim = find_direct_im(od, data->who);
     
    60026020static void oscar_set_permit_deny(GaimConnection *gc) {
    60036021        GaimAccount *account = gaim_connection_get_account(gc);
    6004         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     6022        OscarData *od = (OscarData *)gc->proto_data;
    60056023#ifdef NOSSI
    60066024        GSList *list, *g = gaim_blist_groups(), *g1;
     
    60666084                oscar_set_permit_deny(gc);
    60676085#else
    6068         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     6086        OscarData *od = (OscarData *)gc->proto_data;
    60696087        gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a permit\n");
    60706088        if (od->sess->ssi.received_data)
     
    60786096                oscar_set_permit_deny(gc);
    60796097#else
    6080         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     6098        OscarData *od = (OscarData *)gc->proto_data;
    60816099        gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a deny\n");
    60826100        if (od->sess->ssi.received_data)
     
    60906108                oscar_set_permit_deny(gc);
    60916109#else
    6092         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     6110        OscarData *od = (OscarData *)gc->proto_data;
    60936111        gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a permit\n");
    60946112        if (od->sess->ssi.received_data)
     
    61026120                oscar_set_permit_deny(gc);
    61036121#else
    6104         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     6122        OscarData *od = (OscarData *)gc->proto_data;
    61056123        gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a deny\n");
    61066124        if (od->sess->ssi.received_data)
     
    61116129static GList *oscar_away_states(GaimConnection *gc)
    61126130{
    6113         struct oscar_data *od = gc->proto_data;
     6131        OscarData *od = gc->proto_data;
    61146132        GList *m = NULL;
    61156133
     
    61286146}
    61296147
     6148static void oscar_ssi_editcomment(struct name_data *data, const char *text) {
     6149        OscarData *od = data->gc->proto_data;
     6150        GaimBuddy *b;
     6151        GaimGroup *g;
     6152
     6153        if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) {
     6154                oscar_free_name_data(data);
     6155                return;
     6156        }
     6157
     6158        if (!(g = gaim_find_buddys_group(b))) {
     6159                oscar_free_name_data(data);
     6160                return;
     6161        }
     6162
     6163        aim_ssi_editcomment(od->sess, g->name, data->name, text);
     6164        oscar_free_name_data(data);
     6165}
     6166
     6167static void oscar_buddycb_edit_comment(GaimConnection *gc, const char *name) {
     6168        OscarData *od = gc->proto_data;
     6169        struct name_data *data = g_new(struct name_data, 1);
     6170        GaimBuddy *b;
     6171        GaimGroup *g;
     6172        char *comment;
     6173        gchar *comment_utf8;
     6174
     6175        if (!(b = gaim_find_buddy(gaim_connection_get_account(gc), name)))
     6176                return;
     6177        if (!(g = gaim_find_buddys_group(b)))
     6178                return;
     6179        comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, name);
     6180        comment_utf8 = comment ? gaim_utf8_try_convert(comment) : NULL;
     6181
     6182        data->gc = gc;
     6183        data->name = g_strdup(name);
     6184        data->nick = NULL;
     6185
     6186        gaim_request_input(gc, NULL, _("Buddy Comment:"), NULL,
     6187                                           comment_utf8, TRUE, FALSE,
     6188                                           _("OK"), G_CALLBACK(oscar_ssi_editcomment),
     6189                                           _("Cancel"), G_CALLBACK(oscar_free_name_data),
     6190                                           data);
     6191
     6192        free(comment);
     6193        g_free(comment_utf8);
     6194}
     6195
    61306196static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) {
    6131         struct oscar_data *od = gc->proto_data;
     6197        OscarData *od = gc->proto_data;
    61326198        GList *m = NULL;
    61336199        struct proto_buddy_menu *pbm;
     6200
     6201        pbm = g_new0(struct proto_buddy_menu, 1);
     6202        pbm->label = _("Edit Buddy Comment");
     6203        pbm->callback = oscar_buddycb_edit_comment;
     6204        pbm->gc = gc;
     6205        m = g_list_append(m, pbm);
    61346206
    61356207        if (od->icq) {
     
    61436215        } else {
    61446216                GaimBuddy *b = gaim_find_buddy(gc->account, who);
    6145                 struct buddyinfo *bi;
     6217                aim_userinfo_t *userinfo;
    61466218
    61476219                if (b)
    6148                         bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name));
    6149 
    6150                 if (b && bi && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) {
    6151                         if (bi->caps & AIM_CAPS_DIRECTIM) {
     6220                        userinfo = aim_locate_finduserinfo(od->sess, b->name);
     6221
     6222                if (b && userinfo && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) {
     6223                        if (userinfo->capabilities & AIM_CAPS_DIRECTIM) {
    61526224                                pbm = g_new0(struct proto_buddy_menu, 1);
    61536225                                pbm->label = _("Direct IM");
     
    61576229                        }
    61586230
    6159                         if (bi->caps & AIM_CAPS_SENDFILE) {
     6231                        if (userinfo->capabilities & AIM_CAPS_SENDFILE) {
    61606232                                pbm = g_new0(struct proto_buddy_menu, 1);
    61616233                                pbm->label = _("Send File");
     
    61656237                        }
    61666238#if 0
    6167                         if (bi->caps & AIM_CAPS_GETFILE) {
     6239                        if (userinfo->capabilities & AIM_CAPS_GETFILE) {
    61686240                                pbm = g_new0(struct proto_buddy_menu, 1);
    61696241                                pbm->label = _("Get File");
     
    61916263
    61926264static void oscar_format_screenname(GaimConnection *gc, const char *nick) {
    6193         struct oscar_data *od = gc->proto_data;
     6265        OscarData *od = gc->proto_data;
    61946266        if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) {
    61956267                if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) {
     
    62176289static void oscar_confirm_account(GaimConnection *gc)
    62186290{
    6219         struct oscar_data *od = gc->proto_data;
     6291        OscarData *od = gc->proto_data;
    62206292        aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH);
    62216293
     
    62306302static void oscar_show_email(GaimConnection *gc)
    62316303{
    6232         struct oscar_data *od = gc->proto_data;
     6304        OscarData *od = gc->proto_data;
    62336305        aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH);
    62346306
     
    62436315static void oscar_change_email(GaimConnection *gc, const char *email)
    62446316{
    6245         struct oscar_data *od = gc->proto_data;
     6317        OscarData *od = gc->proto_data;
    62466318        aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH);
    62476319
     
    62666338static void oscar_show_awaitingauth(GaimConnection *gc)
    62676339{
    6268         struct oscar_data *od = gc->proto_data;
     6340        OscarData *od = gc->proto_data;
    62696341        gchar *nombre, *text, *tmp;
    62706342        GaimBlistNode *gnode, *cnode, *bnode;
     
    63126384}
    63136385
     6386static void search_by_email_cb(GaimConnection *gc, const char *email)
     6387{
     6388        serv_dir_search(gc, "", "", "", "", "", "", "", email);
     6389}
     6390
     6391static void oscar_show_find_email(GaimConnection *gc)
     6392{
     6393        gaim_request_input(gc, _("Find Buddy by E-mail"),
     6394                                           _("Search for a buddy by e-mail address"),
     6395                                           _("Type the e-mail address of the buddy you are "
     6396                                                 "searching for."),
     6397                                           NULL, FALSE, FALSE,
     6398                                           _("Search"), G_CALLBACK(search_by_email_cb),
     6399                                           _("Cancel"), NULL, gc);
     6400}
     6401
    63146402#if 0
    63156403static void oscar_setavailmsg(GaimConnection *gc, char *text) {
    6316         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
    6317 
     6404        OscarData *od = (OscarData *)gc->proto_data;
     6405
     6406        aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0);
    63186407        aim_srv_setavailmsg(od->sess, text);
    63196408}
     
    63216410static void oscar_show_setavailmsg(GaimConnection *gc)
    63226411{
    6323         gaim_request_input(gc, NULL, _("Available Message:"),
    6324                                            NULL, _("Please talk to me, I'm lonely! (and single)"), TRUE, FALSE,
     6412        gaim_request_input(gc, NULL, _("Available Message:"), NULL,
     6413                                           _("I'm doing work and hoping for a distraction--IM me!"),
     6414                                           TRUE, FALSE,
    63256415                                           _("OK"), G_CALLBACK(oscar_setavailmsg),
    63266416                                           _("Cancel"), NULL,
     
    63296419#endif
    63306420
     6421static void oscar_show_set_info(GaimConnection *gc)
     6422{
     6423        gaim_account_request_change_user_info(gaim_connection_get_account(gc));
     6424}
     6425
     6426static void oscar_change_pass(GaimConnection *gc)
     6427{
     6428        gaim_account_request_change_password(gaim_connection_get_account(gc));
     6429}
     6430
    63316431static void oscar_show_chpassurl(GaimConnection *gc)
    63326432{
    6333         struct oscar_data *od = gc->proto_data;
     6433        OscarData *od = gc->proto_data;
    63346434        gchar *substituted = gaim_strreplace(od->sess->authinfo->chpassurl, "%s", gaim_account_get_username(gaim_connection_get_account(gc)));
    63356435        gaim_notify_uri(gc, substituted);
     
    63376437}
    63386438
     6439static void oscar_show_imforwardingurl(GaimConnection *gc)
     6440{
     6441        gaim_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1");
     6442}
     6443
    63396444static void oscar_set_icon(GaimConnection *gc, const char *iconfile)
    63406445{
    6341         struct oscar_data *od = gc->proto_data;
     6446        OscarData *od = gc->proto_data;
    63426447        aim_session_t *sess = od->sess;
    63436448        FILE *file;
     
    63726477static GList *oscar_actions(GaimConnection *gc)
    63736478{
    6374         struct oscar_data *od = gc->proto_data;
     6479        OscarData *od = gc->proto_data;
    63756480        struct proto_actions_menu *pam;
    63766481        GList *m = NULL;
     
    63786483        pam = g_new0(struct proto_actions_menu, 1);
    63796484        pam->label = _("Set User Info");
    6380         pam->callback = show_set_info;
     6485        pam->callback = oscar_show_set_info;
    63816486        pam->gc = gc;
    63826487        m = g_list_append(m, pam);
     
    63926497        pam = g_new0(struct proto_actions_menu, 1);
    63936498        pam->label = _("Change Password");
    6394         pam->callback = show_change_passwd;
     6499        pam->callback = oscar_change_pass;
    63956500        pam->gc = gc;
    63966501        m = g_list_append(m, pam);
     
    64046509        }
    64056510
     6511        if (od->sess->authinfo->chpassurl) {
     6512                pam = g_new0(struct proto_actions_menu, 1);
     6513                pam->label = _("Configure IM Forwarding (URL)");
     6514                pam->callback = oscar_show_imforwardingurl;
     6515                pam->gc = gc;
     6516                m = g_list_append(m, pam);
     6517        }
     6518
    64066519        if (!od->icq) {
    64076520                /* AIM actions */
     
    64456558        pam = g_new0(struct proto_actions_menu, 1);
    64466559        pam->label = _("Search for Buddy by Email");
    6447         pam->callback = show_find_email;
     6560        pam->callback = oscar_show_find_email;
    64486561        pam->gc = gc;
    64496562        m = g_list_append(m, pam);
     
    64606573static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new)
    64616574{
    6462         struct oscar_data *od = gc->proto_data;
     6575        OscarData *od = gc->proto_data;
    64636576
    64646577        if (od->icq) {
     
    64796592static void oscar_convo_closed(GaimConnection *gc, const char *who)
    64806593{
    6481         struct oscar_data *od = gc->proto_data;
     6594        OscarData *od = gc->proto_data;
    64826595        struct direct_im *dim = find_direct_im(od, who);
    64836596
Note: See TracChangeset for help on using the changeset viewer.