Changeset aef4828 for protocols/oscar


Ignore:
Timestamp:
2007-04-06T05:20:31Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
552e641
Parents:
0da65d5
Message:

More cleanups, mainly in the callbacks. Replaced things like
do_error_dialog() and (set|hide)_login_progress(_error)?() with things
that hopefully make more sense.

Although it's still not really great...

Location:
protocols/oscar
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/chat.c

    r0da65d5 raef4828  
    5454                        continue;
    5555                if (!cur->priv) {
    56                         do_error_dialog(sess->aux_data, "chat connection with no name!", "Gaim");
     56                        imc_error(sess->aux_data, "chat connection with no name!");
    5757                        continue;
    5858                }
     
    397397
    398398        if (detaillevel != 0x02) {
    399                 do_error_dialog(sess->aux_data, "Only detaillevel 0x2 is support at the moment", "Gaim");
     399                imc_error(sess->aux_data, "Only detaillevel 0x2 is support at the moment");
    400400                return 1;
    401401        }
     
    615615
    616616        if (channel != 0x0003) {
    617                 do_error_dialog(sess->aux_data, "unknown channel!", "Gaim");
     617                imc_error(sess->aux_data, "unknown channel!");
    618618                return 0;
    619619        }
  • protocols/oscar/chatnav.c

    r0da65d5 raef4828  
    286286
    287287        if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) {
    288                 do_error_dialog(sess->aux_data, "no bigblock in top tlv in create room response", "Gaim");
     288                imc_error(sess->aux_data, "no bigblock in top tlv in create room response");
    289289       
    290290                aim_freetlvchain(&tlvlist);
     
    301301
    302302        if (detaillevel != 0x02) {
    303                 do_error_dialog(sess->aux_data, "unknown detaillevel in create room response", "Gaim");
     303                imc_error(sess->aux_data, "unknown detaillevel in create room response");
    304304                aim_freetlvchain(&tlvlist);
    305305                g_free(ck);
     
    367367
    368368        if (!(snac2 = aim_remsnac(sess, snac->id))) {
    369                 do_error_dialog(sess->aux_data, "received response to unknown request!", "Gaim");
     369                imc_error(sess->aux_data, "received response to unknown request!");
    370370                return 0;
    371371        }
    372372
    373373        if (snac2->family != 0x000d) {
    374                 do_error_dialog(sess->aux_data, "recieved response that maps to corrupt request!", "Gaim");
     374                imc_error(sess->aux_data, "recieved response that maps to corrupt request!");
    375375                return 0;
    376376        }
     
    389389                ret = parseinfo_create(sess, mod, rx, snac, bs, snac2);
    390390        else
    391                 do_error_dialog(sess->aux_data, "unknown request subtype", "Gaim");
     391                imc_error(sess->aux_data, "unknown request subtype");
    392392
    393393        if (snac2)
  • protocols/oscar/icq.c

    r0da65d5 raef4828  
    240240        if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) {
    241241                aim_freetlvchain(&tl);
    242                 do_error_dialog(sess->aux_data, "corrupt ICQ response\n", "Gaim");
     242                imc_error(sess->aux_data, "corrupt ICQ response\n");
    243243                return 0;
    244244        }
  • protocols/oscar/im.c

    r0da65d5 raef4828  
    937937
    938938        if (channel != 0x01) {
    939                 do_error_dialog(sess->aux_data, "icbm: ICBM recieved on unsupported channel.  Ignoring.", "Gaim");
     939                imc_error(sess->aux_data, "icbm: ICBM recieved on unsupported channel.  Ignoring.");
    940940                return 0;
    941941        }
     
    13451345
    13461346                } else {
    1347                         // do_error_dialog(sess->aux_data, "Unknown TLV encountered", "Gaim");
     1347                        // imc_error(sess->aux_data, "Unknown TLV encountered");
    13481348                }
    13491349
     
    15171517        cookie2 = aimbs_getraw(&bbs, 8);
    15181518        if (memcmp(cookie, cookie2, 8) != 0)
    1519                 do_error_dialog(sess->aux_data, "rend: warning cookies don't match!", "Gaim");
     1519                imc_error(sess->aux_data, "rend: warning cookies don't match!");
    15201520        memcpy(args.cookie, cookie2, 8);
    15211521        g_free(cookie2);
     
    17831783        } else {
    17841784
    1785                 do_error_dialog(sess->aux_data, "ICBM received on an unsupported channel.  Ignoring.", "Gaim");
     1785                imc_error(sess->aux_data, "ICBM received on an unsupported channel.  Ignoring.");
    17861786
    17871787                return 0;
  • protocols/oscar/info.c

    r0da65d5 raef4828  
    474474                         */
    475475#ifdef DEBUG
    476                         // do_error_dialog(sess->aux_data, G_STRLOC, "Unknown TLV encountered");
     476                        // imc_error(sess->aux_data, G_STRLOC);
    477477#endif
    478478
     
    635635
    636636        if (!origsnac || !origsnac->data) {
    637                 do_error_dialog(sess->aux_data, "major problem: no snac stored!", "Gaim");
     637                imc_error(sess->aux_data, "major problem: no snac stored!");
    638638                return 0;
    639639        }
     
    644644                        (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) &&
    645645                        (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) {
    646                 do_error_dialog(sess->aux_data, "unknown infotype in request!", "Gaim");
     646                imc_error(sess->aux_data, "unknown infotype in request!");
    647647                return 0;
    648648        }
  • protocols/oscar/oscar.c

    r0da65d5 raef4828  
    263263                        aim_rxdispatch(odata->sess);
    264264                               if (odata->killme)
    265                                        signoff(ic);
     265                                       imc_logout(ic);
    266266                } else {
    267267                        if ((conn->type == AIM_CONN_TYPE_BOS) ||
    268268                                   !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
    269                                 hide_login_progress_error(ic, _("Disconnected."));
    270                                 signoff(ic);
     269                                imc_error(ic, _("Disconnected."));
     270                                imc_logout(ic);
    271271                        } else if (conn->type == AIM_CONN_TYPE_CHAT) {
    272272                                struct chat_connection *c = find_oscar_chat_by_conn(ic, conn);
    273                                 char buf[BUF_LONG];
    274273                                c->conn = NULL;
    275274                                if (c->inpa > 0)
     
    278277                                c->fd = -1;
    279278                                aim_conn_kill(odata->sess, &conn);
    280                                 sprintf(buf, _("You have been disconnected from chat room %s."), c->name);
    281                                 do_error_dialog(sess->aux_data, buf, _("Chat Error!"));
     279                                imc_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name);
    282280                        } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
    283281                                if (odata->cnpa > 0)
     
    290288                                                g_slist_remove(odata->create_rooms, cr);
    291289                                        g_free(cr);
    292                                         do_error_dialog(sess->aux_data, _("Chat is currently unavailable"),
    293                                                         _("Gaim - Chat"));
     290                                        imc_error(sess->aux_data, _("Chat is currently unavailable"));
    294291                                }
    295292                                aim_conn_kill(odata->sess, &conn);
     
    328325
    329326        if (source < 0) {
    330                 hide_login_progress(ic, _("Couldn't connect to host"));
    331                 signoff(ic);
     327                imc_error(ic, _("Couldn't connect to host"));
     328                imc_logout(ic);
    332329                return FALSE;
    333330        }
     
    356353        aim_session_t *sess;
    357354        aim_conn_t *conn;
    358         char buf[256];
    359         struct im_connection *ic = new_gaim_conn(acc);
     355        struct im_connection *ic = imc_new(acc);
    360356        struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1);
    361357
     
    382378        conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
    383379        if (conn == NULL) {
    384                 hide_login_progress(ic, _("Unable to login to AIM"));
    385                 signoff(ic);
     380                imc_error(ic, _("Unable to login to AIM"));
     381                imc_logout(ic);
    386382                return;
    387383        }
    388384       
    389385        if (acc->server == NULL) {
    390                 hide_login_progress(ic, "No servername specified");
    391                 signoff(ic);
     386                imc_error(ic, "No servername specified");
     387                imc_logout(ic);
    392388                return;
    393389        }
     
    395391        if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&
    396392            g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) {
    397                 serv_got_crap(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
    398         }
    399        
    400         g_snprintf(buf, sizeof(buf), _("Signon: %s"), ic->username);
    401         set_login_progress(ic, 2, buf);
     393                imc_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
     394        }
     395       
     396        imc_log(ic, _("Signon: %s"), ic->username);
    402397
    403398        aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
     
    407402        conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic);
    408403        if (conn->fd < 0) {
    409                 hide_login_progress(ic, _("Couldn't connect to host"));
    410                 signoff(ic);
     404                imc_error(ic, _("Couldn't connect to host"));
     405                imc_logout(ic);
    411406                return;
    412407        }
     
    467462
    468463        if (source < 0) {
    469                 hide_login_progress(ic, _("Could Not Connect"));
    470                 signoff(ic);
     464                imc_error(ic, _("Could Not Connect"));
     465                imc_logout(ic);
    471466                return FALSE;
    472467        }
     
    475470        ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
    476471                        oscar_callback, bosconn);
    477         set_login_progress(ic, 4, _("Connection established, cookie sent"));
     472        imc_log(ic, _("Connection established, cookie sent"));
    478473       
    479474        return FALSE;
     
    498493                case 0x05:
    499494                        /* Incorrect nick/password */
    500                         hide_login_progress(ic, _("Incorrect nickname or password."));
     495                        imc_error(ic, _("Incorrect nickname or password."));
    501496//                      plugin_event(event_error, (void *)980, 0, 0, 0);
    502497                        break;
    503498                case 0x11:
    504499                        /* Suspended account */
    505                         hide_login_progress(ic, _("Your account is currently suspended."));
     500                        imc_error(ic, _("Your account is currently suspended."));
    506501                        break;
    507502                case 0x18:
    508503                        /* connecting too frequently */
    509                         hide_login_progress(ic, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
     504                        imc_error(ic, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
    510505                        break;
    511506                case 0x1c:
    512507                        /* client too old */
    513                         hide_login_progress(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));
     508                        imc_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));
    514509                        break;
    515510                default:
    516                         hide_login_progress(ic, _("Authentication Failed"));
     511                        imc_error(ic, _("Authentication Failed"));
    517512                        break;
    518513                }
     
    526521        bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
    527522        if (bosconn == NULL) {
    528                 hide_login_progress(ic, _("Internal Error"));
     523                imc_error(ic, _("Internal Error"));
    529524                od->killme = TRUE;
    530525                return 0;
     
    572567        g_free(host);
    573568        if (bosconn->fd < 0) {
    574                 hide_login_progress(ic, _("Could Not Connect"));
     569                imc_error(ic, _("Could Not Connect"));
    575570                od->killme = TRUE;
    576571                return 0;
     
    610605        }
    611606        if (in != '\n') {
    612                 do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
    613                                 " You may be disconnected shortly.", "Login Error");
     607                imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
     608                                " You may be disconnected shortly.");
    614609                b_event_remove(pos->inpa);
    615610                closesocket(pos->fd);
     
    633628
    634629        if (source < 0) {
    635                 do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
    636                                 " You may be disconnected shortly.", "Login Error");
     630                imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
     631                                " You may be disconnected shortly.");
    637632                if (pos->modname)
    638633                        g_free(pos->modname);
     
    711706                        g_free(pos->modname);
    712707                g_free(pos);
    713                 do_error_dialog(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."
    714                                 " You may be disconnected shortly.", "Login Error");
     708                imc_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."
     709                                " You may be disconnected shortly.");
    715710        }
    716711        pos->fd = fd;
     
    12101205
    12111206                case 0x0007: { /* Someone has denied you authorization */
    1212                         serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
     1207                        imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
    12131208                } break;
    12141209
    12151210                case 0x0008: { /* Someone has granted you authorization */
    1216                         serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
     1211                        imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
    12171212                } break;
    12181213
     
    13391334                        break;
    13401335        }
    1341         do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));
     1336        imc_error(sess->aux_data, buf);
    13421337
    13431338        return 1;
     
    13471342        va_list ap;
    13481343        guint16 reason;
    1349         char *m;
    13501344
    13511345        va_start(ap, fr);
     
    13531347        va_end(ap);
    13541348
    1355         m = g_strdup_printf(_("SNAC threw error: %s\n"),
    1356                         reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
    1357         do_error_dialog(sess->aux_data, m, _("Gaim - Oscar SNAC Error"));
    1358         g_free(m);
     1349        imc_error(sess->aux_data, _("SNAC threw error: %s"),
     1350                  reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
    13591351
    13601352        return 1;
     
    13651357        char *destn;
    13661358        guint16 reason;
    1367         char buf[1024];
    13681359
    13691360        va_start(ap, fr);
     
    13721363        va_end(ap);
    13731364
    1374         sprintf(buf, _("Your message to %s did not get sent: %s"), destn,
     1365        imc_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn,
    13751366                        (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
    1376         do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));
    13771367
    13781368        return 1;
     
    13831373        char *destn;
    13841374        guint16 reason;
    1385         char buf[1024];
    13861375
    13871376        va_start(ap, fr);
     
    13901379        va_end(ap);
    13911380
    1392         sprintf(buf, _("User information for %s unavailable: %s"), destn,
     1381        imc_error(sess->aux_data, _("User information for %s unavailable: %s"), destn,
    13931382                        (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
    1394         do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));
    1395 
    13961383
    13971384        return 1;
     
    14091396
    14101397        if (id < 4)
    1411                 do_error_dialog(sess->aux_data, _("Your connection may be lost."),
    1412                                 _("AOL error"));
     1398                imc_error(sess->aux_data, _("Your connection may be lost."));
    14131399
    14141400        return 1;
     
    16041590                aim_conn_setlatency(fr->conn, windowsize/4);
    16051591        } else if (code == AIM_RATE_CODE_LIMIT) {
    1606                 do_error_dialog(sess->aux_data, _("The last message was not sent because you are over the rate limit. "
    1607                                   "Please wait 10 seconds and try again."), _("Gaim - Error"));
     1592                imc_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. "
     1593                          "Please wait 10 seconds and try again."));
    16081594                aim_conn_setlatency(fr->conn, windowsize/2);
    16091595        } else if (code == AIM_RATE_CODE_CLEARLIMIT) {
     
    18091795
    18101796                case 0x0007: { /* Someone has denied you authorization */
    1811                         serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
     1797                        imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
    18121798                } break;
    18131799
    18141800                case 0x0008: { /* Someone has granted you authorization */
    1815                         serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
     1801                        imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
    18161802                } break;
    18171803
     
    19261912
    19271913        if (od->rights.maxawaymsglen == 0)
    1928                 do_error_dialog(ic, "oscar_set_away_aim called before locate rights received", "Protocol Error");
     1914                imc_error(ic, "oscar_set_away_aim called before locate rights received");
    19291915
    19301916        aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
     
    19441930                errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
    19451931
    1946                 do_error_dialog(ic, errstr, "Away Message Too Long");
     1932                imc_error(ic, errstr);
    19471933
    19481934                g_free(errstr);
     
    21102096       
    21112097        /* Now that we have a buddy list, we can tell BitlBee that we're online. */
    2112         account_online(ic);
     2098        imc_connected(ic);
    21132099       
    21142100        return 1;
     
    21322118                {
    21332119                        /* Hmm, the length should be even... */
    2134                         do_error_dialog( sess->aux_data, "Received SSI ACK package with non-even length", "Gaim - Error" );
     2120                        imc_error( sess->aux_data, "Received SSI ACK package with non-even length");
    21352121                        return( 0 );
    21362122                }
     
    21432129                        if( st == 0x0E )
    21442130                        {
    2145                                 serv_got_crap( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list );
     2131                                imc_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list );
    21462132                               
    21472133                                aim_ssi_auth_request( sess, fr->conn, list, "" );
     
    23302316        }
    23312317
    2332                 serv_got_crap(ic, "%s\n%s", _("User Info"), str->str);
     2318                imc_log(ic, "%s\n%s", _("User Info"), str->str);
    23332319        g_string_free(str, TRUE);
    23342320
     
    24242410                        idletime.tm_sec = 0;
    24252411                        strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime);
    2426                         serv_got_crap(ic, "%s: %s", _("Idle Time"), buff);
     2412                        imc_log(ic, "%s: %s", _("Idle Time"), buff);
    24272413                }
    24282414               
    24292415                if(text) {
    24302416                        utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
    2431                         serv_got_crap(ic, "%s\n%s", _("User Info"), utf8);
     2417                        imc_log(ic, "%s\n%s", _("User Info"), utf8);
    24322418                } else {
    2433                         serv_got_crap(ic, _("No user info available."));
     2419                        imc_log(ic, _("No user info available."));
    24342420                }
    24352421        } else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) {
    24362422                utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
    2437                 serv_got_crap(ic, "%s\n%s", _("Away Message"), utf8);
     2423                imc_log(ic, "%s\n%s", _("Away Message"), utf8);
    24382424        }
    24392425
  • protocols/oscar/rxqueue.c

    r0da65d5 raef4828  
    392392                aim_bstream_rewind(&flaphdr);
    393393                start = aimbs_get8(&flaphdr);
    394                 do_error_dialog(sess->aux_data, "FLAP framing disrupted", "Gaim");
     394                imc_error(sess->aux_data, "FLAP framing disrupted");
    395395                aim_conn_close(conn);
    396396                return -1;
  • protocols/oscar/search.c

    r0da65d5 raef4828  
    3939        /* XXX the modules interface should have already retrieved this for us */
    4040        if (!(snac2 = aim_remsnac(sess, snac->id))) {
    41                 do_error_dialog(sess->aux_data, "couldn't get snac", "Gaim");
     41                imc_error(sess->aux_data, "couldn't get snac");
    4242                return 0;
    4343        }
  • protocols/oscar/service.c

    r0da65d5 raef4828  
    567567                group = aimbs_get16(bs);
    568568
    569                 do_error_dialog(sess->aux_data, "bifurcated migration unsupported", "Gaim");
     569                imc_error(sess->aux_data, "bifurcated migration unsupported");
    570570        }
    571571
     
    894894*/
    895895                } else
    896                         do_error_dialog(sess->aux_data, "WARNING: unknown hash request", "Gaim");
     896                        imc_error(sess->aux_data, "WARNING: unknown hash request");
    897897
    898898        }
  • protocols/oscar/txqueue.c

    r0da65d5 raef4828  
    3030
    3131        if (!conn) {
    32                 do_error_dialog(sess->aux_data, "no connection specified", "Gaim");
     32                imc_error(sess->aux_data, "no connection specified");
    3333                return NULL;
    3434        }
     
    4646
    4747        } else
    48                 do_error_dialog(sess->aux_data, "unknown framing", "Gaim");
     48                imc_error(sess->aux_data, "unknown framing");
    4949
    5050        if (datalen > 0) {
     
    8080
    8181        if (!fr->conn) {
    82                 do_error_dialog(sess->aux_data, "WARNING: enqueueing packet with no connection", "Gaim");
     82                imc_error(sess->aux_data, "WARNING: enqueueing packet with no connection");
    8383                fr->conn = aim_getconn_type(sess, AIM_CONN_TYPE_BOS);
    8484        }
     
    120120
    121121        if (!fr->conn) {
    122                 do_error_dialog(sess->aux_data, "packet has no connection", "Gaim");
     122                imc_error(sess->aux_data, "packet has no connection");
    123123                aim_frame_destroy(fr);
    124124                return 0;
Note: See TracChangeset for help on using the changeset viewer.