Ignore:
Timestamp:
2006-12-05T20:40:17Z (17 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
7740c4c
Parents:
f4aa393 (diff), 55078f5 (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] wilmer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/oscar.c

    rf4aa393 rd8d63a2  
    356356}
    357357
    358 static void oscar_login(struct aim_user *user) {
     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) {
    359372        aim_session_t *sess;
    360373        aim_conn_t *conn;
    361374        char buf[256];
    362         struct gaim_connection *gc = new_gaim_conn(user);
     375        struct gaim_connection *gc = new_gaim_conn(acc);
    363376        struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
    364377
    365         if (isdigit(*user->username)) {
     378        if (isdigit(acc->user[0])) {
    366379                odata->icq = TRUE;
    367380                /* This is odd but it's necessary for a proper do_import and do_export.
    368381                   We don't do those anymore, but let's stick with it, just in case
    369                    it accidentally fixes something else too... */
     382                   it accidentally fixes something else too... </bitlbee> */
    370383                gc->password[8] = 0;
    371384        } else {
     
    390403        }
    391404       
    392         if (g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.icq.com") != 0 &&
    393             g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.oscar.aol.com") != 0) {
    394                 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);
    395414        }
    396415       
     
    402421
    403422        conn->status |= AIM_CONN_STATUS_INPROGRESS;
    404         conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ?
    405                                         user->proto_opt[USEROPT_AUTH] : AIM_DEFAULT_LOGIN_SERVER,
    406                                  user->proto_opt[USEROPT_AUTHPORT][0] ?
    407                                         atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
    408                                  oscar_login_connect, gc);
     423        conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc);
    409424        if (conn->fd < 0) {
    410425                hide_login_progress(gc, _("Couldn't connect to host"));
     
    485500        struct aim_authresp_info *info;
    486501        int i; char *host; int port;
    487         struct aim_user *user;
    488502        aim_conn_t *bosconn;
    489503
    490504        struct gaim_connection *gc = sess->aux_data;
    491505        struct oscar_data *od = gc->proto_data;
    492         user = gc->user;
    493         port = user->proto_opt[USEROPT_AUTHPORT][0] ?
    494                 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
     506        port = AIM_LOGIN_PORT;
    495507
    496508        va_start(ap, fr);
     
    871883        struct aim_redirect_data *redir;
    872884        struct gaim_connection *gc = sess->aux_data;
    873         struct aim_user *user = gc->user;
    874885        aim_conn_t *tstconn;
    875886        int i;
     
    877888        int port;
    878889
    879         port = user->proto_opt[USEROPT_AUTHPORT][0] ?
    880                 atoi(user->proto_opt[USEROPT_AUTHPORT]) : AIM_LOGIN_PORT,
    881 
    882890        va_start(ap, fr);
    883891        redir = va_arg(ap, struct aim_redirect_data *);
    884892        va_end(ap);
    885893
     894        port = AIM_LOGIN_PORT;
    886895        for (i = 0; i < (int)strlen(redir->ip); i++) {
    887896                if (redir->ip[i] == ':') {
     
    12421251        channel = va_arg(ap, int);
    12431252        userinfo = va_arg(ap, aim_userinfo_t *);
    1244 
    1245     if (set_getint(sess->aux_data, "debug")) {
    1246         serv_got_crap(sess->aux_data, "channel %i called", channel);
    1247     }
    12481253
    12491254        switch (channel) {
     
    17231728        odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
    17241729
     1730        /* FIXME: It seems we're not really using this, and it broke now that
     1731           struct aim_user is dead.
    17251732        aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps);
    1726 
     1733        */
     1734       
    17271735        return 1;
    17281736}
     
    22892297        }
    22902298        info_string_append(str, "\n", _("Mobile Phone"), info->mobile);
    2291         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"));
    22922300        if (info->birthyear || info->birthmonth || info->birthday) {
    22932301                char date[30];
     
    26562664        ret->away_states = oscar_away_states;
    26572665        ret->login = oscar_login;
     2666        ret->acc_init = oscar_acc_init;
    26582667        ret->close = oscar_close;
    26592668        ret->send_im = oscar_send_im;
     
    26732682        ret->set_permit_deny = oscar_set_permit_deny;
    26742683        ret->keepalive = oscar_keepalive;
    2675         ret->cmp_buddynames = aim_sncmp;
    26762684        ret->get_status_string = oscar_get_status_string;
    26772685        ret->send_typing = oscar_send_typing;
     2686       
     2687        ret->handle_cmp = aim_sncmp;
    26782688
    26792689        register_protocol(ret);
Note: See TracChangeset for help on using the changeset viewer.