Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/oscar.c

    r936ded6 r91bd910  
    255255static int msgerrreasonlen = 25;
    256256
    257 static void oscar_callback(gpointer data, gint source,
    258                                 GaimInputCondition condition) {
     257static gboolean oscar_callback(gpointer data, gint source,
     258                                b_input_condition condition) {
    259259        aim_conn_t *conn = (aim_conn_t *)data;
    260260        aim_session_t *sess = aim_conn_getsess(conn);
     
    264264        if (!gc) {
    265265                /* gc is null. we return, else we seg SIGSEG on next line. */
    266                 return;
     266                return FALSE;
    267267        }
    268268     
     
    270270                /* oh boy. this is probably bad. i guess the only thing we
    271271                 * can really do is return? */
    272                 return;
     272                return FALSE;
    273273        }
    274274
     
    290290                                c->conn = NULL;
    291291                                if (c->inpa > 0)
    292                                         gaim_input_remove(c->inpa);
     292                                        b_event_remove(c->inpa);
    293293                                c->inpa = 0;
    294294                                c->fd = -1;
     
    298298                        } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
    299299                                if (odata->cnpa > 0)
    300                                         gaim_input_remove(odata->cnpa);
     300                                        b_event_remove(odata->cnpa);
    301301                                odata->cnpa = 0;
    302302                                while (odata->create_rooms) {
     
    312312                        } else if (conn->type == AIM_CONN_TYPE_AUTH) {
    313313                                if (odata->paspa > 0)
    314                                         gaim_input_remove(odata->paspa);
     314                                        b_event_remove(odata->paspa);
    315315                                odata->paspa = 0;
    316316                                aim_conn_kill(odata->sess, &conn);
     
    319319                        }
    320320                }
    321         }
    322 }
    323 
    324 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond)
     321        } else {
     322                /* WTF??? */
     323                return FALSE;
     324        }
     325               
     326        return TRUE;
     327}
     328
     329static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond)
    325330{
    326331        struct gaim_connection *gc = data;
     
    331336        if (!g_slist_find(get_connections(), gc)) {
    332337                closesocket(source);
    333                 return;
     338                return FALSE;
    334339        }
    335340
     
    341346                hide_login_progress(gc, _("Couldn't connect to host"));
    342347                signoff(gc);
    343                 return;
     348                return FALSE;
    344349        }
    345350
    346351        aim_conn_completeconnect(sess, conn);
    347         gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ,
     352        gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
    348353                        oscar_callback, conn);
    349 }
    350 
    351 static void oscar_login(struct aim_user *user) {
     354       
     355        return FALSE;
     356}
     357
     358static void oscar_acc_init(account_t *acc)
     359{
     360        set_t *s;
     361       
     362        s = set_add( &acc->set, "server", NULL, set_eval_account, acc );
     363        s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
     364       
     365        if (isdigit(acc->user[0])) {
     366                s = set_add( &acc->set, "web_aware", "false", set_eval_bool, acc );
     367                s->flags |= ACC_SET_OFFLINE_ONLY;
     368        }
     369}
     370
     371static void oscar_login(account_t *acc) {
    352372        aim_session_t *sess;
    353373        aim_conn_t *conn;
    354374        char buf[256];
    355         struct gaim_connection *gc = new_gaim_conn(user);
     375        struct gaim_connection *gc = new_gaim_conn(acc);
    356376        struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
    357377
    358         if (isdigit(*user->username)) {
     378        if (isdigit(acc->user[0])) {
    359379                odata->icq = TRUE;
    360380                /* This is odd but it's necessary for a proper do_import and do_export.
    361381                   We don't do those anymore, but let's stick with it, just in case
    362                    it accidentally fixes something else too... */
     382                   it accidentally fixes something else too... </bitlbee> */
    363383                gc->password[8] = 0;
    364384        } else {
     
    383403        }
    384404       
    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]);
     405        if (acc->server == NULL) {
     406                hide_login_progress(gc, "No servername specified");
     407                signoff(gc);
     408                return;
     409        }
     410       
     411        if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&
     412            g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) {
     413                serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
    388414        }
    389415       
     
    395421
    396422        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);
     423        conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc);
    402424        if (conn->fd < 0) {
    403425                hide_login_progress(gc, _("Couldn't connect to host"));
     
    414436                struct chat_connection *n = odata->oscar_chats->data;
    415437                if (n->inpa > 0)
    416                         gaim_input_remove(n->inpa);
     438                        b_event_remove(n->inpa);
    417439                g_free(n->name);
    418440                g_free(n->show);
     
    433455                g_free(odata->oldp);
    434456        if (gc->inpa > 0)
    435                 gaim_input_remove(gc->inpa);
     457                b_event_remove(gc->inpa);
    436458        if (odata->cnpa > 0)
    437                 gaim_input_remove(odata->cnpa);
     459                b_event_remove(odata->cnpa);
    438460        if (odata->paspa > 0)
    439                 gaim_input_remove(odata->paspa);
     461                b_event_remove(odata->paspa);
    440462        aim_session_kill(odata->sess);
    441463        g_free(odata->sess);
     
    445467}
    446468
    447 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
     469static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {
    448470        struct gaim_connection *gc = data;
    449471        struct oscar_data *odata;
     
    453475        if (!g_slist_find(get_connections(), gc)) {
    454476                closesocket(source);
    455                 return;
     477                return FALSE;
    456478        }
    457479
     
    463485                hide_login_progress(gc, _("Could Not Connect"));
    464486                signoff(gc);
    465                 return;
     487                return FALSE;
    466488        }
    467489
    468490        aim_conn_completeconnect(sess, bosconn);
    469         gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,
     491        gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
    470492                        oscar_callback, bosconn);
    471493        set_login_progress(gc, 4, _("Connection established, cookie sent"));
     494       
     495        return FALSE;
    472496}
    473497
     
    476500        struct aim_authresp_info *info;
    477501        int i; char *host; int port;
    478         struct aim_user *user;
    479502        aim_conn_t *bosconn;
    480503
    481504        struct gaim_connection *gc = sess->aux_data;
    482505        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,
     506        port = AIM_LOGIN_PORT;
    486507
    487508        va_start(ap, fr);
     
    572593        }
    573594        aim_sendcookie(sess, bosconn, info->cookie);
    574         gaim_input_remove(gc->inpa);
     595        b_event_remove(gc->inpa);
    575596
    576597        return 1;
     
    587608};
    588609
    589 static void damn_you(gpointer data, gint source, GaimInputCondition c)
     610static gboolean damn_you(gpointer data, gint source, b_input_condition c)
    590611{
    591612        struct pieceofcrap *pos = data;
     
    607628                do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
    608629                                " You may be disconnected shortly.", "Login Error");
    609                 gaim_input_remove(pos->inpa);
     630                b_event_remove(pos->inpa);
    610631                closesocket(pos->fd);
    611632                g_free(pos);
    612                 return;
     633                return FALSE;
    613634        }
    614635        /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */
    615636        read(pos->fd, m, 16);
    616637        m[16] = '\0';
    617         gaim_input_remove(pos->inpa);
     638        b_event_remove(pos->inpa);
    618639        closesocket(pos->fd);
    619640        aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
    620641        g_free(pos);
    621 }
    622 
    623 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) {
     642       
     643        return FALSE;
     644}
     645
     646static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) {
    624647        struct pieceofcrap *pos = data;
    625648        char buf[BUF_LONG];
     
    631654                        g_free(pos->modname);
    632655                g_free(pos);
    633                 return;
     656                return FALSE;
    634657        }
    635658
     
    640663        if (pos->modname)
    641664                g_free(pos->modname);
    642         pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
    643         return;
     665        pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
     666        return FALSE;
    644667}
    645668
     
    763786}
    764787
    765 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {
     788static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {
    766789        struct gaim_connection *gc = data;
    767790        struct oscar_data *odata;
     
    771794        if (!g_slist_find(get_connections(), gc)) {
    772795                closesocket(source);
    773                 return;
     796                return FALSE;
    774797        }
    775798
     
    780803        if (source < 0) {
    781804                aim_conn_kill(sess, &tstconn);
    782                 return;
     805                return FALSE;
    783806        }
    784807
    785808        aim_conn_completeconnect(sess, tstconn);
    786         odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
     809        odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    787810                                        oscar_callback, tstconn);
    788 }
    789 
    790 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond)
     811       
     812        return FALSE;
     813}
     814
     815static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond)
    791816{
    792817        struct gaim_connection *gc = data;
     
    797822        if (!g_slist_find(get_connections(), gc)) {
    798823                closesocket(source);
    799                 return;
     824                return FALSE;
    800825        }
    801826
     
    806831        if (source < 0) {
    807832                aim_conn_kill(sess, &tstconn);
    808                 return;
     833                return FALSE;
    809834        }
    810835
    811836        aim_conn_completeconnect(sess, tstconn);
    812         odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
     837        odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    813838                                oscar_callback, tstconn);
    814 }
    815 
    816 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond)
     839       
     840        return FALSE;
     841}
     842
     843static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond)
    817844{
    818845        struct chat_connection *ccon = data;
     
    827854                g_free(ccon->name);
    828855                g_free(ccon);
    829                 return;
     856                return FALSE;
    830857        }
    831858
     
    839866                g_free(ccon->name);
    840867                g_free(ccon);
    841                 return;
     868                return FALSE;
    842869        }
    843870
    844871        aim_conn_completeconnect(sess, ccon->conn);
    845         ccon->inpa = gaim_input_add(tstconn->fd,
     872        ccon->inpa = b_input_add(tstconn->fd,
    846873                        GAIM_INPUT_READ,
    847874                        oscar_callback, tstconn);
    848875        odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
     876       
     877        return FALSE;
    849878}
    850879
     
    854883        struct aim_redirect_data *redir;
    855884        struct gaim_connection *gc = sess->aux_data;
    856         struct aim_user *user = gc->user;
    857885        aim_conn_t *tstconn;
    858886        int i;
     
    860888        int port;
    861889
    862         port = user->proto_opt[USEROPT_AUTHPORT][0] ?
    863                 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
    864 
    865890        va_start(ap, fr);
    866891        redir = va_arg(ap, struct aim_redirect_data *);
    867892        va_end(ap);
    868893
     894        port = AIM_LOGIN_PORT;
    869895        for (i = 0; i < (int)strlen(redir->ip); i++) {
    870896                if (redir->ip[i] == ':') {
     
    12251251        channel = va_arg(ap, int);
    12261252        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     }
    12311253
    12321254        switch (channel) {
     
    17061728        odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
    17071729
     1730        /* FIXME: It seems we're not really using this, and it broke now that
     1731           struct aim_user is dead.
    17081732        aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps);
    1709 
     1733        */
     1734       
    17101735        return 1;
    17111736}
     
    22722297        }
    22732298        info_string_append(str, "\n", _("Mobile Phone"), info->mobile);
    2274         info_string_append(str, "\n", _("Gender"), info->gender==1 ? _("Female") : _("Male"));
     2299        info_string_append(str, "\n", _("Gender"), info->gender==1 ? _("Female") : info->gender==2 ? _("Male") : _("Unknown"));
    22752300        if (info->birthyear || info->birthmonth || info->birthday) {
    22762301                char date[30];
     
    25652590        od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
    25662591        if (cc->inpa > 0)
    2567                 gaim_input_remove(cc->inpa);
     2592                b_event_remove(cc->inpa);
    25682593        aim_conn_kill(od->sess, &cc->conn);
    25692594        g_free(cc->name);
     
    26392664        ret->away_states = oscar_away_states;
    26402665        ret->login = oscar_login;
     2666        ret->acc_init = oscar_acc_init;
    26412667        ret->close = oscar_close;
    26422668        ret->send_im = oscar_send_im;
     
    26562682        ret->set_permit_deny = oscar_set_permit_deny;
    26572683        ret->keepalive = oscar_keepalive;
    2658         ret->cmp_buddynames = aim_sncmp;
    26592684        ret->get_status_string = oscar_get_status_string;
    26602685        ret->send_typing = oscar_send_typing;
     2686       
     2687        ret->handle_cmp = aim_sncmp;
    26612688
    26622689        register_protocol(ret);
Note: See TracChangeset for help on using the changeset viewer.