Ignore:
Timestamp:
2007-04-16T01:03:08Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
6bbb939
Parents:
c2fb3809
Message:

s/imc/imcb/ for callback functions. Moved things aroundin nogaim.h a
little bit, grouping things by category instead of original Gaim 0.58
filename.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/oscar.c

    rc2fb3809 r84b045d  
    267267                        if ((conn->type == AIM_CONN_TYPE_BOS) ||
    268268                                   !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
    269                                 imc_error(ic, _("Disconnected."));
     269                                imcb_error(ic, _("Disconnected."));
    270270                                imc_logout(ic, TRUE);
    271271                        } else if (conn->type == AIM_CONN_TYPE_CHAT) {
     
    277277                                c->fd = -1;
    278278                                aim_conn_kill(odata->sess, &conn);
    279                                 imc_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name);
     279                                imcb_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name);
    280280                        } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
    281281                                if (odata->cnpa > 0)
     
    288288                                                g_slist_remove(odata->create_rooms, cr);
    289289                                        g_free(cr);
    290                                         imc_error(sess->aux_data, _("Chat is currently unavailable"));
     290                                        imcb_error(sess->aux_data, _("Chat is currently unavailable"));
    291291                                }
    292292                                aim_conn_kill(odata->sess, &conn);
     
    325325
    326326        if (source < 0) {
    327                 imc_error(ic, _("Couldn't connect to host"));
     327                imcb_error(ic, _("Couldn't connect to host"));
    328328                imc_logout(ic, TRUE);
    329329                return FALSE;
     
    353353        aim_session_t *sess;
    354354        aim_conn_t *conn;
    355         struct im_connection *ic = imc_new(acc);
     355        struct im_connection *ic = imcb_new(acc);
    356356        struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1);
    357357
     
    380380        conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
    381381        if (conn == NULL) {
    382                 imc_error(ic, _("Unable to login to AIM"));
     382                imcb_error(ic, _("Unable to login to AIM"));
    383383                imc_logout(ic, TRUE);
    384384                return;
     
    386386       
    387387        if (acc->server == NULL) {
    388                 imc_error(ic, "No servername specified");
     388                imcb_error(ic, "No servername specified");
    389389                imc_logout(ic, FALSE);
    390390                return;
     
    393393        if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&
    394394            g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) {
    395                 imc_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
    396         }
    397        
    398         imc_log(ic, _("Signon: %s"), ic->acc->user);
     395                imcb_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
     396        }
     397       
     398        imcb_log(ic, _("Signon: %s"), ic->acc->user);
    399399
    400400        aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
     
    404404        conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic);
    405405        if (conn->fd < 0) {
    406                 imc_error(ic, _("Couldn't connect to host"));
     406                imcb_error(ic, _("Couldn't connect to host"));
    407407                imc_logout(ic, TRUE);
    408408                return;
     
    464464
    465465        if (source < 0) {
    466                 imc_error(ic, _("Could Not Connect"));
     466                imcb_error(ic, _("Could Not Connect"));
    467467                imc_logout(ic, TRUE);
    468468                return FALSE;
     
    472472        ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
    473473                        oscar_callback, bosconn);
    474         imc_log(ic, _("Connection established, cookie sent"));
     474        imcb_log(ic, _("Connection established, cookie sent"));
    475475       
    476476        return FALSE;
     
    495495                case 0x05:
    496496                        /* Incorrect nick/password */
    497                         imc_error(ic, _("Incorrect nickname or password."));
     497                        imcb_error(ic, _("Incorrect nickname or password."));
    498498//                      plugin_event(event_error, (void *)980, 0, 0, 0);
    499499                        break;
    500500                case 0x11:
    501501                        /* Suspended account */
    502                         imc_error(ic, _("Your account is currently suspended."));
     502                        imcb_error(ic, _("Your account is currently suspended."));
    503503                        break;
    504504                case 0x18:
    505505                        /* connecting too frequently */
    506                         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."));
     506                        imcb_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."));
    507507                        break;
    508508                case 0x1c:
    509509                        /* client too old */
    510                         imc_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));
     510                        imcb_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));
    511511                        break;
    512512                default:
    513                         imc_error(ic, _("Authentication Failed"));
     513                        imcb_error(ic, _("Authentication Failed"));
    514514                        break;
    515515                }
     
    523523        bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
    524524        if (bosconn == NULL) {
    525                 imc_error(ic, _("Internal Error"));
     525                imcb_error(ic, _("Internal Error"));
    526526                od->killme = TRUE;
    527527                return 0;
     
    569569        g_free(host);
    570570        if (bosconn->fd < 0) {
    571                 imc_error(ic, _("Could Not Connect"));
     571                imcb_error(ic, _("Could Not Connect"));
    572572                od->killme = TRUE;
    573573                return 0;
     
    607607        }
    608608        if (in != '\n') {
    609                 imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
     609                imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
    610610                                " You may be disconnected shortly.");
    611611                b_event_remove(pos->inpa);
     
    630630
    631631        if (source < 0) {
    632                 imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
     632                imcb_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
    633633                                " You may be disconnected shortly.");
    634634                if (pos->modname)
     
    708708                        g_free(pos->modname);
    709709                g_free(pos);
    710                 imc_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."
     710                imcb_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."
    711711                                " You may be disconnected shortly.");
    712712        }
     
    11121112                inv->name = g_strdup(name);
    11131113               
    1114                 do_ask_dialog( ic, txt, inv, oscar_accept_chat, oscar_reject_chat);
     1114                imcb_ask( ic, txt, inv, oscar_accept_chat, oscar_reject_chat);
    11151115       
    11161116                if (name)
     
    11301130        // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message);
    11311131        if(find_buddy(data->ic, uin) == NULL)
    1132                 show_got_added(data->ic, uin, NULL);
     1132                imcb_ask_add(data->ic, uin, NULL);
    11331133       
    11341134        g_free(uin);
     
    11641164        data->ic = ic;
    11651165        data->uin = uin;
    1166         do_ask_dialog(ic, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
     1166        imcb_ask(ic, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
    11671167        g_free(dialog_msg);
    11681168}
     
    12071207
    12081208                case 0x0007: { /* Someone has denied you authorization */
    1209                         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.") );
     1209                        imcb_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.") );
    12101210                } break;
    12111211
    12121212                case 0x0008: { /* Someone has granted you authorization */
    1213                         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.") );
     1213                        imcb_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.") );
    12141214                } break;
    12151215
     
    12771277                case 0:
    12781278                        /* Invalid (0) */
    1279                         imc_error(sess->aux_data,
     1279                        imcb_error(sess->aux_data,
    12801280                                   nummissed == 1 ?
    12811281                                   _("You missed %d message from %s because it was invalid.") :
     
    12861286                case 1:
    12871287                        /* Message too large */
    1288                         imc_error(sess->aux_data,
     1288                        imcb_error(sess->aux_data,
    12891289                                   nummissed == 1 ?
    12901290                                   _("You missed %d message from %s because it was too large.") :
     
    12951295                case 2:
    12961296                        /* Rate exceeded */
    1297                         imc_error(sess->aux_data,
     1297                        imcb_error(sess->aux_data,
    12981298                                   nummissed == 1 ?
    12991299                                   _("You missed %d message from %s because the rate limit has been exceeded.") :
     
    13041304                case 3:
    13051305                        /* Evil Sender */
    1306                         imc_error(sess->aux_data,
     1306                        imcb_error(sess->aux_data,
    13071307                                   nummissed == 1 ?
    13081308                                   _("You missed %d message from %s because it was too evil.") :
     
    13131313                case 4:
    13141314                        /* Evil Receiver */
    1315                         imc_error(sess->aux_data,
     1315                        imcb_error(sess->aux_data,
    13161316                                   nummissed == 1 ?
    13171317                                   _("You missed %d message from %s because you are too evil.") :
     
    13211321                        break;
    13221322                default:
    1323                         imc_error(sess->aux_data,
     1323                        imcb_error(sess->aux_data,
    13241324                                   nummissed == 1 ?
    13251325                                   _("You missed %d message from %s for unknown reasons.") :
     
    13411341        va_end(ap);
    13421342
    1343         imc_error(sess->aux_data, _("SNAC threw error: %s"),
     1343        imcb_error(sess->aux_data, _("SNAC threw error: %s"),
    13441344                  reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
    13451345
     
    13571357        va_end(ap);
    13581358
    1359         imc_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn,
     1359        imcb_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn,
    13601360                        (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
    13611361
     
    13731373        va_end(ap);
    13741374
    1375         imc_error(sess->aux_data, _("User information for %s unavailable: %s"), destn,
     1375        imcb_error(sess->aux_data, _("User information for %s unavailable: %s"), destn,
    13761376                        (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
    13771377
     
    13901390
    13911391        if (id < 4)
    1392                 imc_error(sess->aux_data, _("Your connection may be lost."));
     1392                imcb_error(sess->aux_data, _("Your connection may be lost."));
    13931393
    13941394        return 1;
     
    15841584                aim_conn_setlatency(fr->conn, windowsize/4);
    15851585        } else if (code == AIM_RATE_CODE_LIMIT) {
    1586                 imc_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. "
     1586                imcb_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. "
    15871587                          "Please wait 10 seconds and try again."));
    15881588                aim_conn_setlatency(fr->conn, windowsize/2);
     
    17891789
    17901790                case 0x0007: { /* Someone has denied you authorization */
    1791                         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.") );
     1791                        imcb_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.") );
    17921792                } break;
    17931793
    17941794                case 0x0008: { /* Someone has granted you authorization */
    1795                         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.") );
     1795                        imcb_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.") );
    17961796                } break;
    17971797
     
    19061906
    19071907        if (od->rights.maxawaymsglen == 0)
    1908                 imc_error(ic, "oscar_set_away_aim called before locate rights received");
     1908                imcb_error(ic, "oscar_set_away_aim called before locate rights received");
    19091909
    19101910        aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
     
    19201920
    19211921        if (strlen(message) > od->rights.maxawaymsglen) {
    1922                 imc_error(ic, "Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
     1922                imcb_error(ic, "Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
    19231923        }
    19241924
     
    20842084       
    20852085        /* Now that we have a buddy list, we can tell BitlBee that we're online. */
    2086         imc_connected(ic);
     2086        imcb_connected(ic);
    20872087       
    20882088        return 1;
     
    21062106                {
    21072107                        /* Hmm, the length should be even... */
    2108                         imc_error( sess->aux_data, "Received SSI ACK package with non-even length");
     2108                        imcb_error( sess->aux_data, "Received SSI ACK package with non-even length");
    21092109                        return( 0 );
    21102110                }
     
    21172117                        if( st == 0x0E )
    21182118                        {
    2119                                 imc_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list );
     2119                                imcb_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list );
    21202120                               
    21212121                                aim_ssi_auth_request( sess, fr->conn, list, "" );
     
    23032303        }
    23042304
    2305                 imc_log(ic, "%s\n%s", _("User Info"), str->str);
     2305                imcb_log(ic, "%s\n%s", _("User Info"), str->str);
    23062306        g_string_free(str, TRUE);
    23072307
     
    23972397                        idletime.tm_sec = 0;
    23982398                        strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime);
    2399                         imc_log(ic, "%s: %s", _("Idle Time"), buff);
     2399                        imcb_log(ic, "%s: %s", _("Idle Time"), buff);
    24002400                }
    24012401               
    24022402                if(text) {
    24032403                        utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
    2404                         imc_log(ic, "%s\n%s", _("User Info"), utf8);
     2404                        imcb_log(ic, "%s\n%s", _("User Info"), utf8);
    24052405                } else {
    2406                         imc_log(ic, _("No user info available."));
     2406                        imcb_log(ic, _("No user info available."));
    24072407                }
    24082408        } else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) {
    24092409                utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
    2410                 imc_log(ic, "%s\n%s", _("Away Message"), utf8);
     2410                imcb_log(ic, "%s\n%s", _("Away Message"), utf8);
    24112411        }
    24122412
Note: See TracChangeset for help on using the changeset viewer.