Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/oscar.c

    r936ded6 r0a3c243  
    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_login(account_t *acc) {
    352359        aim_session_t *sess;
    353360        aim_conn_t *conn;
    354361        char buf[256];
    355         struct gaim_connection *gc = new_gaim_conn(user);
     362        struct gaim_connection *gc = new_gaim_conn(acc);
    356363        struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
    357364
    358         if (isdigit(*user->username)) {
     365        if (isdigit(acc->user[0])) {
    359366                odata->icq = TRUE;
    360367                /* This is odd but it's necessary for a proper do_import and do_export.
    361368                   We don't do those anymore, but let's stick with it, just in case
    362                    it accidentally fixes something else too... */
     369                   it accidentally fixes something else too... </bitlbee> */
    363370                gc->password[8] = 0;
    364371        } else {
     
    383390        }
    384391       
    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]);
     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);
    388395        }
    389396       
     
    395402
    396403        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);
     404        conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc);
    402405        if (conn->fd < 0) {
    403406                hide_login_progress(gc, _("Couldn't connect to host"));
     
    414417                struct chat_connection *n = odata->oscar_chats->data;
    415418                if (n->inpa > 0)
    416                         gaim_input_remove(n->inpa);
     419                        b_event_remove(n->inpa);
    417420                g_free(n->name);
    418421                g_free(n->show);
     
    433436                g_free(odata->oldp);
    434437        if (gc->inpa > 0)
    435                 gaim_input_remove(gc->inpa);
     438                b_event_remove(gc->inpa);
    436439        if (odata->cnpa > 0)
    437                 gaim_input_remove(odata->cnpa);
     440                b_event_remove(odata->cnpa);
    438441        if (odata->paspa > 0)
    439                 gaim_input_remove(odata->paspa);
     442                b_event_remove(odata->paspa);
    440443        aim_session_kill(odata->sess);
    441444        g_free(odata->sess);
     
    445448}
    446449
    447 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) {
     450static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {
    448451        struct gaim_connection *gc = data;
    449452        struct oscar_data *odata;
     
    453456        if (!g_slist_find(get_connections(), gc)) {
    454457                closesocket(source);
    455                 return;
     458                return FALSE;
    456459        }
    457460
     
    463466                hide_login_progress(gc, _("Could Not Connect"));
    464467                signoff(gc);
    465                 return;
     468                return FALSE;
    466469        }
    467470
    468471        aim_conn_completeconnect(sess, bosconn);
    469         gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ,
     472        gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
    470473                        oscar_callback, bosconn);
    471474        set_login_progress(gc, 4, _("Connection established, cookie sent"));
     475       
     476        return FALSE;
    472477}
    473478
     
    476481        struct aim_authresp_info *info;
    477482        int i; char *host; int port;
    478         struct aim_user *user;
    479483        aim_conn_t *bosconn;
    480484
    481485        struct gaim_connection *gc = sess->aux_data;
    482486        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,
     487        port = AIM_LOGIN_PORT;
    486488
    487489        va_start(ap, fr);
     
    572574        }
    573575        aim_sendcookie(sess, bosconn, info->cookie);
    574         gaim_input_remove(gc->inpa);
     576        b_event_remove(gc->inpa);
    575577
    576578        return 1;
     
    587589};
    588590
    589 static void damn_you(gpointer data, gint source, GaimInputCondition c)
     591static gboolean damn_you(gpointer data, gint source, b_input_condition c)
    590592{
    591593        struct pieceofcrap *pos = data;
     
    607609                do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
    608610                                " You may be disconnected shortly.", "Login Error");
    609                 gaim_input_remove(pos->inpa);
     611                b_event_remove(pos->inpa);
    610612                closesocket(pos->fd);
    611613                g_free(pos);
    612                 return;
     614                return FALSE;
    613615        }
    614616        /* [WvG] Wheeeee! Who needs error checking anyway? ;-) */
    615617        read(pos->fd, m, 16);
    616618        m[16] = '\0';
    617         gaim_input_remove(pos->inpa);
     619        b_event_remove(pos->inpa);
    618620        closesocket(pos->fd);
    619621        aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
    620622        g_free(pos);
    621 }
    622 
    623 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) {
     623       
     624        return FALSE;
     625}
     626
     627static gboolean straight_to_hell(gpointer data, gint source, b_input_condition cond) {
    624628        struct pieceofcrap *pos = data;
    625629        char buf[BUF_LONG];
     
    631635                        g_free(pos->modname);
    632636                g_free(pos);
    633                 return;
     637                return FALSE;
    634638        }
    635639
     
    640644        if (pos->modname)
    641645                g_free(pos->modname);
    642         pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
    643         return;
     646        pos->inpa = b_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos);
     647        return FALSE;
    644648}
    645649
     
    763767}
    764768
    765 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) {
     769static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {
    766770        struct gaim_connection *gc = data;
    767771        struct oscar_data *odata;
     
    771775        if (!g_slist_find(get_connections(), gc)) {
    772776                closesocket(source);
    773                 return;
     777                return FALSE;
    774778        }
    775779
     
    780784        if (source < 0) {
    781785                aim_conn_kill(sess, &tstconn);
    782                 return;
     786                return FALSE;
    783787        }
    784788
    785789        aim_conn_completeconnect(sess, tstconn);
    786         odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
     790        odata->cnpa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    787791                                        oscar_callback, tstconn);
    788 }
    789 
    790 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond)
     792       
     793        return FALSE;
     794}
     795
     796static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond)
    791797{
    792798        struct gaim_connection *gc = data;
     
    797803        if (!g_slist_find(get_connections(), gc)) {
    798804                closesocket(source);
    799                 return;
     805                return FALSE;
    800806        }
    801807
     
    806812        if (source < 0) {
    807813                aim_conn_kill(sess, &tstconn);
    808                 return;
     814                return FALSE;
    809815        }
    810816
    811817        aim_conn_completeconnect(sess, tstconn);
    812         odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ,
     818        odata->paspa = b_input_add(tstconn->fd, GAIM_INPUT_READ,
    813819                                oscar_callback, tstconn);
    814 }
    815 
    816 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond)
     820       
     821        return FALSE;
     822}
     823
     824static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond)
    817825{
    818826        struct chat_connection *ccon = data;
     
    827835                g_free(ccon->name);
    828836                g_free(ccon);
    829                 return;
     837                return FALSE;
    830838        }
    831839
     
    839847                g_free(ccon->name);
    840848                g_free(ccon);
    841                 return;
     849                return FALSE;
    842850        }
    843851
    844852        aim_conn_completeconnect(sess, ccon->conn);
    845         ccon->inpa = gaim_input_add(tstconn->fd,
     853        ccon->inpa = b_input_add(tstconn->fd,
    846854                        GAIM_INPUT_READ,
    847855                        oscar_callback, tstconn);
    848856        odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
     857       
     858        return FALSE;
    849859}
    850860
     
    854864        struct aim_redirect_data *redir;
    855865        struct gaim_connection *gc = sess->aux_data;
    856         struct aim_user *user = gc->user;
    857866        aim_conn_t *tstconn;
    858867        int i;
     
    860869        int port;
    861870
    862         port = user->proto_opt[USEROPT_AUTHPORT][0] ?
    863                 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
    864 
    865871        va_start(ap, fr);
    866872        redir = va_arg(ap, struct aim_redirect_data *);
    867873        va_end(ap);
    868874
     875        port = AIM_LOGIN_PORT;
    869876        for (i = 0; i < (int)strlen(redir->ip); i++) {
    870877                if (redir->ip[i] == ':') {
     
    17061713        odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
    17071714
     1715        /* FIXME: It seems we're not really using this, and it broke now that
     1716           struct aim_user is dead.
    17081717        aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps);
    1709 
     1718        */
     1719       
    17101720        return 1;
    17111721}
     
    25652575        od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
    25662576        if (cc->inpa > 0)
    2567                 gaim_input_remove(cc->inpa);
     2577                b_event_remove(cc->inpa);
    25682578        aim_conn_kill(od->sess, &cc->conn);
    25692579        g_free(cc->name);
Note: See TracChangeset for help on using the changeset viewer.