Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    r75cde5d r0a3c243  
    471471}
    472472
    473 static void jabber_callback(gpointer data, gint source, GaimInputCondition condition)
     473static gboolean jabber_callback(gpointer data, gint source, b_input_condition condition)
    474474{
    475475        struct gaim_connection *gc = (struct gaim_connection *)data;
     
    477477
    478478        gjab_recv(jd->gjc);
     479       
     480        return TRUE;
    479481}
    480482
     
    487489}
    488490
    489 static void gjab_connected(gpointer data, gint source, GaimInputCondition cond)
     491static gboolean gjab_connected(gpointer data, gint source, b_input_condition cond)
    490492{
    491493        xmlnode x;
     
    497499        if (!g_slist_find(get_connections(), gc)) {
    498500                closesocket(source);
    499                 return;
     501                return FALSE;
    500502        }
    501503
     
    508510        if (source == -1) {
    509511                STATE_EVT(JCONN_STATE_OFF)
    510                 return;
     512                return FALSE;
    511513        }
    512514
     
    530532
    531533        gc = GJ_GC(gjc);
    532         gc->inpa = gaim_input_add(gjc->fd, GAIM_INPUT_READ, jabber_callback, gc);
    533 }
    534 
    535 static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition cond)
     534        gc->inpa = b_input_add(gjc->fd, GAIM_INPUT_READ, jabber_callback, gc);
     535       
     536        return FALSE;
     537}
     538
     539static gboolean gjab_connected_ssl(gpointer data, void *source, b_input_condition cond)
    536540{
    537541        struct gaim_connection *gc = data;
     
    544548        if (source == NULL) {
    545549                STATE_EVT(JCONN_STATE_OFF)
    546                 return;
     550                return FALSE;
    547551        }
    548552       
    549553        if (!g_slist_find(get_connections(), gc)) {
    550554                ssl_disconnect(source);
    551                 return;
     555                return FALSE;
    552556        }
    553557       
    554         gjab_connected(data, gjc->fd, cond);
     558        return gjab_connected(data, gjc->fd, cond);
    555559}
    556560
    557561static void gjab_start(gjconn gjc)
    558562{
    559         struct aim_user *user;
     563        account_t *acc;
    560564        int port = -1, ssl = 0;
    561565        char *server = NULL, *s;
     
    564568                return;
    565569
    566         user = GJ_GC(gjc)->user;
    567         if (*user->proto_opt[0]) {
     570        acc = GJ_GC(gjc)->acc;
     571        if (acc->server) {
    568572                /* If there's a dot, assume there's a hostname in the beginning */
    569                 if (strchr(user->proto_opt[0], '.')) {
    570                         server = g_strdup(user->proto_opt[0]);
     573                if (strchr(acc->server, '.')) {
     574                        server = g_strdup(acc->server);
    571575                        if ((s = strchr(server, ':')))
    572576                                *s = 0;
     
    574578               
    575579                /* After the hostname, there can be a port number */
    576                 s = strchr(user->proto_opt[0], ':');
     580                s = strchr(acc->server, ':');
    577581                if (s && isdigit(s[1]))
    578582                        sscanf(s + 1, "%d", &port);
    579583               
    580584                /* And if there's the string ssl, the user wants an SSL-connection */
    581                 if (strstr(user->proto_opt[0], ":ssl") || g_strcasecmp(user->proto_opt[0], "ssl") == 0)
     585                if (strstr(acc->server, ":ssl") || g_strcasecmp(acc->server, "ssl") == 0)
    582586                        ssl = 1;
    583587        }
     
    612616        g_free(server);
    613617       
    614         if (!user->gc || (gjc->fd < 0)) {
     618        if (!acc->gc || (gjc->fd < 0)) {
    615619                STATE_EVT(JCONN_STATE_OFF)
    616620                return;
     
    15121516}
    15131517
    1514 static void jabber_login(struct aim_user *user)
    1515 {
    1516         struct gaim_connection *gc = new_gaim_conn(user);
     1518static void jabber_login(account_t *acc)
     1519{
     1520        struct gaim_connection *gc = new_gaim_conn(acc);
    15171521        struct jabber_data *jd = gc->proto_data = g_new0(struct jabber_data, 1);
    1518         char *loginname = create_valid_jid(user->username, DEFAULT_SERVER, "BitlBee");
     1522        char *loginname = create_valid_jid(acc->user, DEFAULT_SERVER, "BitlBee");
    15191523
    15201524        jd->hash = g_hash_table_new(g_str_hash, g_str_equal);
     
    15231527        set_login_progress(gc, 1, _("Connecting"));
    15241528
    1525         if (!(jd->gjc = gjab_new(loginname, user->password, gc))) {
     1529        if (!(jd->gjc = gjab_new(loginname, acc->pass, gc))) {
    15261530                g_free(loginname);
    15271531                hide_login_progress(gc, _("Unable to connect"));
     
    15431547}
    15441548
    1545 static gboolean jabber_free(gpointer data)
     1549static gboolean jabber_free(gpointer data, gint fd, b_input_condition cond)
    15461550{
    15471551        struct jabber_data *jd = data;
     
    15881592        }
    15891593        if (gc->inpa)
    1590                 gaim_input_remove(gc->inpa);
     1594                b_event_remove(gc->inpa);
    15911595
    15921596        if(jd) {
    1593                 g_timeout_add(50, jabber_free, jd);
     1597                b_timeout_add(50, jabber_free, jd);
    15941598                if(jd->gjc != NULL)
    15951599                        xmlnode_free(jd->gjc->current);
Note: See TracChangeset for help on using the changeset viewer.