Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/oscar.c

    r0a3c243 r936ded6  
    255255static int msgerrreasonlen = 25;
    256256
    257 static gboolean oscar_callback(gpointer data, gint source,
    258                                 b_input_condition condition) {
     257static void oscar_callback(gpointer data, gint source,
     258                                GaimInputCondition 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 FALSE;
     266                return;
    267267        }
    268268     
     
    270270                /* oh boy. this is probably bad. i guess the only thing we
    271271                 * can really do is return? */
    272                 return FALSE;
     272                return;
    273273        }
    274274
     
    290290                                c->conn = NULL;
    291291                                if (c->inpa > 0)
    292                                         b_event_remove(c->inpa);
     292                                        gaim_input_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                                         b_event_remove(odata->cnpa);
     300                                        gaim_input_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                                         b_event_remove(odata->paspa);
     314                                        gaim_input_remove(odata->paspa);
    315315                                odata->paspa = 0;
    316316                                aim_conn_kill(odata->sess, &conn);
     
    319319                        }
    320320                }
    321         } else {
    322                 /* WTF??? */
    323                 return FALSE;
    324         }
    325                
    326         return TRUE;
    327 }
    328 
    329 static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond)
     321        }
     322}
     323
     324static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond)
    330325{
    331326        struct gaim_connection *gc = data;
     
    336331        if (!g_slist_find(get_connections(), gc)) {
    337332                closesocket(source);
    338                 return FALSE;
     333                return;
    339334        }
    340335
     
    346341                hide_login_progress(gc, _("Couldn't connect to host"));
    347342                signoff(gc);
    348                 return FALSE;
     343                return;
    349344        }
    350345
    351346        aim_conn_completeconnect(sess, conn);
    352         gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
     347        gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ,
    353348                        oscar_callback, conn);
    354        
    355         return FALSE;
    356 }
    357 
    358 static void oscar_login(account_t *acc) {
     349}
     350
     351static void oscar_login(struct aim_user *user) {
    359352        aim_session_t *sess;
    360353        aim_conn_t *conn;
    361354        char buf[256];
    362         struct gaim_connection *gc = new_gaim_conn(acc);
     355        struct gaim_connection *gc = new_gaim_conn(user);
    363356        struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
    364357
    365         if (isdigit(acc->user[0])) {
     358        if (isdigit(*user->username)) {
    366359                odata->icq = TRUE;
    367360                /* This is odd but it's necessary for a proper do_import and do_export.
    368361                   We don't do those anymore, but let's stick with it, just in case
    369                    it accidentally fixes something else too... </bitlbee> */
     362                   it accidentally fixes something else too... */
    370363                gc->password[8] = 0;
    371364        } else {
     
    390383        }
    391384       
    392         if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&
    393             g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) {
    394                 serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
     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]);
    395388        }
    396389       
     
    402395
    403396        conn->status |= AIM_CONN_STATUS_INPROGRESS;
    404         conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc);
     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);
    405402        if (conn->fd < 0) {
    406403                hide_login_progress(gc, _("Couldn't connect to host"));
     
    417414                struct chat_connection *n = odata->oscar_chats->data;
    418415                if (n->inpa > 0)
    419                         b_event_remove(n->inpa);
     416                        gaim_input_remove(n->inpa);
    420417                g_free(n->name);
    421418                g_free(n->show);
     
    436433                g_free(odata->oldp);
    437434        if (gc->inpa > 0)
    438                 b_event_remove(gc->inpa);
     435                gaim_input_remove(gc->inpa);
    439436        if (odata->cnpa > 0)
    440                 b_event_remove(odata->cnpa);
     437                gaim_input_remove(odata->cnpa);
    441438        if (odata->paspa > 0)
    442                 b_event_remove(odata->paspa);
     439                gaim_input_remove(odata->paspa);
    443440        aim_session_kill(odata->sess);
    444441        g_free(odata->sess);
     
    448445}
    449446
    450 static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {
     447static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
    451448        struct gaim_connection *gc = data;
    452449        struct oscar_data *odata;
     
    456453        if (!g_slist_find(get_connections(), gc)) {
    457454                closesocket(source);
    458                 return FALSE;
     455                return;
    459456        }
    460457
     
    466463                hide_login_progress(gc, _("Could Not Connect"));
    467464                signoff(gc);
    468                 return FALSE;
     465                return;
    469466        }
    470467
    471468        aim_conn_completeconnect(sess, bosconn);
    472         gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
     469        gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,
    473470                        oscar_callback, bosconn);
    474471        set_login_progress(gc, 4, _("Connection established, cookie sent"));
    475        
    476         return FALSE;
    477472}
    478473
     
    481476        struct aim_authresp_info *info;
    482477        int i; char *host; int port;
     478        struct aim_user *user;
    483479        aim_conn_t *bosconn;
    484480
    485481        struct gaim_connection *gc = sess->aux_data;
    486482        struct oscar_data *od = gc->proto_data;
    487         port = AIM_LOGIN_PORT;
     483        user = gc->user;
     484        port = user->proto_opt[USEROPT_AUTHPORT][0] ?
     485                atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
    488486
    489487        va_start(ap, fr);
     
    574572        }
    575573        aim_sendcookie(sess, bosconn, info->cookie);
    576         b_event_remove(gc->inpa);
     574        gaim_input_remove(gc->inpa);
    577575
    578576        return 1;
     
    589587};
    590588
    591 static gboolean damn_you(gpointer data, gint source, b_input_condition c)
     589static void damn_you(gpointer data, gint source, GaimInputCondition c)
    592590{
    593591        struct pieceofcrap *pos = data;
     
    609607                do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
    610608                                " You may be disconnected shortly.", "Login Error");
    611                 b_event_remove(pos->inpa);
     609                gaim_input_remove(pos->inpa);
    612610                closesocket(pos->fd);
    613611                g_free(pos);
    614                 return FALSE;
     612                return;
    615613        }
    616614        /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */
    617615        read(pos->fd, m, 16);
    618616        m[16] = '\0';
    619         b_event_remove(pos->inpa);
     617        gaim_input_remove(pos->inpa);
    620618        closesocket(pos->fd);
    621619        aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
    622620        g_free(pos);
    623        
    624         return FALSE;
    625 }
    626 
    627 static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) {
     621}
     622
     623static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) {
    628624        struct pieceofcrap *pos = data;
    629625        char buf[BUF_LONG];
     
    635631                        g_free(pos->modname);
    636632                g_free(pos);
    637                 return FALSE;
     633                return;
    638634        }
    639635
     
    644640        if (pos->modname)
    645641                g_free(pos->modname);
    646         pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
    647         return FALSE;
     642        pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
     643        return;
    648644}
    649645
     
    767763}
    768764
    769 static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {
     765static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {
    770766        struct gaim_connection *gc = data;
    771767        struct oscar_data *odata;
     
    775771        if (!g_slist_find(get_connections(), gc)) {
    776772                closesocket(source);
    777                 return FALSE;
     773                return;
    778774        }
    779775
     
    784780        if (source < 0) {
    785781                aim_conn_kill(sess, &tstconn);
    786                 return FALSE;
     782                return;
    787783        }
    788784
    789785        aim_conn_completeconnect(sess, tstconn);
    790         odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
     786        odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
    791787                                        oscar_callback, tstconn);
    792        
    793         return FALSE;
    794 }
    795 
    796 static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond)
     788}
     789
     790static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond)
    797791{
    798792        struct gaim_connection *gc = data;
     
    803797        if (!g_slist_find(get_connections(), gc)) {
    804798                closesocket(source);
    805                 return FALSE;
     799                return;
    806800        }
    807801
     
    812806        if (source < 0) {
    813807                aim_conn_kill(sess, &tstconn);
    814                 return FALSE;
     808                return;
    815809        }
    816810
    817811        aim_conn_completeconnect(sess, tstconn);
    818         odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
     812        odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
    819813                                oscar_callback, tstconn);
    820        
    821         return FALSE;
    822 }
    823 
    824 static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond)
     814}
     815
     816static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond)
    825817{
    826818        struct chat_connection *ccon = data;
     
    835827                g_free(ccon->name);
    836828                g_free(ccon);
    837                 return FALSE;
     829                return;
    838830        }
    839831
     
    847839                g_free(ccon->name);
    848840                g_free(ccon);
    849                 return FALSE;
     841                return;
    850842        }
    851843
    852844        aim_conn_completeconnect(sess, ccon->conn);
    853         ccon->inpa = b_input_add(tstconn->fd,
     845        ccon->inpa = gaim_input_add(tstconn->fd,
    854846                        GAIM_INPUT_READ,
    855847                        oscar_callback, tstconn);
    856848        odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
    857        
    858         return FALSE;
    859849}
    860850
     
    864854        struct aim_redirect_data *redir;
    865855        struct gaim_connection *gc = sess->aux_data;
     856        struct aim_user *user = gc->user;
    866857        aim_conn_t *tstconn;
    867858        int i;
     
    869860        int port;
    870861
     862        port = user->proto_opt[USEROPT_AUTHPORT][0] ?
     863                atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
     864
    871865        va_start(ap, fr);
    872866        redir = va_arg(ap, struct aim_redirect_data *);
    873867        va_end(ap);
    874868
    875         port = AIM_LOGIN_PORT;
    876869        for (i = 0; i < (int)strlen(redir->ip); i++) {
    877870                if (redir->ip[i] == ':') {
     
    17131706        odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
    17141707
    1715         /* FIXME: It seems we're not really using this, and it broke now that
    1716            struct aim_user is dead.
    17171708        aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps);
    1718         */
    1719        
     1709
    17201710        return 1;
    17211711}
     
    25752565        od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
    25762566        if (cc->inpa > 0)
    2577                 b_event_remove(cc->inpa);
     2567                gaim_input_remove(cc->inpa);
    25782568        aim_conn_kill(od->sess, &cc->conn);
    25792569        g_free(cc->name);
Note: See TracChangeset for help on using the changeset viewer.