Changeset 85d7b85 for protocols/oscar


Ignore:
Timestamp:
2008-04-02T14:22:57Z (16 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
f9dbc99
Parents:
875ad42 (diff), dd34575 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge trunk.

Location:
protocols/oscar
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/Makefile

    r875ad42 r85d7b85  
    1717# [SH] Phony targets
    1818all: oscar_mod.o
     19check: all
     20lcov: check
     21gcov:
     22        gcov *.c
    1923
    2024.PHONY: all clean distclean
  • protocols/oscar/aim.h

    r875ad42 r85d7b85  
    9494 *
    9595 */
    96 #define AIM_DEFAULT_LOGIN_SERVER "login.oscar.aol.com"
     96#define AIM_DEFAULT_LOGIN_SERVER "login.messaging.aol.com"
    9797#define AIM_LOGIN_PORT 5190
    9898
     
    574574
    575575struct aim_chat_invitation {
    576         struct gaim_connection * gc;
     576        struct im_connection * ic;
    577577        char * name;
    578578        guint8 exchange;
  • protocols/oscar/chat.c

    r875ad42 r85d7b85  
    5454                        continue;
    5555                if (!cur->priv) {
    56                         do_error_dialog(sess->aux_data, "chat connection with no name!", "Gaim");
     56                        imcb_error(sess->aux_data, "chat connection with no name!");
    5757                        continue;
    5858                }
     
    397397
    398398        if (detaillevel != 0x02) {
    399                 do_error_dialog(sess->aux_data, "Only detaillevel 0x2 is support at the moment", "Gaim");
     399                imcb_error(sess->aux_data, "Only detaillevel 0x2 is support at the moment");
    400400                return 1;
    401401        }
     
    615615
    616616        if (channel != 0x0003) {
    617                 do_error_dialog(sess->aux_data, "unknown channel!", "Gaim");
     617                imcb_error(sess->aux_data, "unknown channel!");
    618618                return 0;
    619619        }
  • protocols/oscar/chatnav.c

    r875ad42 r85d7b85  
    286286
    287287        if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) {
    288                 do_error_dialog(sess->aux_data, "no bigblock in top tlv in create room response", "Gaim");
     288                imcb_error(sess->aux_data, "no bigblock in top tlv in create room response");
    289289       
    290290                aim_freetlvchain(&tlvlist);
     
    301301
    302302        if (detaillevel != 0x02) {
    303                 do_error_dialog(sess->aux_data, "unknown detaillevel in create room response", "Gaim");
     303                imcb_error(sess->aux_data, "unknown detaillevel in create room response");
    304304                aim_freetlvchain(&tlvlist);
    305305                g_free(ck);
     
    367367
    368368        if (!(snac2 = aim_remsnac(sess, snac->id))) {
    369                 do_error_dialog(sess->aux_data, "received response to unknown request!", "Gaim");
     369                imcb_error(sess->aux_data, "received response to unknown request!");
    370370                return 0;
    371371        }
    372372
    373373        if (snac2->family != 0x000d) {
    374                 do_error_dialog(sess->aux_data, "recieved response that maps to corrupt request!", "Gaim");
     374                imcb_error(sess->aux_data, "recieved response that maps to corrupt request!");
    375375                return 0;
    376376        }
     
    389389                ret = parseinfo_create(sess, mod, rx, snac, bs, snac2);
    390390        else
    391                 do_error_dialog(sess->aux_data, "unknown request subtype", "Gaim");
     391                imcb_error(sess->aux_data, "unknown request subtype");
    392392
    393393        if (snac2)
  • protocols/oscar/icq.c

    r875ad42 r85d7b85  
    240240        if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) {
    241241                aim_freetlvchain(&tl);
    242                 do_error_dialog(sess->aux_data, "corrupt ICQ response\n", "Gaim");
     242                imcb_error(sess->aux_data, "corrupt ICQ response\n");
    243243                return 0;
    244244        }
  • protocols/oscar/im.c

    r875ad42 r85d7b85  
    937937
    938938        if (channel != 0x01) {
    939                 do_error_dialog(sess->aux_data, "icbm: ICBM recieved on unsupported channel.  Ignoring.", "Gaim");
     939                imcb_error(sess->aux_data, "icbm: ICBM recieved on unsupported channel.  Ignoring.");
    940940                return 0;
    941941        }
     
    13451345
    13461346                } else {
    1347                         // do_error_dialog(sess->aux_data, "Unknown TLV encountered", "Gaim");
     1347                        // imcb_error(sess->aux_data, "Unknown TLV encountered");
    13481348                }
    13491349
     
    14171417    guint8 *plugin;
    14181418    int i = 0, tmp = 0;
    1419     struct gaim_connection *gc = sess->aux_data;
     1419    struct im_connection *ic = sess->aux_data;
    14201420
    14211421    /* at the moment we just can deal with requests, not with cancel or accept */
     
    14691469            case 0x9c:  /* ICQ 5 seems to send this */
    14701470                aim_send_im_ch2_statusmessage(sess, userinfo->sn, args->cookie,
    1471                         gc->away ? gc->away : "", sess->aim_icq_state, dc);
     1471                        ic->away ? ic->away : "", sess->aim_icq_state, dc);
    14721472                break;
    14731473
     
    15171517        cookie2 = aimbs_getraw(&bbs, 8);
    15181518        if (memcmp(cookie, cookie2, 8) != 0)
    1519                 do_error_dialog(sess->aux_data, "rend: warning cookies don't match!", "Gaim");
     1519                imcb_error(sess->aux_data, "rend: warning cookies don't match!");
    15201520        memcpy(args.cookie, cookie2, 8);
    15211521        g_free(cookie2);
     
    17831783        } else {
    17841784
    1785                 do_error_dialog(sess->aux_data, "ICBM received on an unsupported channel.  Ignoring.", "Gaim");
     1785                imcb_error(sess->aux_data, "ICBM received on an unsupported channel.  Ignoring.");
    17861786
    17871787                return 0;
  • protocols/oscar/info.c

    r875ad42 r85d7b85  
    261261                if (!identified) {
    262262                        /*FIXME*/
     263                        /*REMOVEME :-)
    263264                        g_strdup_printf("unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
    264265                                        cap[0], cap[1], cap[2], cap[3],
     
    268269                                        cap[10], cap[11], cap[12], cap[13],
    269270                                        cap[14], cap[15]);
    270                        
     271                        */
    271272                }
    272273
     
    473474                         */
    474475#ifdef DEBUG
    475                         // do_error_dialog(sess->aux_data, G_STRLOC, "Unknown TLV encountered");
     476                        // imcb_error(sess->aux_data, G_STRLOC);
    476477#endif
    477478
     
    634635
    635636        if (!origsnac || !origsnac->data) {
    636                 do_error_dialog(sess->aux_data, "major problem: no snac stored!", "Gaim");
     637                imcb_error(sess->aux_data, "major problem: no snac stored!");
    637638                return 0;
    638639        }
     
    643644                        (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) &&
    644645                        (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) {
    645                 do_error_dialog(sess->aux_data, "unknown infotype in request!", "Gaim");
     646                imcb_error(sess->aux_data, "unknown infotype in request!");
    646647                return 0;
    647648        }
  • protocols/oscar/msgcookie.c

    r875ad42 r85d7b85  
    131131}
    132132
    133 #if 0 /* debugging feature */
    134 int aim_dumpcookie(aim_msgcookie_t *cookie)
    135 {
    136 
    137         if (!cookie)
    138                 return -EINVAL;
    139 
    140         printf("\tCookie at %p: %d/%s with %p, next %p\n",
    141                         cookie, cookie->type, cookie->cookie,
    142                         cookie->data, cookie->next);
    143 
    144         return 0;
    145 }
    146 #endif
    147 
    148133/**
    149134 * aim_cookie_free - free an aim_msgcookie_t struct
  • protocols/oscar/oscar.c

    r875ad42 r85d7b85  
    9191        gboolean icq;
    9292        GSList *evilhack;
     93       
     94        GHashTable *ips;
    9395
    9496        struct {
     
    116118        int inpa;
    117119        int id;
    118         struct gaim_connection *gc; /* i hate this. */
    119         struct conversation *cnv; /* bah. */
     120        struct im_connection *ic; /* i hate this. */
     121        struct groupchat *cnv; /* bah. */
    120122        int maxlen;
    121123        int maxvis;
     
    123125
    124126struct ask_direct {
    125         struct gaim_connection *gc;
     127        struct im_connection *ic;
    126128        char *sn;
    127129        char ip[64];
     
    130132
    131133struct icq_auth {
    132         struct gaim_connection *gc;
     134        struct im_connection *ic;
    133135        guint32 uin;
    134136};
     
    158160}
    159161
    160 static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) {
    161         GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
    162         struct chat_connection *c = NULL;
    163 
    164         while (g) {
    165                 c = (struct chat_connection *)g->data;
    166                 if (c->id == id)
    167                         break;
    168                 g = g->next;
    169                 c = NULL;
    170         }
    171 
    172         return c;
    173 }
    174 
    175 
    176 static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc,
     162static struct chat_connection *find_oscar_chat_by_conn(struct im_connection *ic,
    177163                                                        aim_conn_t *conn) {
    178         GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
     164        GSList *g = ((struct oscar_data *)ic->proto_data)->oscar_chats;
    179165        struct chat_connection *c = NULL;
    180166
     
    255241static int msgerrreasonlen = 25;
    256242
    257 static void oscar_callback(gpointer data, gint source,
    258                                 GaimInputCondition condition) {
     243static gboolean oscar_callback(gpointer data, gint source,
     244                                b_input_condition condition) {
    259245        aim_conn_t *conn = (aim_conn_t *)data;
    260246        aim_session_t *sess = aim_conn_getsess(conn);
    261         struct gaim_connection *gc = sess ? sess->aux_data : NULL;
     247        struct im_connection *ic = sess ? sess->aux_data : NULL;
    262248        struct oscar_data *odata;
    263249
    264         if (!gc) {
    265                 /* gc is null. we return, else we seg SIGSEG on next line. */
    266                 return;
     250        if (!ic) {
     251                /* ic is null. we return, else we seg SIGSEG on next line. */
     252                return FALSE;
    267253        }
    268254     
    269         if (!g_slist_find(get_connections(), gc)) {
     255        if (!g_slist_find(get_connections(), ic)) {
    270256                /* oh boy. this is probably bad. i guess the only thing we
    271257                 * can really do is return? */
    272                 return;
    273         }
    274 
    275         odata = (struct oscar_data *)gc->proto_data;
     258                return FALSE;
     259        }
     260
     261        odata = (struct oscar_data *)ic->proto_data;
    276262
    277263        if (condition & GAIM_INPUT_READ) {
     
    279265                        aim_rxdispatch(odata->sess);
    280266                               if (odata->killme)
    281                                        signoff(gc);
     267                                       imc_logout(ic, TRUE);
    282268                } else {
    283269                        if ((conn->type == AIM_CONN_TYPE_BOS) ||
    284270                                   !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
    285                                 hide_login_progress_error(gc, _("Disconnected."));
    286                                 signoff(gc);
     271                                imcb_error(ic, _("Disconnected."));
     272                                imc_logout(ic, TRUE);
    287273                        } else if (conn->type == AIM_CONN_TYPE_CHAT) {
    288                                 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
    289                                 char buf[BUF_LONG];
     274                                struct chat_connection *c = find_oscar_chat_by_conn(ic, conn);
    290275                                c->conn = NULL;
    291276                                if (c->inpa > 0)
    292                                         gaim_input_remove(c->inpa);
     277                                        b_event_remove(c->inpa);
    293278                                c->inpa = 0;
    294279                                c->fd = -1;
    295280                                aim_conn_kill(odata->sess, &conn);
    296                                 sprintf(buf, _("You have been disconnected from chat room %s."), c->name);
    297                                 do_error_dialog(sess->aux_data, buf, _("Chat Error!"));
     281                                imcb_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name);
    298282                        } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
    299283                                if (odata->cnpa > 0)
    300                                         gaim_input_remove(odata->cnpa);
     284                                        b_event_remove(odata->cnpa);
    301285                                odata->cnpa = 0;
    302286                                while (odata->create_rooms) {
     
    306290                                                g_slist_remove(odata->create_rooms, cr);
    307291                                        g_free(cr);
    308                                         do_error_dialog(sess->aux_data, _("Chat is currently unavailable"),
    309                                                         _("Gaim - Chat"));
     292                                        imcb_error(sess->aux_data, _("Chat is currently unavailable"));
    310293                                }
    311294                                aim_conn_kill(odata->sess, &conn);
    312295                        } else if (conn->type == AIM_CONN_TYPE_AUTH) {
    313296                                if (odata->paspa > 0)
    314                                         gaim_input_remove(odata->paspa);
     297                                        b_event_remove(odata->paspa);
    315298                                odata->paspa = 0;
    316299                                aim_conn_kill(odata->sess, &conn);
     
    319302                        }
    320303                }
    321         }
    322 }
    323 
    324 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond)
     304        } else {
     305                /* WTF??? */
     306                return FALSE;
     307        }
     308               
     309        return TRUE;
     310}
     311
     312static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond)
    325313{
    326         struct gaim_connection *gc = data;
     314        struct im_connection *ic = data;
    327315        struct oscar_data *odata;
    328316        aim_session_t *sess;
    329317        aim_conn_t *conn;
    330318
    331         if (!g_slist_find(get_connections(), gc)) {
     319        if (!g_slist_find(get_connections(), ic)) {
    332320                closesocket(source);
    333                 return;
    334         }
    335 
    336         odata = gc->proto_data;
     321                return FALSE;
     322        }
     323
     324        odata = ic->proto_data;
    337325        sess = odata->sess;
    338326        conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
    339327
    340328        if (source < 0) {
    341                 hide_login_progress(gc, _("Couldn't connect to host"));
    342                 signoff(gc);
    343                 return;
     329                imcb_error(ic, _("Couldn't connect to host"));
     330                imc_logout(ic, TRUE);
     331                return FALSE;
    344332        }
    345333
    346334        aim_conn_completeconnect(sess, conn);
    347         gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ,
     335        ic->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
    348336                        oscar_callback, conn);
    349 }
    350 
    351 static void oscar_login(struct aim_user *user) {
     337       
     338        return FALSE;
     339}
     340
     341static void oscar_init(account_t *acc)
     342{
     343        set_t *s;
     344       
     345        s = set_add( &acc->set, "server", AIM_DEFAULT_LOGIN_SERVER, set_eval_account, acc );
     346        s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
     347       
     348        if (isdigit(acc->user[0])) {
     349                s = set_add( &acc->set, "web_aware", "false", set_eval_bool, acc );
     350                s->flags |= ACC_SET_OFFLINE_ONLY;
     351        }
     352}
     353
     354static void oscar_login(account_t *acc) {
    352355        aim_session_t *sess;
    353356        aim_conn_t *conn;
    354         char buf[256];
    355         struct gaim_connection *gc = new_gaim_conn(user);
    356         struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
    357 
    358         if (isdigit(*user->username)) {
     357        struct im_connection *ic = imcb_new(acc);
     358        struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1);
     359
     360        if (isdigit(acc->user[0]))
    359361                odata->icq = TRUE;
    360                 /* This is odd but it's necessary for a proper do_import and do_export.
    361                    We don't do those anymore, but let's stick with it, just in case
    362                    it accidentally fixes something else too... */
    363                 gc->password[8] = 0;
    364         } else {
    365                 gc->flags |= OPT_CONN_HTML;
    366         }
     362        else
     363                ic->flags |= OPT_DOES_HTML;
    367364
    368365        sess = g_new0(aim_session_t, 1);
     
    374371        aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL);
    375372        odata->sess = sess;
    376         sess->aux_data = gc;
     373        sess->aux_data = ic;
    377374
    378375        conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
    379376        if (conn == NULL) {
    380                 hide_login_progress(gc, _("Unable to login to AIM"));
    381                 signoff(gc);
     377                imcb_error(ic, _("Unable to login to AIM"));
     378                imc_logout(ic, TRUE);
    382379                return;
    383380        }
    384381       
    385         if (g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.icq.com") != 0 &&
    386             g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.oscar.aol.com") != 0) {
    387                 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",user->proto_opt[USEROPT_AUTH]);
    388         }
    389        
    390         g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username);
    391         set_login_progress(gc, 2, buf);
     382        imcb_log(ic, _("Signon: %s"), ic->acc->user);
    392383
    393384        aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
     
    395386
    396387        conn->status |= AIM_CONN_STATUS_INPROGRESS;
    397         conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ?
    398                                         user->proto_opt[USEROPT_AUTH] : AIM_DEFAULT_LOGIN_SERVER,
    399                                  user->proto_opt[USEROPT_AUTHPORT][0] ?
    400                                         atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
    401                                  oscar_login_connect, gc);
     388        conn->fd = proxy_connect(set_getstr(&acc->set, "server"),
     389                                 AIM_LOGIN_PORT, oscar_login_connect, ic);
    402390        if (conn->fd < 0) {
    403                 hide_login_progress(gc, _("Couldn't connect to host"));
    404                 signoff(gc);
     391                imcb_error(ic, _("Couldn't connect to host"));
     392                imc_logout(ic, TRUE);
    405393                return;
    406394        }
    407         aim_request_login(sess, conn, gc->username);
    408 }
    409 
    410 static void oscar_close(struct gaim_connection *gc) {
    411         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     395        aim_request_login(sess, conn, ic->acc->user);
     396}
     397
     398static void oscar_logout(struct im_connection *ic) {
     399        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    412400       
    413401        while (odata->oscar_chats) {
    414402                struct chat_connection *n = odata->oscar_chats->data;
    415403                if (n->inpa > 0)
    416                         gaim_input_remove(n->inpa);
     404                        b_event_remove(n->inpa);
    417405                g_free(n->name);
    418406                g_free(n->show);
     
    426414                g_free(cr);
    427415        }
     416        if (odata->ips)
     417                g_hash_table_destroy(odata->ips);
    428418        if (odata->email)
    429419                g_free(odata->email);
     
    432422        if (odata->oldp)
    433423                g_free(odata->oldp);
    434         if (gc->inpa > 0)
    435                 gaim_input_remove(gc->inpa);
     424        if (ic->inpa > 0)
     425                b_event_remove(ic->inpa);
    436426        if (odata->cnpa > 0)
    437                 gaim_input_remove(odata->cnpa);
     427                b_event_remove(odata->cnpa);
    438428        if (odata->paspa > 0)
    439                 gaim_input_remove(odata->paspa);
     429                b_event_remove(odata->paspa);
    440430        aim_session_kill(odata->sess);
    441431        g_free(odata->sess);
    442432        odata->sess = NULL;
    443         g_free(gc->proto_data);
    444         gc->proto_data = NULL;
    445 }
    446 
    447 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
    448         struct gaim_connection *gc = data;
     433        g_free(ic->proto_data);
     434        ic->proto_data = NULL;
     435}
     436
     437static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {
     438        struct im_connection *ic = data;
    449439        struct oscar_data *odata;
    450440        aim_session_t *sess;
    451441        aim_conn_t *bosconn;
    452442
    453         if (!g_slist_find(get_connections(), gc)) {
     443        if (!g_slist_find(get_connections(), ic)) {
    454444                closesocket(source);
    455                 return;
    456         }
    457 
    458         odata = gc->proto_data;
     445                return FALSE;
     446        }
     447
     448        odata = ic->proto_data;
    459449        sess = odata->sess;
    460450        bosconn = odata->conn;
    461451
    462452        if (source < 0) {
    463                 hide_login_progress(gc, _("Could Not Connect"));
    464                 signoff(gc);
    465                 return;
     453                imcb_error(ic, _("Could Not Connect"));
     454                imc_logout(ic, TRUE);
     455                return FALSE;
    466456        }
    467457
    468458        aim_conn_completeconnect(sess, bosconn);
    469         gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,
     459        ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
    470460                        oscar_callback, bosconn);
    471         set_login_progress(gc, 4, _("Connection established, cookie sent"));
     461        imcb_log(ic, _("Connection established, cookie sent"));
     462       
     463        return FALSE;
    472464}
    473465
     
    476468        struct aim_authresp_info *info;
    477469        int i; char *host; int port;
    478         struct aim_user *user;
    479470        aim_conn_t *bosconn;
    480471
    481         struct gaim_connection *gc = sess->aux_data;
    482         struct oscar_data *od = gc->proto_data;
    483         user = gc->user;
    484         port = user->proto_opt[USEROPT_AUTHPORT][0] ?
    485                 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
     472        struct im_connection *ic = sess->aux_data;
     473        struct oscar_data *od = ic->proto_data;
     474        port = AIM_LOGIN_PORT;
    486475
    487476        va_start(ap, fr);
     
    493482                case 0x05:
    494483                        /* Incorrect nick/password */
    495                         hide_login_progress(gc, _("Incorrect nickname or password."));
     484                        imcb_error(ic, _("Incorrect nickname or password."));
    496485//                      plugin_event(event_error, (void *)980, 0, 0, 0);
    497486                        break;
    498487                case 0x11:
    499488                        /* Suspended account */
    500                         hide_login_progress(gc, _("Your account is currently suspended."));
     489                        imcb_error(ic, _("Your account is currently suspended."));
    501490                        break;
    502491                case 0x18:
    503492                        /* connecting too frequently */
    504                         hide_login_progress(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
     493                        imcb_error(ic, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
    505494                        break;
    506495                case 0x1c:
    507496                        /* client too old */
    508                         hide_login_progress(gc, _("The client version you are using is too old. Please upgrade at " WEBSITE));
     497                        imcb_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));
    509498                        break;
    510499                default:
    511                         hide_login_progress(gc, _("Authentication Failed"));
     500                        imcb_error(ic, _("Authentication Failed"));
    512501                        break;
    513502                }
     
    521510        bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
    522511        if (bosconn == NULL) {
    523                 hide_login_progress(gc, _("Internal Error"));
     512                imcb_error(ic, _("Internal Error"));
    524513                od->killme = TRUE;
    525514                return 0;
     
    555544        aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parsemtn, 0);
    556545
    557         ((struct oscar_data *)gc->proto_data)->conn = bosconn;
     546        ((struct oscar_data *)ic->proto_data)->conn = bosconn;
    558547        for (i = 0; i < (int)strlen(info->bosip); i++) {
    559548                if (info->bosip[i] == ':') {
     
    564553        host = g_strndup(info->bosip, i);
    565554        bosconn->status |= AIM_CONN_STATUS_INPROGRESS;
    566         bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc);
     555        bosconn->fd = proxy_connect(host, port, oscar_bos_connect, ic);
    567556        g_free(host);
    568557        if (bosconn->fd < 0) {
    569                 hide_login_progress(gc, _("Could Not Connect"));
     558                imcb_error(ic, _("Could Not Connect"));
    570559                od->killme = TRUE;
    571560                return 0;
    572561        }
    573562        aim_sendcookie(sess, bosconn, info->cookie);
    574         gaim_input_remove(gc->inpa);
     563        b_event_remove(ic->inpa);
    575564
    576565        return 1;
     
    578567
    579568struct pieceofcrap {
    580         struct gaim_connection *gc;
     569        struct im_connection *ic;
    581570        unsigned long offset;
    582571        unsigned long len;
     
    587576};
    588577
    589 static void damn_you(gpointer data, gint source, GaimInputCondition c)
     578static gboolean damn_you(gpointer data, gint source, b_input_condition c)
    590579{
    591580        struct pieceofcrap *pos = data;
    592         struct oscar_data *od = pos->gc->proto_data;
     581        struct oscar_data *od = pos->ic->proto_data;
    593582        char in = '\0';
    594583        int x = 0;
     
    605594        }
    606595        if (in != '\n') {
    607                 do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
    608                                 " You may be disconnected shortly.", "Login Error");
    609                 gaim_input_remove(pos->inpa);
     596                imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
     597                                " You may be disconnected shortly.");
     598                b_event_remove(pos->inpa);
    610599                closesocket(pos->fd);
    611600                g_free(pos);
    612                 return;
     601                return FALSE;
    613602        }
    614603        /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */
    615604        read(pos->fd, m, 16);
    616605        m[16] = '\0';
    617         gaim_input_remove(pos->inpa);
     606        b_event_remove(pos->inpa);
    618607        closesocket(pos->fd);
    619608        aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
    620609        g_free(pos);
    621 }
    622 
    623 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) {
     610       
     611        return FALSE;
     612}
     613
     614static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) {
    624615        struct pieceofcrap *pos = data;
    625616        char buf[BUF_LONG];
    626617
    627618        if (source < 0) {
    628                 do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
    629                                 " You may be disconnected shortly.", "Login Error");
     619                imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
     620                                " You may be disconnected shortly.");
    630621                if (pos->modname)
    631622                        g_free(pos->modname);
    632623                g_free(pos);
    633                 return;
     624                return FALSE;
    634625        }
    635626
     
    640631        if (pos->modname)
    641632                g_free(pos->modname);
    642         pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
    643         return;
     633        pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
     634        return FALSE;
    644635}
    645636
     
    692683
    693684        pos = g_new0(struct pieceofcrap, 1);
    694         pos->gc = sess->aux_data;
     685        pos->ic = sess->aux_data;
    695686        pos->conn = fr->conn;
    696687
     
    704695                        g_free(pos->modname);
    705696                g_free(pos);
    706                 do_error_dialog(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."
    707                                 " You may be disconnected shortly.", "Login Error");
     697                imcb_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."
     698                                " You may be disconnected shortly.");
    708699        }
    709700        pos->fd = fd;
     
    720711        char *key;
    721712        va_list ap;
    722         struct gaim_connection *gc = sess->aux_data;
     713        struct im_connection *ic = sess->aux_data;
    723714
    724715        va_start(ap, fr);
     
    726717        va_end(ap);
    727718
    728         aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
     719        aim_send_login(sess, fr->conn, ic->acc->user, ic->acc->pass, &info, key);
    729720
    730721        return 1;
     
    732723
    733724static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) {
    734         struct gaim_connection *gc = sess->aux_data;
     725        struct im_connection *ic = sess->aux_data;
    735726        struct chat_connection *chatcon;
    736727        static int id = 1;
     
    744735        aim_clientready(sess, fr->conn);
    745736
    746         chatcon = find_oscar_chat_by_conn(gc, fr->conn);
     737        chatcon = find_oscar_chat_by_conn(ic, fr->conn);
    747738        chatcon->id = id;
    748         chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show);
     739        chatcon->cnv = imcb_chat_new(ic, chatcon->show);
     740        chatcon->cnv->data = chatcon;
    749741
    750742        return 1;
     
    763755}
    764756
    765 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {
    766         struct gaim_connection *gc = data;
     757static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {
     758        struct im_connection *ic = data;
    767759        struct oscar_data *odata;
    768760        aim_session_t *sess;
    769761        aim_conn_t *tstconn;
    770762
    771         if (!g_slist_find(get_connections(), gc)) {
     763        if (!g_slist_find(get_connections(), ic)) {
    772764                closesocket(source);
    773                 return;
    774         }
    775 
    776         odata = gc->proto_data;
     765                return FALSE;
     766        }
     767
     768        odata = ic->proto_data;
    777769        sess = odata->sess;
    778770        tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV);
     
    780772        if (source < 0) {
    781773                aim_conn_kill(sess, &tstconn);
    782                 return;
     774                return FALSE;
    783775        }
    784776
    785777        aim_conn_completeconnect(sess, tstconn);
    786         odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
     778        odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    787779                                        oscar_callback, tstconn);
    788 }
    789 
    790 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond)
     780       
     781        return FALSE;
     782}
     783
     784static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond)
    791785{
    792         struct gaim_connection *gc = data;
     786        struct im_connection *ic = data;
    793787        struct oscar_data *odata;
    794788        aim_session_t *sess;
    795789        aim_conn_t *tstconn;
    796790
    797         if (!g_slist_find(get_connections(), gc)) {
     791        if (!g_slist_find(get_connections(), ic)) {
    798792                closesocket(source);
    799                 return;
    800         }
    801 
    802         odata = gc->proto_data;
     793                return FALSE;
     794        }
     795
     796        odata = ic->proto_data;
    803797        sess = odata->sess;
    804798        tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
     
    806800        if (source < 0) {
    807801                aim_conn_kill(sess, &tstconn);
    808                 return;
     802                return FALSE;
    809803        }
    810804
    811805        aim_conn_completeconnect(sess, tstconn);
    812         odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
     806        odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    813807                                oscar_callback, tstconn);
    814 }
    815 
    816 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond)
     808       
     809        return FALSE;
     810}
     811
     812static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond)
    817813{
    818814        struct chat_connection *ccon = data;
    819         struct gaim_connection *gc = ccon->gc;
     815        struct im_connection *ic = ccon->ic;
    820816        struct oscar_data *odata;
    821817        aim_session_t *sess;
    822818        aim_conn_t *tstconn;
    823819
    824         if (!g_slist_find(get_connections(), gc)) {
     820        if (!g_slist_find(get_connections(), ic)) {
    825821                closesocket(source);
    826822                g_free(ccon->show);
    827823                g_free(ccon->name);
    828824                g_free(ccon);
    829                 return;
    830         }
    831 
    832         odata = gc->proto_data;
     825                return FALSE;
     826        }
     827
     828        odata = ic->proto_data;
    833829        sess = odata->sess;
    834830        tstconn = ccon->conn;
     
    839835                g_free(ccon->name);
    840836                g_free(ccon);
    841                 return;
     837                return FALSE;
    842838        }
    843839
    844840        aim_conn_completeconnect(sess, ccon->conn);
    845         ccon->inpa = gaim_input_add(tstconn->fd,
     841        ccon->inpa = b_input_add(tstconn->fd,
    846842                        GAIM_INPUT_READ,
    847843                        oscar_callback, tstconn);
    848844        odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
     845       
     846        return FALSE;
    849847}
    850848
     
    853851        va_list ap;
    854852        struct aim_redirect_data *redir;
    855         struct gaim_connection *gc = sess->aux_data;
    856         struct aim_user *user = gc->user;
     853        struct im_connection *ic = sess->aux_data;
    857854        aim_conn_t *tstconn;
    858855        int i;
     
    860857        int port;
    861858
    862         port = user->proto_opt[USEROPT_AUTHPORT][0] ?
    863                 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
    864 
    865859        va_start(ap, fr);
    866860        redir = va_arg(ap, struct aim_redirect_data *);
    867861        va_end(ap);
    868862
     863        port = AIM_LOGIN_PORT;
    869864        for (i = 0; i < (int)strlen(redir->ip); i++) {
    870865                if (redir->ip[i] == ':') {
     
    888883
    889884                tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
    890                 tstconn->fd = proxy_connect(host, port, oscar_auth_connect, gc);
     885                tstconn->fd = proxy_connect(host, port, oscar_auth_connect, ic);
    891886                if (tstconn->fd < 0) {
    892887                        aim_conn_kill(sess, &tstconn);
     
    905900
    906901                tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
    907                 tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, gc);
     902                tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, ic);
    908903                if (tstconn->fd < 0) {
    909904                        aim_conn_kill(sess, &tstconn);
     
    927922                ccon = g_new0(struct chat_connection, 1);
    928923                ccon->conn = tstconn;
    929                 ccon->gc = gc;
     924                ccon->ic = ic;
    930925                ccon->fd = -1;
    931926                ccon->name = g_strdup(redir->chat.room);
     
    956951
    957952static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
    958         struct gaim_connection *gc = sess->aux_data;
    959         struct oscar_data *od = gc->proto_data;
     953        struct im_connection *ic = sess->aux_data;
     954        struct oscar_data *od = ic->proto_data;
    960955        aim_userinfo_t *info;
    961956        time_t time_idle = 0, signon = 0;
    962         int type = 0;
    963         int caps = 0;
    964         char *tmp;
     957        int flags = OPT_LOGGED_IN;
     958        char *tmp, *state_string = NULL;
    965959
    966960        va_list ap;
     
    969963        va_end(ap);
    970964
    971         if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES)
    972                 caps = info->capabilities;
    973         if (info->flags & AIM_FLAG_ACTIVEBUDDY)
    974                 type |= UC_AB;
    975 
    976965        if ((!od->icq) && (info->present & AIM_USERINFO_PRESENT_FLAGS)) {
    977                 if (info->flags & AIM_FLAG_UNCONFIRMED)
    978                         type |= UC_UNCONFIRMED;
    979                 if (info->flags & AIM_FLAG_ADMINISTRATOR)
    980                         type |= UC_ADMIN;
    981                 if (info->flags & AIM_FLAG_AOL)
    982                         type |= UC_AOL;
    983                 if (info->flags & AIM_FLAG_FREE)
    984                         type |= UC_NORMAL;
    985966                if (info->flags & AIM_FLAG_AWAY)
    986                         type |= UC_UNAVAILABLE;
    987                 if (info->flags & AIM_FLAG_WIRELESS)
    988                         type |= UC_WIRELESS;
    989         }
     967                        flags |= OPT_AWAY;
     968        }
     969       
    990970        if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) {
    991                 type = (info->icqinfo.status << 7);
    992971                if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) &&
    993972                      (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) {
    994                         type |= UC_UNAVAILABLE;
    995                 }
    996         }
    997 
    998         if (caps & AIM_CAPS_ICQ)
    999                 caps ^= AIM_CAPS_ICQ;
     973                        flags |= OPT_AWAY;
     974                }
     975               
     976                if( info->icqinfo.status & AIM_ICQ_STATE_DND )
     977                        state_string = "Do Not Disturb";
     978                else if( info->icqinfo.status & AIM_ICQ_STATE_OUT )
     979                        state_string = "Not Available";
     980                else if( info->icqinfo.status & AIM_ICQ_STATE_BUSY )
     981                        state_string = "Occupied";
     982                else if( info->icqinfo.status & AIM_ICQ_STATE_INVISIBLE )
     983                        state_string = "Invisible";
     984        }
    1000985
    1001986        if (info->present & AIM_USERINFO_PRESENT_IDLE) {
     
    1007992                signon = time(NULL) - info->sessionlen;
    1008993
    1009         tmp = g_strdup(normalize(gc->username));
     994        if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR) {
     995                uint32_t *uin = g_new0(uint32_t, 1);
     996               
     997                if (od->ips == NULL)
     998                        od->ips = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, NULL);
     999               
     1000                if (sscanf(info->sn, "%d", uin) == 1)
     1001                        g_hash_table_insert(od->ips, uin, (gpointer) (long) info->icqinfo.ipaddr);
     1002        }
     1003
     1004        tmp = g_strdup(normalize(ic->acc->user));
    10101005        if (!strcmp(tmp, normalize(info->sn)))
    1011                 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn);
     1006                g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn);
    10121007        g_free(tmp);
    10131008
    1014         serv_got_update(gc, info->sn, 1, info->warnlevel/10, signon,
    1015                         time_idle, type, caps);
     1009        imcb_buddy_status(ic, info->sn, flags, state_string, NULL);
     1010        /* imcb_buddy_times(ic, info->sn, signon, time_idle); */
    10161011
    10171012        return 1;
     
    10211016        aim_userinfo_t *info;
    10221017        va_list ap;
    1023         struct gaim_connection *gc = sess->aux_data;
     1018        struct im_connection *ic = sess->aux_data;
    10241019
    10251020        va_start(ap, fr);
     
    10271022        va_end(ap);
    10281023
    1029         serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0);
     1024        imcb_buddy_status(ic, info->sn, 0, NULL, NULL );
    10301025
    10311026        return 1;
     
    10341029static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
    10351030        char *tmp = g_malloc(BUF_LONG + 1);
    1036         struct gaim_connection *gc = sess->aux_data;
     1031        struct im_connection *ic = sess->aux_data;
    10371032        int flags = 0;
    10381033       
    10391034        if (args->icbmflags & AIM_IMFLAGS_AWAY)
    1040                 flags |= IM_FLAG_AWAY;
     1035                flags |= OPT_AWAY;
    10411036       
    10421037        if ((args->icbmflags & AIM_IMFLAGS_UNICODE) || (args->icbmflags & AIM_IMFLAGS_ISO_8859_1)) {
     
    10681063                        g_snprintf(tmp, BUF_LONG, "%s", args->msg);
    10691064                }
    1070         } else
     1065        } else if (args->mpmsg.numparts == 0) {
    10711066                g_snprintf(tmp, BUF_LONG, "%s", args->msg);
     1067        } else {
     1068                aim_mpmsg_section_t *part;
     1069               
     1070                *tmp = 0;
     1071                for (part = args->mpmsg.parts; part; part = part->next) {
     1072                        if (part->data) {
     1073                                g_strlcat(tmp, (char*) part->data, BUF_LONG);
     1074                                g_strlcat(tmp, "\n", BUF_LONG);
     1075                        }
     1076                }
     1077        }
    10721078       
    10731079        strip_linefeed(tmp);
    1074         serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL), -1);
     1080        imcb_buddy_msg(ic, userinfo->sn, tmp, flags, 0);
    10751081        g_free(tmp);
    10761082       
     
    10821088       
    10831089static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) {
    1084         struct gaim_connection *gc = sess->aux_data;
     1090        struct im_connection *ic = sess->aux_data;
    10851091
    10861092        if (args->status != AIM_RENDEZVOUS_PROPOSE)
     
    11001106                g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", name, userinfo->sn, args->msg );
    11011107
    1102                 inv->gc = gc;
     1108                inv->ic = ic;
    11031109                inv->exchange = *exch;
    11041110                inv->name = g_strdup(name);
    11051111               
    1106                 do_ask_dialog( gc, txt, inv, oscar_accept_chat, oscar_reject_chat);
     1112                imcb_ask( ic, txt, inv, oscar_accept_chat, oscar_reject_chat);
    11071113       
    11081114                if (name)
     
    11151121static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) {
    11161122        char *uin, message;
    1117         struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
     1123        struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
    11181124       
    11191125        uin = g_strdup_printf("%u", data->uin);
     
    11211127        aim_ssi_auth_reply(od->sess, od->conn, uin, 1, "");
    11221128        // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message);
    1123         if(find_buddy(data->gc, uin) == NULL)
    1124                 show_got_added(data->gc, uin, NULL);
     1129        if(imcb_find_buddy(data->ic, uin) == NULL)
     1130                imcb_ask_add(data->ic, uin, NULL);
    11251131       
    11261132        g_free(uin);
     
    11301136static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) {
    11311137        char *uin, *message;
    1132         struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
     1138        struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
    11331139       
    11341140        uin = g_strdup_printf("%u", data->uin);
     
    11451151 * For when other people ask you for authorization
    11461152 */
    1147 static void gaim_icq_authask(struct gaim_connection *gc, guint32 uin, char *msg) {
     1153static void gaim_icq_authask(struct im_connection *ic, guint32 uin, char *msg) {
    11481154        struct icq_auth *data = g_new(struct icq_auth, 1);
    11491155        char *reason = NULL;
     
    11541160       
    11551161        dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given.");
    1156         data->gc = gc;
     1162        data->ic = ic;
    11571163        data->uin = uin;
    1158         do_ask_dialog(gc, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
     1164        imcb_ask(ic, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
    11591165        g_free(dialog_msg);
    11601166}
    11611167
    11621168static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args) {
    1163         struct gaim_connection *gc = sess->aux_data;
     1169        struct im_connection *ic = sess->aux_data;
    11641170
    11651171        switch (args->type) {
     
    11691175                        message = g_strdup(args->msg);
    11701176                        strip_linefeed(message);
    1171                         serv_got_im(gc, uin, message, 0, time(NULL), -1);
     1177                        imcb_buddy_msg(ic, uin, message, 0, 0);
    11721178                        g_free(uin);
    11731179                        g_free(message);
     
    11881194
    11891195                        strip_linefeed(message);
    1190                         serv_got_im(gc, uin, message, 0, time(NULL), -1);
     1196                        imcb_buddy_msg(ic, uin, message, 0, 0);
    11911197                        g_free(uin);
    11921198                        g_free(m);
     
    11951201               
    11961202                case 0x0006: { /* Someone requested authorization */
    1197                         gaim_icq_authask(gc, args->uin, args->msg);
     1203                        gaim_icq_authask(ic, args->uin, args->msg);
    11981204                } break;
    11991205
    12001206                case 0x0007: { /* Someone has denied you authorization */
    1201                         serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
     1207                        imcb_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
    12021208                } break;
    12031209
    12041210                case 0x0008: { /* Someone has granted you authorization */
    1205                         serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
     1211                        imcb_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
    12061212                } break;
    12071213
     
    12251231        channel = va_arg(ap, int);
    12261232        userinfo = va_arg(ap, aim_userinfo_t *);
    1227 
    1228     if (set_getint(sess->aux_data, "debug")) {
    1229         serv_got_crap(sess->aux_data, "channel %i called", channel);
    1230     }
    12311233
    12321234        switch (channel) {
     
    12621264        guint16 chan, nummissed, reason;
    12631265        aim_userinfo_t *userinfo;
    1264         char buf[1024];
    12651266
    12661267        va_start(ap, fr);
     
    12741275                case 0:
    12751276                        /* Invalid (0) */
    1276                         g_snprintf(buf,
    1277                                    sizeof(buf),
     1277                        imcb_error(sess->aux_data,
    12781278                                   nummissed == 1 ?
    12791279                                   _("You missed %d message from %s because it was invalid.") :
     
    12841284                case 1:
    12851285                        /* Message too large */
    1286                         g_snprintf(buf,
    1287                                    sizeof(buf),
     1286                        imcb_error(sess->aux_data,
    12881287                                   nummissed == 1 ?
    12891288                                   _("You missed %d message from %s because it was too large.") :
     
    12941293                case 2:
    12951294                        /* Rate exceeded */
    1296                         g_snprintf(buf,
    1297                                    sizeof(buf),
     1295                        imcb_error(sess->aux_data,
    12981296                                   nummissed == 1 ?
    12991297                                   _("You missed %d message from %s because the rate limit has been exceeded.") :
     
    13041302                case 3:
    13051303                        /* Evil Sender */
    1306                         g_snprintf(buf,
    1307                                    sizeof(buf),
     1304                        imcb_error(sess->aux_data,
    13081305                                   nummissed == 1 ?
    13091306                                   _("You missed %d message from %s because it was too evil.") :
     
    13141311                case 4:
    13151312                        /* Evil Receiver */
    1316                         g_snprintf(buf,
    1317                                    sizeof(buf),
     1313                        imcb_error(sess->aux_data,
    13181314                                   nummissed == 1 ?
    13191315                                   _("You missed %d message from %s because you are too evil.") :
     
    13231319                        break;
    13241320                default:
    1325                         g_snprintf(buf,
    1326                                    sizeof(buf),
     1321                        imcb_error(sess->aux_data,
    13271322                                   nummissed == 1 ?
    13281323                                   _("You missed %d message from %s for unknown reasons.") :
     
    13321327                        break;
    13331328        }
    1334         do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));
    13351329
    13361330        return 1;
     
    13401334        va_list ap;
    13411335        guint16 reason;
    1342         char *m;
    13431336
    13441337        va_start(ap, fr);
     
    13461339        va_end(ap);
    13471340
    1348         m = g_strdup_printf(_("SNAC threw error: %s\n"),
    1349                         reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
    1350         do_error_dialog(sess->aux_data, m, _("Gaim - Oscar SNAC Error"));
    1351         g_free(m);
     1341        imcb_error(sess->aux_data, _("SNAC threw error: %s"),
     1342                  reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
    13521343
    13531344        return 1;
     
    13581349        char *destn;
    13591350        guint16 reason;
    1360         char buf[1024];
    13611351
    13621352        va_start(ap, fr);
     
    13651355        va_end(ap);
    13661356
    1367         sprintf(buf, _("Your message to %s did not get sent: %s"), destn,
     1357        imcb_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn,
    13681358                        (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
    1369         do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));
    13701359
    13711360        return 1;
     
    13761365        char *destn;
    13771366        guint16 reason;
    1378         char buf[1024];
    13791367
    13801368        va_start(ap, fr);
     
    13831371        va_end(ap);
    13841372
    1385         sprintf(buf, _("User information for %s unavailable: %s"), destn,
     1373        imcb_error(sess->aux_data, _("User information for %s unavailable: %s"), destn,
    13861374                        (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
    1387         do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));
    1388 
    13891375
    13901376        return 1;
     
    14021388
    14031389        if (id < 4)
    1404                 do_error_dialog(sess->aux_data, _("Your connection may be lost."),
    1405                                 _("AOL error"));
     1390                imcb_error(sess->aux_data, _("Your connection may be lost."));
    14061391
    14071392        return 1;
     
    14111396        va_list ap;
    14121397        guint16 type;
    1413         struct gaim_connection *gc = sess->aux_data;
    1414         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     1398        struct im_connection *ic = sess->aux_data;
     1399        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    14151400
    14161401        va_start(ap, fr);
     
    14701455        int count, i;
    14711456        aim_userinfo_t *info;
    1472         struct gaim_connection *g = sess->aux_data;
     1457        struct im_connection *g = sess->aux_data;
    14731458
    14741459        struct chat_connection *c = NULL;
     
    14841469
    14851470        for (i = 0; i < count; i++)
    1486                 add_chat_buddy(c->cnv, info[i].sn);
     1471                imcb_chat_add_buddy(c->cnv, info[i].sn);
    14871472
    14881473        return 1;
     
    14931478        int count, i;
    14941479        aim_userinfo_t *info;
    1495         struct gaim_connection *g = sess->aux_data;
     1480        struct im_connection *g = sess->aux_data;
    14961481
    14971482        struct chat_connection *c = NULL;
     
    15071492
    15081493        for (i = 0; i < count; i++)
    1509                 remove_chat_buddy(c->cnv, info[i].sn, NULL);
     1494                imcb_chat_remove_buddy(c->cnv, info[i].sn, NULL);
    15101495
    15111496        return 1;
     
    15211506        guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
    15221507        guint32 creationtime;
    1523         struct gaim_connection *gc = sess->aux_data;
    1524         struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn);
     1508        struct im_connection *ic = sess->aux_data;
     1509        struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn);
    15251510
    15261511        va_start(ap, fr);
     
    15481533        aim_userinfo_t *info;
    15491534        char *msg;
    1550         struct gaim_connection *gc = sess->aux_data;
    1551         struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn);
     1535        struct im_connection *ic = sess->aux_data;
     1536        struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn);
    15521537        char *tmp;
    15531538
     
    15581543        tmp = g_malloc(BUF_LONG);
    15591544        g_snprintf(tmp, BUF_LONG, "%s", msg);
    1560         serv_got_chat_in(gc, ccon->id, info->sn, 0, tmp, time((time_t)NULL));
     1545        imcb_chat_msg(ccon->cnv, info->sn, tmp, 0, 0);
    15611546        g_free(tmp);
    15621547
     
    15971582                aim_conn_setlatency(fr->conn, windowsize/4);
    15981583        } else if (code == AIM_RATE_CODE_LIMIT) {
    1599                 do_error_dialog(sess->aux_data, _("The last message was not sent because you are over the rate limit. "
    1600                                   "Please wait 10 seconds and try again."), _("Gaim - Error"));
     1584                imcb_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. "
     1585                          "Please wait 10 seconds and try again."));
    16011586                aim_conn_setlatency(fr->conn, windowsize/2);
    16021587        } else if (code == AIM_RATE_CODE_CLEARLIMIT) {
     
    16101595        va_list ap;
    16111596        aim_userinfo_t *info;
    1612         struct gaim_connection *gc = sess->aux_data;
     1597        struct im_connection *ic = sess->aux_data;
    16131598
    16141599        va_start(ap, fr);
     
    16161601        va_end(ap);
    16171602
    1618         gc->evil = info->warnlevel/10;
    1619         /* gc->correction_time = (info->onlinesince - gc->login_time); */
     1603        ic->evil = info->warnlevel/10;
     1604        /* ic->correction_time = (info->onlinesince - ic->login_time); */
    16201605
    16211606        return 1;
     
    16391624
    16401625static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) {
    1641         struct gaim_connection *gc = sess->aux_data;
    1642         struct oscar_data *od = gc->proto_data;
     1626        struct im_connection *ic = sess->aux_data;
     1627        struct oscar_data *od = ic->proto_data;
    16431628
    16441629        aim_clientready(sess, fr->conn);
     
    16971682        va_list ap;
    16981683        guint16 maxsiglen;
    1699         struct gaim_connection *gc = sess->aux_data;
    1700         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     1684        struct im_connection *ic = sess->aux_data;
     1685        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    17011686
    17021687        va_start(ap, fr);
     
    17061691        odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
    17071692
    1708         aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps);
    1709 
     1693        /* FIXME: It seems we're not really using this, and it broke now that
     1694           struct aim_user is dead.
     1695        aim_bos_setprofile(sess, fr->conn, ic->user->user_info, NULL, gaim_caps);
     1696        */
     1697       
    17101698        return 1;
    17111699}
     
    17141702        va_list ap;
    17151703        guint16 maxbuddies, maxwatchers;
    1716         struct gaim_connection *gc = sess->aux_data;
    1717         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     1704        struct im_connection *ic = sess->aux_data;
     1705        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    17181706
    17191707        va_start(ap, fr);
     
    17311719        guint16 maxpermits, maxdenies;
    17321720        va_list ap;
    1733         struct gaim_connection *gc = sess->aux_data;
    1734         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     1721        struct im_connection *ic = sess->aux_data;
     1722        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    17351723
    17361724        va_start(ap, fr);
     
    17551743        va_list ap;
    17561744        struct aim_icq_offlinemsg *msg;
    1757         struct gaim_connection *gc = sess->aux_data;
     1745        struct im_connection *ic = sess->aux_data;
    17581746
    17591747        va_start(ap, fr);
     
    17681756                        g_snprintf(sender, sizeof(sender), "%u", msg->sender);
    17691757                        strip_linefeed(dialog_msg);
    1770                         serv_got_im(gc, sender, dialog_msg, 0, t, -1);
     1758                        imcb_buddy_msg(ic, sender, dialog_msg, 0, t);
    17711759                        g_free(dialog_msg);
    17721760                } break;
     
    17891777
    17901778                        strip_linefeed(dialog_msg);
    1791                         serv_got_im(gc, sender, dialog_msg, 0, t, -1);
     1779                        imcb_buddy_msg(ic, sender, dialog_msg, 0, t);
    17921780                        g_free(dialog_msg);
    17931781                        g_free(m);
     
    17951783               
    17961784                case 0x0006: { /* Authorization request */
    1797                         gaim_icq_authask(gc, msg->sender, msg->msg);
     1785                        gaim_icq_authask(ic, msg->sender, msg->msg);
    17981786                } break;
    17991787
    18001788                case 0x0007: { /* Someone has denied you authorization */
    1801                         serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
     1789                        imcb_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
    18021790                } break;
    18031791
    18041792                case 0x0008: { /* Someone has granted you authorization */
    1805                         serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
     1793                        imcb_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
    18061794                } break;
    18071795
     
    18231811}
    18241812
    1825 static void oscar_keepalive(struct gaim_connection *gc) {
    1826         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
     1813static void oscar_keepalive(struct im_connection *ic) {
     1814        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
    18271815        aim_flap_nop(odata->sess, odata->conn);
    18281816}
    18291817
    1830 static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) {
    1831         struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
    1832         int ret = 0;
    1833         if (imflags & IM_FLAG_AWAY) {
     1818static int oscar_buddy_msg(struct im_connection *ic, char *name, char *message, int imflags) {
     1819        struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
     1820        int ret = 0, len = strlen(message);
     1821        if (imflags & OPT_AWAY) {
    18341822                ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message);
    18351823        } else {
     
    18821870}
    18831871
    1884 static void oscar_get_info(struct gaim_connection *g, char *name) {
     1872static void oscar_get_info(struct im_connection *g, char *name) {
    18851873        struct oscar_data *odata = (struct oscar_data *)g->proto_data;
    18861874        if (odata->icq)
     
    18921880}
    18931881
    1894 static void oscar_get_away(struct gaim_connection *g, char *who) {
     1882static void oscar_get_away(struct im_connection *g, char *who) {
    18951883        struct oscar_data *odata = (struct oscar_data *)g->proto_data;
    18961884        if (odata->icq) {
    1897                 struct buddy *budlight = find_buddy(g, who);
     1885                struct buddy *budlight = imcb_find_buddy(g, who);
    18981886                if (budlight)
    18991887                        if ((budlight->uc & 0xff80) >> 7)
     
    19041892}
    19051893
    1906 static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message)
     1894static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message)
    19071895{
    19081896
     
    19161904
    19171905        if (od->rights.maxawaymsglen == 0)
    1918                 do_error_dialog(gc, "oscar_set_away_aim called before locate rights received", "Protocol Error");
     1906                imcb_error(ic, "oscar_set_away_aim called before locate rights received");
    19191907
    19201908        aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
    19211909
    1922         if (gc->away)
    1923                 g_free(gc->away);
    1924         gc->away = NULL;
     1910        if (ic->away)
     1911                g_free(ic->away);
     1912        ic->away = NULL;
    19251913
    19261914        if (!message) {
     
    19301918
    19311919        if (strlen(message) > od->rights.maxawaymsglen) {
    1932                 gchar *errstr;
    1933 
    1934                 errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
    1935 
    1936                 do_error_dialog(gc, errstr, "Away Message Too Long");
    1937 
    1938                 g_free(errstr);
    1939         }
    1940 
    1941         gc->away = g_strndup(message, od->rights.maxawaymsglen);
    1942         aim_bos_setprofile(od->sess, od->conn, NULL, gc->away, gaim_caps);
     1920                imcb_error(ic, "Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
     1921        }
     1922
     1923        ic->away = g_strndup(message, od->rights.maxawaymsglen);
     1924        aim_bos_setprofile(od->sess, od->conn, NULL, ic->away, gaim_caps);
    19431925
    19441926        return;
    19451927}
    19461928
    1947 static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message)
     1929static void oscar_set_away_icq(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message)
    19481930{
    19491931    const char *msg = NULL;
     
    19511933
    19521934        /* clean old states */
    1953     if (gc->away) {
    1954                 g_free(gc->away);
    1955                 gc->away = NULL;
     1935    if (ic->away) {
     1936                g_free(ic->away);
     1937                ic->away = NULL;
    19561938    }
    19571939        od->sess->aim_icq_state = 0;
     
    19691951        } else if (!g_strcasecmp(state, "Away")) {
    19701952                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
    1971         gc->away = g_strdup(msg);
     1953        ic->away = g_strdup(msg);
    19721954                od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY;
    19731955        } else if (!g_strcasecmp(state, "Do Not Disturb")) {
    19741956                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY);
    1975         gc->away = g_strdup(msg);
     1957        ic->away = g_strdup(msg);
    19761958                od->sess->aim_icq_state = AIM_MTYPE_AUTODND;
    19771959        } else if (!g_strcasecmp(state, "Not Available")) {
    19781960                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
    1979         gc->away = g_strdup(msg);
     1961        ic->away = g_strdup(msg);
    19801962                od->sess->aim_icq_state = AIM_MTYPE_AUTONA;
    19811963        } else if (!g_strcasecmp(state, "Occupied")) {
    19821964                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY);
    1983         gc->away = g_strdup(msg);
     1965        ic->away = g_strdup(msg);
    19841966                od->sess->aim_icq_state = AIM_MTYPE_AUTOBUSY;
    19851967        } else if (!g_strcasecmp(state, "Free For Chat")) {
    19861968                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT);
    1987         gc->away = g_strdup(msg);
     1969        ic->away = g_strdup(msg);
    19881970                od->sess->aim_icq_state = AIM_MTYPE_AUTOFFC;
    19891971        } else if (!g_strcasecmp(state, "Invisible")) {
    19901972                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE);
    1991         gc->away = g_strdup(msg);
     1973        ic->away = g_strdup(msg);
    19921974        } else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)) {
    19931975                if (no_message) {
     
    19951977                } else {
    19961978                        aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
    1997             gc->away = g_strdup(msg);
     1979            ic->away = g_strdup(msg);
    19981980                        od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY;
    19991981                }
     
    20031985}
    20041986
    2005 static void oscar_set_away(struct gaim_connection *gc, char *state, char *message)
     1987static void oscar_set_away(struct im_connection *ic, char *state, char *message)
    20061988{
    2007         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
    2008 
    2009     oscar_set_away_aim(gc, od, state, message);
     1989        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
     1990
     1991    oscar_set_away_aim(ic, od, state, message);
    20101992        if (od->icq)
    2011                 oscar_set_away_icq(gc, od, state, message);
     1993                oscar_set_away_icq(ic, od, state, message);
    20121994
    20131995        return;
    20141996}
    20151997
    2016 static void oscar_add_buddy(struct gaim_connection *g, char *name) {
     1998static void oscar_add_buddy(struct im_connection *g, char *name, char *group) {
    20171999        struct oscar_data *odata = (struct oscar_data *)g->proto_data;
    20182000        aim_ssi_addbuddies(odata->sess, odata->conn, OSCAR_GROUP, &name, 1, 0);
    20192001}
    20202002
    2021 static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) {
     2003static void oscar_remove_buddy(struct im_connection *g, char *name, char *group) {
    20222004        struct oscar_data *odata = (struct oscar_data *)g->proto_data;
    20232005        struct aim_ssi_item *ssigroup;
     
    20302012
    20312013static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
    2032         struct gaim_connection *gc = sess->aux_data;
     2014        struct im_connection *ic = sess->aux_data;
    20332015        struct aim_ssi_item *curitem;
    20342016        int tmp;
     
    20392021                switch (curitem->type) {
    20402022                        case 0x0000: /* Buddy */
    2041                                 if ((curitem->name) && (!find_buddy(gc, curitem->name))) {
     2023                                if ((curitem->name) && (!imcb_find_buddy(ic, curitem->name))) {
    20422024                                        char *realname = NULL;
    20432025
     
    20452027                                                    realname = aim_gettlv_str(curitem->data, 0x0131, 1);
    20462028                                               
    2047                                         add_buddy(gc, NULL, curitem->name, realname);
     2029                                        imcb_add_buddy(ic, curitem->name, NULL);
    20482030                                       
    2049                                         if (realname)
    2050                                             g_free(realname);
     2031                                        if (realname) {
     2032                                                imcb_buddy_nick_hint(ic, curitem->name, realname);
     2033                                                imcb_rename_buddy(ic, curitem->name, realname);
     2034                                                g_free(realname);
     2035                                        }
    20512036                                }
    20522037                                break;
     
    20552040                                if (curitem->name) {
    20562041                                        GSList *list;
    2057                                         for (list=gc->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
     2042                                        for (list=ic->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
    20582043                                        if (!list) {
    20592044                                                char *name;
    20602045                                                name = g_strdup(normalize(curitem->name));
    2061                                                 gc->permit = g_slist_append(gc->permit, name);
     2046                                                ic->permit = g_slist_append(ic->permit, name);
    20622047                                                tmp++;
    20632048                                        }
     
    20682053                                if (curitem->name) {
    20692054                                        GSList *list;
    2070                                         for (list=gc->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
     2055                                        for (list=ic->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
    20712056                                        if (!list) {
    20722057                                                char *name;
    20732058                                                name = g_strdup(normalize(curitem->name));
    2074                                                 gc->deny = g_slist_append(gc->deny, name);
     2059                                                ic->deny = g_slist_append(ic->deny, name);
    20752060                                                tmp++;
    20762061                                        }
     
    20812066                                if (curitem->data) {
    20822067                                        guint8 permdeny;
    2083                                         if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != gc->permdeny)) {
    2084                                                 gc->permdeny = permdeny;
     2068                                        if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != ic->permdeny)) {
     2069                                                ic->permdeny = permdeny;
    20852070                                                tmp++;
    20862071                                        }
     
    21002085       
    21012086        /* Now that we have a buddy list, we can tell BitlBee that we're online. */
    2102         account_online(gc);
     2087        imcb_connected(ic);
    21032088       
    21042089        return 1;
     
    21222107                {
    21232108                        /* Hmm, the length should be even... */
    2124                         do_error_dialog( sess->aux_data, "Received SSI ACK package with non-even length", "Gaim - Error" );
     2109                        imcb_error( sess->aux_data, "Received SSI ACK package with non-even length");
    21252110                        return( 0 );
    21262111                }
     
    21312116                {
    21322117                        st = aimbs_get16( &fr->data );
    2133                         if( st == 0x0E )
     2118                        if( st == 0x00 )
    21342119                        {
    2135                                 serv_got_crap( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list );
     2120                                imcb_add_buddy( sess->aux_data, list, NULL );
     2121                        }
     2122                        else if( st == 0x0E )
     2123                        {
     2124                                imcb_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list );
    21362125                               
    21372126                                aim_ssi_auth_request( sess, fr->conn, list, "" );
    21382127                                aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 );
    21392128                        }
     2129                        else
     2130                        {
     2131                                imcb_error( sess->aux_data, "Error while adding buddy: 0x%04x", st );
     2132                        }
    21402133                        list += strlen( list ) + 1;
    21412134                }
     
    21452138}
    21462139
    2147 static void oscar_set_permit_deny(struct gaim_connection *gc) {
    2148         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2140static void oscar_set_permit_deny(struct im_connection *ic) {
     2141        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    21492142        if (od->icq) {
    21502143                GSList *list;
     
    21522145                int at;
    21532146
    2154                 switch(gc->permdeny) {
     2147                switch(ic->permdeny) {
    21552148                case 1:
    2156                         aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username);
     2149                        aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, ic->acc->user);
    21572150                        break;
    21582151                case 2:
    2159                         aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username);
     2152                        aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, ic->acc->user);
    21602153                        break;
    21612154                case 3:
    2162                         list = gc->permit;
     2155                        list = ic->permit;
    21632156                        at = 0;
    21642157                        while (list) {
     
    21692162                        break;
    21702163                case 4:
    2171                         list = gc->deny;
     2164                        list = ic->deny;
    21722165                        at = 0;
    21732166                        while (list) {
     
    21802173                        break;
    21812174                }
    2182                 signoff_blocked(gc);
    21832175        } else {
    21842176                if (od->sess->ssi.received_data)
    2185                         aim_ssi_setpermdeny(od->sess, od->conn, gc->permdeny, 0xffffffff);
    2186         }
    2187 }
    2188 
    2189 static void oscar_add_permit(struct gaim_connection *gc, char *who) {
    2190         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2177                        aim_ssi_setpermdeny(od->sess, od->conn, ic->permdeny, 0xffffffff);
     2178        }
     2179}
     2180
     2181static void oscar_add_permit(struct im_connection *ic, char *who) {
     2182        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    21912183        if (od->icq) {
    21922184                aim_ssi_auth_reply(od->sess, od->conn, who, 1, "");
     
    21972189}
    21982190
    2199 static void oscar_add_deny(struct gaim_connection *gc, char *who) {
    2200         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2191static void oscar_add_deny(struct im_connection *ic, char *who) {
     2192        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    22012193        if (od->icq) {
    22022194                aim_ssi_auth_reply(od->sess, od->conn, who, 0, "");
     
    22072199}
    22082200
    2209 static void oscar_rem_permit(struct gaim_connection *gc, char *who) {
    2210         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2201static void oscar_rem_permit(struct im_connection *ic, char *who) {
     2202        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    22112203        if (!od->icq) {
    22122204                if (od->sess->ssi.received_data)
     
    22152207}
    22162208
    2217 static void oscar_rem_deny(struct gaim_connection *gc, char *who) {
    2218         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2209static void oscar_rem_deny(struct im_connection *ic, char *who) {
     2210        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    22192211        if (!od->icq) {
    22202212                if (od->sess->ssi.received_data)
     
    22232215}
    22242216
    2225 static GList *oscar_away_states(struct gaim_connection *gc)
     2217static GList *oscar_away_states(struct im_connection *ic)
    22262218{
    2227         struct oscar_data *od = gc->proto_data;
     2219        struct oscar_data *od = ic->proto_data;
    22282220        GList *m = NULL;
    22292221
     
    22442236static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...)
    22452237{
    2246         struct gaim_connection *gc = sess->aux_data;
    2247         gchar who[16];
    2248         GString *str;
    2249         va_list ap;
    2250         struct aim_icq_info *info;
    2251 
    2252         va_start(ap, fr);
    2253         info = va_arg(ap, struct aim_icq_info *);
    2254         va_end(ap);
    2255 
    2256         if (!info->uin)
    2257                 return 0;
    2258 
    2259         str = g_string_sized_new(100);
    2260         g_snprintf(who, sizeof(who), "%u", info->uin);
    2261 
    2262         g_string_sprintfa(str, "%s: %s - %s: %s", _("UIN"), who, _("Nick"),
    2263                                 info->nick ? info->nick : "-");
    2264         info_string_append(str, "\n", _("First Name"), info->first);
    2265         info_string_append(str, "\n", _("Last Name"), info->last);
    2266                 info_string_append(str, "\n", _("Email Address"), info->email);
    2267         if (info->numaddresses && info->email2) {
    2268                 int i;
    2269                 for (i = 0; i < info->numaddresses; i++) {
    2270                                         info_string_append(str, "\n", _("Email Address"), info->email2[i]);
    2271                 }
    2272         }
    2273         info_string_append(str, "\n", _("Mobile Phone"), info->mobile);
    2274         info_string_append(str, "\n", _("Gender"), info->gender==1 ? _("Female") : _("Male"));
    2275         if (info->birthyear || info->birthmonth || info->birthday) {
    2276                 char date[30];
    2277                 struct tm tm;
    2278                 tm.tm_mday = (int)info->birthday;
    2279                 tm.tm_mon = (int)info->birthmonth-1;
    2280                 tm.tm_year = (int)info->birthyear%100;
    2281                 strftime(date, sizeof(date), "%Y-%m-%d", &tm);
    2282                 info_string_append(str, "\n", _("Birthday"), date);
    2283         }
    2284         if (info->age) {
    2285                 char age[5];
    2286                 g_snprintf(age, sizeof(age), "%hhd", info->age);
    2287                 info_string_append(str, "\n", _("Age"), age);
    2288         }
    2289                 info_string_append(str, "\n", _("Personal Web Page"), info->personalwebpage);
    2290         if (info->info && info->info[0]) {
    2291                 g_string_sprintfa(str, "\n%s:\n%s\n%s", _("Additional Information"),
    2292                                                 info->info, _("End of Additional Information"));
    2293         }
    2294         g_string_sprintfa(str, "\n");
    2295         if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) {
    2296                 g_string_sprintfa(str, "%s:", _("Home Address"));
    2297                 info_string_append(str, "\n", _("Address"), info->homeaddr);
    2298                 info_string_append(str, "\n", _("City"), info->homecity);
    2299                 info_string_append(str, "\n", _("State"), info->homestate);
    2300                                 info_string_append(str, "\n", _("Zip Code"), info->homezip);
    2301                 g_string_sprintfa(str, "\n");
    2302         }
    2303         if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) {
    2304                 g_string_sprintfa(str, "%s:", _("Work Address"));
    2305                 info_string_append(str, "\n", _("Address"), info->workaddr);
    2306                 info_string_append(str, "\n", _("City"), info->workcity);
    2307                 info_string_append(str, "\n", _("State"), info->workstate);
    2308                                 info_string_append(str, "\n", _("Zip Code"), info->workzip);
    2309                 g_string_sprintfa(str, "\n");
    2310         }
    2311         if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) {
    2312                 g_string_sprintfa(str, "%s:", _("Work Information"));
    2313                 info_string_append(str, "\n", _("Company"), info->workcompany);
    2314                 info_string_append(str, "\n", _("Division"), info->workdivision);
    2315                 info_string_append(str, "\n", _("Position"), info->workposition);
    2316                 if (info->workwebpage && info->workwebpage[0]) {
    2317                         info_string_append(str, "\n", _("Web Page"), info->workwebpage);
    2318                 }
    2319                 g_string_sprintfa(str, "\n");
    2320         }
    2321 
    2322                 serv_got_crap(gc, "%s\n%s", _("User Info"), str->str);
    2323         g_string_free(str, TRUE);
    2324 
    2325         return 1;
     2238        struct im_connection *ic = sess->aux_data;
     2239        struct oscar_data *od = ic->proto_data;
     2240        gchar who[16];
     2241        GString *str;
     2242        va_list ap;
     2243        struct aim_icq_info *info;
     2244        uint32_t ip;
     2245
     2246        va_start(ap, fr);
     2247        info = va_arg(ap, struct aim_icq_info *);
     2248        va_end(ap);
     2249
     2250        if (!info->uin)
     2251                return 0;
     2252
     2253        str = g_string_sized_new(512);
     2254        g_snprintf(who, sizeof(who), "%u", info->uin);
     2255
     2256        g_string_printf(str, "%s: %s - %s: %s", _("UIN"), who, _("Nick"),
     2257        info->nick ? info->nick : "-");
     2258        g_string_append_printf(str, "\n%s: %s", _("First Name"), info->first);
     2259        g_string_append_printf(str, "\n%s: %s", _("Last Name"), info->last);
     2260        g_string_append_printf(str, "\n%s: %s", _("Email Address"), info->email);
     2261        if (info->numaddresses && info->email2) {
     2262                int i;
     2263                for (i = 0; i < info->numaddresses; i++) {
     2264                        g_string_append_printf(str, "\n%s: %s", _("Email Address"), info->email2[i]);
     2265                }
     2266        }
     2267        if ((ip = (long) g_hash_table_lookup(od->ips, &info->uin)) != 0) {
     2268                g_string_append_printf(str, "\n%s: %d.%d.%d.%d", _("Last used IP address"),
     2269                                       (ip >> 24), (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff);
     2270        }
     2271        g_string_append_printf(str, "\n%s: %s", _("Mobile Phone"), info->mobile);
     2272        if (info->gender != 0)
     2273                g_string_append_printf(str, "\n%s: %s", _("Gender"), info->gender==1 ? _("Female") : _("Male"));
     2274        if (info->birthyear || info->birthmonth || info->birthday) {
     2275                char date[30];
     2276                struct tm tm;
     2277                memset(&tm, 0, sizeof(struct tm));
     2278                tm.tm_mday = (int)info->birthday;
     2279                tm.tm_mon = (int)info->birthmonth-1;
     2280                tm.tm_year = (int)info->birthyear%100;
     2281                strftime(date, sizeof(date), "%Y-%m-%d", &tm);
     2282                g_string_append_printf(str, "\n%s: %s", _("Birthday"), date);
     2283        }
     2284        if (info->age) {
     2285                char age[5];
     2286                g_snprintf(age, sizeof(age), "%hhd", info->age);
     2287                g_string_append_printf(str, "\n%s: %s", _("Age"), age);
     2288        }
     2289        g_string_append_printf(str, "\n%s: %s", _("Personal Web Page"), info->personalwebpage);
     2290        if (info->info && info->info[0]) {
     2291                g_string_sprintfa(str, "\n%s:\n%s\n%s", _("Additional Information"),
     2292                info->info, _("End of Additional Information"));
     2293        }
     2294        g_string_append_c(str, '\n');
     2295        if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) {
     2296                g_string_append_printf(str, "%s:", _("Home Address"));
     2297                g_string_append_printf(str, "\n%s: %s", _("Address"), info->homeaddr);
     2298                g_string_append_printf(str, "\n%s: %s", _("City"), info->homecity);
     2299                g_string_append_printf(str, "\n%s: %s", _("State"), info->homestate);
     2300                g_string_append_printf(str, "\n%s: %s", _("Zip Code"), info->homezip);
     2301                g_string_append_c(str, '\n');
     2302        }
     2303        if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) {
     2304                g_string_append_printf(str, "%s:", _("Work Address"));
     2305                g_string_append_printf(str, "\n%s: %s", _("Address"), info->workaddr);
     2306                g_string_append_printf(str, "\n%s: %s", _("City"), info->workcity);
     2307                g_string_append_printf(str, "\n%s: %s", _("State"), info->workstate);
     2308                g_string_append_printf(str, "\n%s: %s", _("Zip Code"), info->workzip);
     2309                g_string_append_c(str, '\n');
     2310        }
     2311        if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) {
     2312                g_string_append_printf(str, "%s:", _("Work Information"));
     2313                g_string_append_printf(str, "\n%s: %s", _("Company"), info->workcompany);
     2314                g_string_append_printf(str, "\n%s: %s", _("Division"), info->workdivision);
     2315                g_string_append_printf(str, "\n%s: %s", _("Position"), info->workposition);
     2316                if (info->workwebpage && info->workwebpage[0]) {
     2317                        g_string_append_printf(str, "\n%s: %s", _("Web Page"), info->workwebpage);
     2318                }
     2319                g_string_append_c(str, '\n');
     2320        }
     2321
     2322        imcb_log(ic, "%s\n%s", _("User Info"), str->str);
     2323        g_string_free(str, TRUE);
     2324
     2325        return 1;
    23262326
    23272327}
     
    23852385static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...)
    23862386{
    2387         struct gaim_connection *gc = sess->aux_data;
     2387        struct im_connection *ic = sess->aux_data;
    23882388        va_list ap;
    23892389        aim_userinfo_t *userinfo;
     
    24142414                        idletime.tm_sec = 0;
    24152415                        strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime);
    2416                         serv_got_crap(gc, "%s: %s", _("Idle Time"), buff);
     2416                        imcb_log(ic, "%s: %s", _("Idle Time"), buff);
    24172417                }
    24182418               
    24192419                if(text) {
    24202420                        utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
    2421                         serv_got_crap(gc, "%s\n%s", _("User Info"), utf8);
     2421                        imcb_log(ic, "%s\n%s", _("User Info"), utf8);
    24222422                } else {
    2423                         serv_got_crap(gc, _("No user info available."));
     2423                        imcb_log(ic, _("No user info available."));
    24242424                }
    24252425        } else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) {
    24262426                utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
    2427                 serv_got_crap(gc, "%s\n%s", _("Away Message"), utf8);
     2427                imcb_log(ic, "%s\n%s", _("Away Message"), utf8);
    24282428        }
    24292429
     
    24352435int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...)
    24362436{
    2437         struct gaim_connection * gc = sess->aux_data;
     2437        struct im_connection * ic = sess->aux_data;
    24382438        va_list ap;
    24392439        guint16 type1, type2;
     
    24482448        if(type2 == 0x0002) {
    24492449                /* User is typing */
    2450                 serv_got_typing(gc, sn, 0, 1);
     2450                imcb_buddy_typing(ic, sn, OPT_TYPING);
    24512451        }
    24522452        else if (type2 == 0x0001) {
    24532453                /* User has typed something, but is not actively typing (stale) */
    2454                 serv_got_typing(gc, sn, 0, 2);
     2454                imcb_buddy_typing(ic, sn, OPT_THINKING);
    24552455        }
    24562456        else {
    24572457                /* User has stopped typing */
    2458                 serv_got_typing(gc, sn, 0, 0);
    2459         }       
    2460        
    2461         return 1;
    2462 }
    2463 
    2464 static char *oscar_get_status_string( struct gaim_connection *gc, int number )
     2458                imcb_buddy_typing(ic, sn, 0);
     2459        }
     2460       
     2461        return 1;
     2462}
     2463
     2464int oscar_send_typing(struct im_connection *ic, char * who, int typing)
    24652465{
    2466         struct oscar_data *od = gc->proto_data;
    2467        
    2468         if( ! number & UC_UNAVAILABLE )
    2469         {
    2470                 return( NULL );
    2471         }
    2472         else if( od->icq )
    2473         {
    2474                 number >>= 7;
    2475                 if( number & AIM_ICQ_STATE_DND )
    2476                         return( "Do Not Disturb" );
    2477                 else if( number & AIM_ICQ_STATE_OUT )
    2478                         return( "Not Available" );
    2479                 else if( number & AIM_ICQ_STATE_BUSY )
    2480                         return( "Occupied" );
    2481                 else if( number & AIM_ICQ_STATE_INVISIBLE )
    2482                         return( "Invisible" );
    2483                 else
    2484                         return( "Away" );
    2485         }
    2486         else
    2487         {
    2488                 return( "Away" );
    2489         }
    2490 }
    2491 
    2492 int oscar_send_typing(struct gaim_connection *gc, char * who, int typing)
     2466        struct oscar_data *od = ic->proto_data;
     2467        return( aim_im_sendmtn(od->sess, 1, who, (typing & OPT_TYPING) ? 0x0002 : 0x0000) );
     2468}
     2469
     2470void oscar_chat_msg(struct groupchat *c, char *message, int msgflags)
    24932471{
    2494         struct oscar_data *od = gc->proto_data;
    2495         return( aim_im_sendmtn(od->sess, 1, who, typing ? 0x0002 : 0x0000) );
    2496 }
    2497 
    2498 int oscar_chat_send(struct gaim_connection * gc, int id, char *message)
    2499 {
    2500         struct oscar_data * od = (struct oscar_data*)gc->proto_data;
     2472        struct im_connection *ic = c->ic;
     2473        struct oscar_data * od = (struct oscar_data*)ic->proto_data;
    25012474        struct chat_connection * ccon;
    25022475        int ret;
     
    25052478        char *s;
    25062479       
    2507         if(!(ccon = find_oscar_chat(gc, id)))
    2508                 return -1;
     2480        ccon = c->data;
    25092481               
    25102482        for (s = message; *s; s++)
     
    25402512  }
    25412513 
    2542   return (ret >= 0);
    2543 }
    2544 
    2545 void oscar_chat_invite(struct gaim_connection * gc, int id, char *message, char *who)
     2514/*  return (ret >= 0); */
     2515}
     2516
     2517void oscar_chat_invite(struct groupchat *c, char *who, char *message)
    25462518{
    2547         struct oscar_data * od = (struct oscar_data *)gc->proto_data;
    2548         struct chat_connection *ccon = find_oscar_chat(gc, id);
    2549        
    2550         if (ccon == NULL)
    2551                 return;
     2519        struct im_connection *ic = c->ic;
     2520        struct oscar_data * od = (struct oscar_data *)ic->proto_data;
     2521        struct chat_connection *ccon = c->data;
    25522522       
    25532523        aim_chat_invite(od->sess, od->conn, who, message ? message : "",
     
    25552525}
    25562526
    2557 void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc)
     2527void oscar_chat_kill(struct im_connection *ic, struct chat_connection *cc)
    25582528{
    2559         struct oscar_data *od = (struct oscar_data *)gc->proto_data;
     2529        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    25602530
    25612531        /* Notify the conversation window that we've left the chat */
    2562         serv_got_chat_left(gc, cc->id);
     2532        imcb_chat_free(cc->cnv);
    25632533
    25642534        /* Destroy the chat_connection */
    25652535        od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
    25662536        if (cc->inpa > 0)
    2567                 gaim_input_remove(cc->inpa);
     2537                b_event_remove(cc->inpa);
    25682538        aim_conn_kill(od->sess, &cc->conn);
    25692539        g_free(cc->name);
     
    25722542}
    25732543
    2574 void oscar_chat_leave(struct gaim_connection * gc, int id)
     2544void oscar_chat_leave(struct groupchat *c)
    25752545{
    2576         struct chat_connection * ccon = find_oscar_chat(gc, id);
    2577 
    2578         if(ccon == NULL)
    2579                 return;
    2580 
    2581         oscar_chat_kill(gc, ccon);
    2582 }
    2583 
    2584 int oscar_chat_join(struct gaim_connection * gc, char * name)
     2546        oscar_chat_kill(c->ic, c->data);
     2547}
     2548
     2549struct groupchat *oscar_chat_join(struct im_connection * ic, char * room, char * nick, char * password )
    25852550{
    2586     struct oscar_data * od = (struct oscar_data *)gc->proto_data;
    2587        
     2551        struct oscar_data * od = (struct oscar_data *)ic->proto_data;
    25882552        aim_conn_t * cur;
    25892553
    25902554        if((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) {
    2591        
    2592                 return (aim_chatnav_createroom(od->sess, cur, name, 4) == 0);
    2593        
     2555                int st;
     2556               
     2557                st = aim_chatnav_createroom(od->sess, cur, room, 4);
     2558               
     2559                return NULL;
    25942560        } else {
    25952561                struct create_room * cr = g_new0(struct create_room, 1);
     2562               
    25962563                cr->exchange = 4;
    2597                 cr->name = g_strdup(name);
     2564                cr->name = g_strdup(room);
    25982565                od->create_rooms = g_slist_append(od->create_rooms, cr);
    25992566                aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV);
    2600                 return 1;
    2601         }
    2602 }
    2603 
    2604 int oscar_chat_open(struct gaim_connection * gc, char *who)
     2567               
     2568                return NULL;
     2569        }
     2570}
     2571
     2572struct groupchat *oscar_chat_with(struct im_connection * ic, char *who)
    26052573{
    2606         struct oscar_data * od = (struct oscar_data *)gc->proto_data;
    2607         int ret;
     2574        struct oscar_data * od = (struct oscar_data *)ic->proto_data;
     2575        struct groupchat *ret;
    26082576        static int chat_id = 0;
    26092577        char * chatname;
    26102578       
    2611         chatname = g_strdup_printf("%s%d", gc->username, chat_id++);
     2579        chatname = g_strdup_printf("%s%d", ic->acc->user, chat_id++);
    26122580 
    2613         ret = oscar_chat_join(gc, chatname);
     2581        ret = oscar_chat_join(ic, chatname, NULL, NULL);
    26142582
    26152583        aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0);
     
    26172585        g_free(chatname);
    26182586       
    2619         return ret;
     2587        return NULL;
    26202588}
    26212589
    26222590void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv)
    26232591{
    2624         oscar_chat_join(inv->gc, inv->name);
     2592        oscar_chat_join(inv->ic, inv->name, NULL, NULL);
    26252593        g_free(inv->name);
    26262594        g_free(inv);
     
    26332601}
    26342602
    2635 void oscar_init()
     2603void oscar_initmodule()
    26362604{
    26372605        struct prpl *ret = g_new0(struct prpl, 1);
    26382606        ret->name = "oscar";
    26392607        ret->away_states = oscar_away_states;
     2608        ret->init = oscar_init;
    26402609        ret->login = oscar_login;
    2641         ret->close = oscar_close;
    2642         ret->send_im = oscar_send_im;
     2610        ret->keepalive = oscar_keepalive;
     2611        ret->logout = oscar_logout;
     2612        ret->buddy_msg = oscar_buddy_msg;
    26432613        ret->get_info = oscar_get_info;
    26442614        ret->set_away = oscar_set_away;
     
    26462616        ret->add_buddy = oscar_add_buddy;
    26472617        ret->remove_buddy = oscar_remove_buddy;
    2648         ret->chat_send = oscar_chat_send;
     2618        ret->chat_msg = oscar_chat_msg;
    26492619        ret->chat_invite = oscar_chat_invite;
    26502620        ret->chat_leave = oscar_chat_leave;
    2651         ret->chat_open = oscar_chat_open;
     2621        ret->chat_with = oscar_chat_with;
     2622        ret->chat_join = oscar_chat_join;
    26522623        ret->add_permit = oscar_add_permit;
    26532624        ret->add_deny = oscar_add_deny;
     
    26552626        ret->rem_deny = oscar_rem_deny;
    26562627        ret->set_permit_deny = oscar_set_permit_deny;
    2657         ret->keepalive = oscar_keepalive;
    2658         ret->cmp_buddynames = aim_sncmp;
    2659         ret->get_status_string = oscar_get_status_string;
    26602628        ret->send_typing = oscar_send_typing;
     2629       
     2630        ret->handle_cmp = aim_sncmp;
    26612631
    26622632        register_protocol(ret);
  • protocols/oscar/rxhandlers.c

    r875ad42 r85d7b85  
    112112                /* Following SNAC will be related */
    113113        }
    114 
    115     if (set_getint(sess->aux_data, "debug")) {
    116         serv_got_crap(sess->aux_data, "snac %x/%x received", snac.family, snac.subtype);
    117     }
    118114
    119115        for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) {
  • protocols/oscar/rxqueue.c

    r875ad42 r85d7b85  
    392392                aim_bstream_rewind(&flaphdr);
    393393                start = aimbs_get8(&flaphdr);
    394                 do_error_dialog(sess->aux_data, "FLAP framing disrupted", "Gaim");
     394                imcb_error(sess->aux_data, "FLAP framing disrupted");
    395395                aim_conn_close(conn);
    396396                return -1;
  • protocols/oscar/search.c

    r875ad42 r85d7b85  
    3939        /* XXX the modules interface should have already retrieved this for us */
    4040        if (!(snac2 = aim_remsnac(sess, snac->id))) {
    41                 do_error_dialog(sess->aux_data, "couldn't get snac", "Gaim");
     41                imcb_error(sess->aux_data, "couldn't get snac");
    4242                return 0;
    4343        }
  • protocols/oscar/service.c

    r875ad42 r85d7b85  
    567567                group = aimbs_get16(bs);
    568568
    569                 do_error_dialog(sess->aux_data, "bifurcated migration unsupported", "Gaim");
     569                imcb_error(sess->aux_data, "bifurcated migration unsupported");
    570570        }
    571571
     
    732732        guint32 data;
    733733        int tlvlen;
     734        struct im_connection *ic = sess ? sess->aux_data : NULL;
    734735
    735736        data = AIM_ICQ_STATE_HIDEIP | status; /* yay for error checking ;^) */
     737       
     738        if (ic && set_getbool(&ic->acc->set, "web_aware"))
     739                data |= AIM_ICQ_STATE_WEBAWARE;
    736740
    737741        tlvlen = aim_addtlvtochain32(&tl, 0x0006, data);
     
    890894*/
    891895                } else
    892                         do_error_dialog(sess->aux_data, "WARNING: unknown hash request", "Gaim");
     896                        imcb_error(sess->aux_data, "Warning: unknown hash request");
    893897
    894898        }
  • protocols/oscar/txqueue.c

    r875ad42 r85d7b85  
    3030
    3131        if (!conn) {
    32                 do_error_dialog(sess->aux_data, "no connection specified", "Gaim");
     32                imcb_error(sess->aux_data, "no connection specified");
    3333                return NULL;
    3434        }
     
    4646
    4747        } else
    48                 do_error_dialog(sess->aux_data, "unknown framing", "Gaim");
     48                imcb_error(sess->aux_data, "unknown framing");
    4949
    5050        if (datalen > 0) {
     
    8080
    8181        if (!fr->conn) {
    82                 do_error_dialog(sess->aux_data, "WARNING: enqueueing packet with no connection", "Gaim");
     82                imcb_error(sess->aux_data, "Warning: enqueueing packet with no connection");
    8383                fr->conn = aim_getconn_type(sess, AIM_CONN_TYPE_BOS);
    8484        }
     
    120120
    121121        if (!fr->conn) {
    122                 do_error_dialog(sess->aux_data, "packet has no connection", "Gaim");
     122                imcb_error(sess->aux_data, "packet has no connection");
    123123                aim_frame_destroy(fr);
    124124                return 0;
Note: See TracChangeset for help on using the changeset viewer.