~ubuntu-branches/ubuntu/natty/centerim/natty

« back to all changes in this revision

Viewing changes to src/hooks/irchook.cc

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2009-03-26 19:51:53 UTC
  • mfrom: (1.1.5 upstream) (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090326195153-dxo63t1lwbp2m592
Tags: 4.22.7-1ubuntu1
* Merge from debian unstable, Ubuntu remaining changes:
  - Packages that Depend/Recommend/Suggest firefox (metapackage) must
    must alternatively Depend/Recommend/Suggest abrowser.
* Bugfix-only release, fixed bugs: LP: #146308 and LP: #186381.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
void irchook::init() {
69
69
    int i;
70
70
 
71
 
    manualstatus = conf.getstatus(irc);
 
71
    manualstatus = conf->getstatus(irc);
72
72
 
73
73
    for(i = 0; i < clist.count; i++) {
74
74
        icqcontact *c = (icqcontact *) clist.at(i);
125
125
    firetalk_subcode_register_reply_callback(handle, "PING", &subreply);
126
126
    firetalk_subcode_register_reply_callback(handle, "VERSION", &subreply);
127
127
 
128
 
    if(conf.getdebug())
 
128
    if(conf->getdebug())
129
129
        firetalk_register_callback(handle, FC_LOG, &fclog);
130
130
}
131
131
 
132
132
void irchook::connect() {
133
 
    icqconf::imaccount acc = conf.getourid(irc);
 
133
    icqconf::imaccount acc = conf->getourid(irc);
134
134
    log(logConnecting);
135
135
 
136
136
    firetalk_register_callback(handle, FC_DISCONNECT, 0);
228
228
    if(c) {
229
229
        if(ev.gettype() == imevent::message) {
230
230
            const immessage *m = static_cast<const immessage *>(&ev);
231
 
            text = rushtmlconv("kw", m->gettext());
 
231
            text = rusconv("kw", m->gettext());
232
232
 
233
233
        } else if(ev.gettype() == imevent::url) {
234
234
            const imurl *m = static_cast<const imurl *>(&ev);
275
275
        else
276
276
        {
277
277
                text = original;
278
 
                original.clear();
 
278
                original.erase();
279
279
        }
280
280
        if(text.substr(0, 1) == "/") {
281
281
            text.erase(0, 1);
377
377
                    case notavail:
378
378
                    case outforlunch:
379
379
                    case occupied:
380
 
                        firetalk_set_away(handle, conf.getawaymsg(irc).c_str(), 0);
 
380
                        firetalk_set_away(handle, conf->getawaymsg(irc).c_str(), 0);
381
381
                        break;
382
382
 
383
383
                    default:
557
557
        c = new icqcontact(imcontact(dnick, irc));
558
558
        c->setdispnick(dnick);
559
559
 
560
 
        searchdest->additem(conf.getcolor(cp_clist_irc), c, (string) " " + *in);
 
560
        searchdest->additem(conf->getcolor(cp_clist_irc), c, (string) " " + *in);
561
561
        foundguys.push_back(c);
562
562
    }
563
563
 
617
617
        if(iac->joined) {
618
618
            r = ic == channels.end();
619
619
            if(!r) r = !ic->joined;
620
 
            if(r) firetalk_chat_join(irhook.handle, iac->name.c_str());
 
620
            string passname = iac->name;
 
621
            if (!iac->passwd.empty())
 
622
                passname += " " + iac->passwd;
 
623
            if(r) firetalk_chat_join(irhook.handle, passname.c_str());
621
624
        }
622
625
    }
623
626
 
772
775
 
773
776
    for(ic = irhook.channels.begin(); ic != irhook.channels.end(); ++ic) {
774
777
        if(ic->joined) {
775
 
            firetalk_chat_join(irhook.handle, ic->name.c_str());
 
778
            string passname = ic->name;
 
779
            if (!ic->passwd.empty())
 
780
                passname += " " + ic->passwd;
 
781
            firetalk_chat_join(irhook.handle, passname.c_str());
776
782
        }
777
783
    }
778
784
 
819
825
 
820
826
    if(nick)
821
827
    if(strlen(nick)) {
822
 
        icqconf::imaccount acc = conf.getourid(irc);
 
828
        icqconf::imaccount acc = conf->getourid(irc);
823
829
        acc.nickname = nick;
824
 
        conf.setourid(acc);
 
830
        conf->setourid(acc);
825
831
 
826
832
        face.log(_("+ [irc] nickname was changed successfully"));
827
833
    }
908
914
 
909
915
    if(sender && message)
910
916
    if(strlen(sender) && strlen(message)) {
911
 
        if(!irhook.sentpass)
 
917
        /*if(!irhook.sentpass)  // NickServ identify should be handled by firetalk and needpass callback
912
918
        if(up(sender) == "NICKSERV") {
913
919
            firetalk_im_send_message(irhook.handle, "NickServ",
914
 
                ((string) "identify " + conf.getourid(irc).additional["nickpass"]).c_str(), 0);
 
920
                ((string) "identify " + conf->getourid(irc).additional["nickpass"]).c_str(), 0);
915
921
 
916
922
            irhook.sentpass = true;
917
 
        }
 
923
        }*/
918
924
 
919
925
        em.store(immessage(imcontact(sender, irc),
920
926
            imevent::incoming, irhook.rushtmlconv("wk", cuthtml(message, chCutBR | chLeaveLinks))));
1274
1280
    va_end(ap);
1275
1281
 
1276
1282
    if(pass) {
1277
 
        icqconf::imaccount acc = conf.getourid(irc);
 
1283
        icqconf::imaccount acc = conf->getourid(irc);
1278
1284
 
1279
 
        if(!acc.password.empty()) {
1280
 
            strncpy(pass, acc.password.c_str(), size-1);
1281
 
            pass[size-1] = 0;
1282
 
            face.log(_("+ [irc] password sent"));
 
1285
        if (size == 129)  // signon password
 
1286
        {
 
1287
                if(!acc.password.empty()) {
 
1288
                strncpy(pass, acc.password.c_str(), size-1);
 
1289
                pass[size-1] = 0;
 
1290
                face.log(_("+ [irc] password sent"));
 
1291
                }
 
1292
        }
 
1293
        else // NickServ password
 
1294
        {
 
1295
                irhook.sentpass = true;
 
1296
                if(!acc.additional["nickpass"].empty()) {
 
1297
                strncpy(pass, acc.additional["nickpass"].c_str(), size-1);
 
1298
                pass[size-1] = 0;
 
1299
                face.log(_("+ [irc] nick password sent"));
 
1300
                }
1283
1301
        }
1284
1302
    }
1285
1303
}
1413
1431
    char *email = va_arg(ap, char *);
1414
1432
    va_end(ap);
1415
1433
 
1416
 
    if(conf.getourid(irc).nickname != who) {
 
1434
    if(conf->getourid(irc).nickname != who) {
1417
1435
        string uname = who;
1418
1436
 
1419
1437
        if(email)
1435
1453
    char *reason = va_arg(ap, char *);
1436
1454
    va_end(ap);
1437
1455
 
1438
 
    if(conf.getourid(irc).nickname != who) {
 
1456
    if(conf->getourid(irc).nickname != who) {
1439
1457
        string text;
1440
1458
        string text2;
1441
1459
        char buf[NOTIFBUF];
1464
1482
    char *reason = va_arg(ap, char *);
1465
1483
    va_end(ap);
1466
1484
 
1467
 
    if(conf.getourid(irc).nickname != who) {
 
1485
    if(conf->getourid(irc).nickname != who) {
1468
1486
        string text;
1469
1487
        char buf[NOTIFBUF];
1470
1488