void IRC::handle_msg(const string& chan, const string& nick, const string& login, const string& host, const string& omsg) { string msg = omsg; if(chan.find_first_of("#&+!") == 0) { //Channel Message onMessage(chan, nick, login, host, msg); } else { //Private Messages if(msg.find("\x001") == 0 && msg.rfind("\x001") == msg.length() - 1) { //CTCP msg = msg.substr(1, msg.length() - 2); if(msg.compare("TIME") == 0) { onTime(nick,login,host,chan); } else if(msg.compare("VERSION") == 0) { onVersion(nick,login,host,chan); } else if(msg.substr(0, 4).compare("PING") == 0) { onPing(nick,login,host,chan,msg.substr(5)); } else if(msg.compare("FINGER") == 0) { onFinger(nick,login,host,chan); } else if(msg.substr(0, 6).compare("ACTION") == 0) { onAction(nick,login,host,chan,msg.substr(7)); } return; } onPrivateMessage(nick, login, host, msg); } }
AboutBox::AboutBox() : AbstractBox(st::aboutWidth) , _version(this, lng_about_version(lt_version, QString::fromWCharArray(AppVersionStr) + (cDevVersion() ? " dev" : "") + (cBetaVersion() ? qsl(" beta %1").arg(cBetaVersion()) : QString())), st::aboutVersionLink) , _text1(this, lang(lng_about_text_1), st::aboutLabel, st::aboutTextStyle) , _text2(this, lang(lng_about_text_2), st::aboutLabel, st::aboutTextStyle) , _text3(this, QString(), st::aboutLabel, st::aboutTextStyle) , _done(this, lang(lng_close), st::defaultBoxButton) { _text3.setRichText(lng_about_text_3(lt_faq_open, qsl("[a href=\"%1\"]").arg(telegramFaqLink()), lt_faq_close, qsl("[/a]"))); setMaxHeight(st::boxTitleHeight + st::aboutTextTop + _text1.height() + st::aboutSkip + _text2.height() + st::aboutSkip + _text3.height() + st::boxButtonPadding.top() + _done.height() + st::boxButtonPadding.bottom()); connect(&_version, SIGNAL(clicked()), this, SLOT(onVersion())); connect(&_done, SIGNAL(clicked()), this, SLOT(onClose())); prepare(); }
bool waitForCommand(uint8_t code) { LUCL::Command cmd; unsigned retries = 10; while (retries) { LUCL::CommandType type = m_proto.consumeData(cmd); switch (type) { case LUCL::CommandTypeNormal: onCommand(cmd.command.code, cmd.command.data, cmd.command.size); if (cmd.command.code == code) return true; break; case LUCL::CommandTypeVersion: onVersion(cmd.version.major, cmd.version.minor, cmd.version.patch); break; case LUCL::CommandTypeInvalidVersion: err("%s", DTR(Status::getString(Status::CODE_INVALID_CHECKSUM))); break; case LUCL::CommandTypeError: err(DTR("device reported: %s"), m_proto.getErrorString(cmd.error.code)); break; case LUCL::CommandTypeInvalidChecksum: err("%s", DTR(Status::getString(Status::CODE_INVALID_CHECKSUM))); break; case LUCL::CommandTypeNone: --retries; Delay::waitMsec(50); break; default: break; } } return false; }