|
|
|
@ -380,7 +380,7 @@ void KBgEngineFIBS::cancelJoin(const TQString &info)
|
|
|
|
|
TQRegExp patt = TQRegExp("^" + info + " ");
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i <= numJoin; i++) {
|
|
|
|
|
if (actJoin[i]->text().tqcontains(patt)) {
|
|
|
|
|
if (actJoin[i]->text().contains(patt)) {
|
|
|
|
|
// move all entries starting at i+1 up by one...
|
|
|
|
|
for (int j = i; j < numJoin; j++)
|
|
|
|
|
actJoin[j]->setText(actJoin[j+1]->text());
|
|
|
|
@ -426,18 +426,18 @@ void KBgEngineFIBS::changeJoin(const TQString &info)
|
|
|
|
|
|
|
|
|
|
for (TQStringList::Iterator it = invitations.begin(); it != invitations.end(); ++it) {
|
|
|
|
|
|
|
|
|
|
if ((*it).tqcontains(patt)) {
|
|
|
|
|
if ((*it).contains(patt)) {
|
|
|
|
|
|
|
|
|
|
TQString text, menu;
|
|
|
|
|
|
|
|
|
|
if ((*it).tqcontains(TQRegExp(" r$"))) {
|
|
|
|
|
if ((*it).contains(TQRegExp(" r$"))) {
|
|
|
|
|
menu = i18n("R means resume", "%1 (R)").tqarg(name);
|
|
|
|
|
text = i18n("%1 (experience %2, rating %3) wants to resume a saved match with you. "
|
|
|
|
|
"If you want to play, use the corresponding menu entry to join (or type "
|
|
|
|
|
"'join %4').").tqarg(name).tqarg(expi_s).tqarg(rate_s).tqarg(name);
|
|
|
|
|
KNotifyClient::event("invitation", i18n("%1 wants to resume a saved match with you").
|
|
|
|
|
arg(name));
|
|
|
|
|
} else if ((*it).tqcontains(TQRegExp(" u$"))) {
|
|
|
|
|
} else if ((*it).contains(TQRegExp(" u$"))) {
|
|
|
|
|
menu = i18n("U means unlimited", "%1 (U)").tqarg(name);
|
|
|
|
|
text = i18n("%1 (experience %2, rating %3) wants to play an unlimited match with you. "
|
|
|
|
|
"If you want to play, use the corresponding menu entry to join (or type "
|
|
|
|
@ -578,8 +578,8 @@ void KBgEngineFIBS::done()
|
|
|
|
|
emit allowCommand(Roll, false);
|
|
|
|
|
|
|
|
|
|
// Transform the string to FIBS cormat
|
|
|
|
|
lastMove.tqreplace(0, 2, "move ");
|
|
|
|
|
lastMove.tqreplace(pat[PlsChar], "-");
|
|
|
|
|
lastMove.replace(0, 2, "move ");
|
|
|
|
|
lastMove.replace(pat[PlsChar], "-");
|
|
|
|
|
|
|
|
|
|
// sent it to the server
|
|
|
|
|
emit serverString(lastMove);
|
|
|
|
@ -809,7 +809,7 @@ void KBgEngineFIBS::load()
|
|
|
|
|
*/
|
|
|
|
|
void KBgEngineFIBS::join(const TQString &msg)
|
|
|
|
|
{
|
|
|
|
|
emit serverString("join " + msg.left(msg.tqfind('(')));
|
|
|
|
|
emit serverString("join " + msg.left(msg.find('(')));
|
|
|
|
|
}
|
|
|
|
|
void KBgEngineFIBS::join_0() { join(actJoin[0]->text()); }
|
|
|
|
|
void KBgEngineFIBS::join_1() { join(actJoin[1]->text()); }
|
|
|
|
@ -1094,7 +1094,7 @@ bool KBgEngineFIBS::queryConnection(const bool newlogin)
|
|
|
|
|
first = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} while (ret && (msg.isEmpty() || msg.tqcontains(' ') || msg.tqcontains(':')));
|
|
|
|
|
} while (ret && (msg.isEmpty() || msg.contains(' ') || msg.contains(':')));
|
|
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
|
infoFIBS[FIBSUser] = msg;
|
|
|
|
@ -1130,7 +1130,7 @@ bool KBgEngineFIBS::queryConnection(const bool newlogin)
|
|
|
|
|
first = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} while (ret && (msg.isEmpty() || msg.tqcontains(' ') || msg.tqcontains(':')));
|
|
|
|
|
} while (ret && (msg.isEmpty() || msg.contains(' ') || msg.contains(':')));
|
|
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
|
infoFIBS[FIBSPswd] = msg;
|
|
|
|
@ -1281,13 +1281,13 @@ void KBgEngineFIBS::handleServerData(TQString &line)
|
|
|
|
|
/*
|
|
|
|
|
* Fix-up any HTML-like tags in the line
|
|
|
|
|
*/
|
|
|
|
|
line.tqreplace(pat[HTML_lt], "<");
|
|
|
|
|
line.tqreplace(pat[HTML_gt], ">");
|
|
|
|
|
line.replace(pat[HTML_lt], "<");
|
|
|
|
|
line.replace(pat[HTML_gt], ">");
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* FIBS sometimes sends tabs, where it should send 8 spaces...
|
|
|
|
|
*/
|
|
|
|
|
line.tqreplace(pat[TabChar], " ");
|
|
|
|
|
line.replace(pat[TabChar], " ");
|
|
|
|
|
|
|
|
|
|
switch (rxtqStatus) {
|
|
|
|
|
|
|
|
|
@ -1344,7 +1344,7 @@ void KBgEngineFIBS::handleServerData(TQString &line)
|
|
|
|
|
void KBgEngineFIBS::handleMessageWhois(const TQString &line)
|
|
|
|
|
{
|
|
|
|
|
rxCollect += "<br> " + line;
|
|
|
|
|
if (line.tqcontains(pat[WhoisE1]) || line.tqcontains(pat[WhoisE2])) {
|
|
|
|
|
if (line.contains(pat[WhoisE1]) || line.contains(pat[WhoisE2])) {
|
|
|
|
|
rxtqStatus = RxNormal;
|
|
|
|
|
emit infoText("<font color=\"darkgreen\">" + rxCollect + "<br></font>");
|
|
|
|
|
}
|
|
|
|
@ -1356,7 +1356,7 @@ void KBgEngineFIBS::handleMessageWhois(const TQString &line)
|
|
|
|
|
void KBgEngineFIBS::handleMessageRating(const TQString &line)
|
|
|
|
|
{
|
|
|
|
|
rxCollect += "<br>" + line;
|
|
|
|
|
if (line.tqcontains(pat[EndRate]) && ++rxCount == 2) {
|
|
|
|
|
if (line.contains(pat[EndRate]) && ++rxCount == 2) {
|
|
|
|
|
emit infoText("<font color=\"blue\">" + rxCollect + "<br></font>");
|
|
|
|
|
rxtqStatus = RxNormal;
|
|
|
|
|
}
|
|
|
|
@ -1367,7 +1367,7 @@ void KBgEngineFIBS::handleMessageRating(const TQString &line)
|
|
|
|
|
*/
|
|
|
|
|
void KBgEngineFIBS::handleMessageMotd(const TQString &line)
|
|
|
|
|
{
|
|
|
|
|
if (line.tqcontains(pat[MotdEnd])) {
|
|
|
|
|
if (line.contains(pat[MotdEnd])) {
|
|
|
|
|
rxtqStatus = RxNormal;
|
|
|
|
|
emit infoText("<font color=\"blue\"><pre>" + rxCollect + "</pre></font>");
|
|
|
|
|
/*
|
|
|
|
@ -1378,9 +1378,9 @@ void KBgEngineFIBS::handleMessageMotd(const TQString &line)
|
|
|
|
|
emit serverString("set boardstyle 3");
|
|
|
|
|
} else {
|
|
|
|
|
TQString tline = line;
|
|
|
|
|
tline.tqreplace(pat[BoxHori], "<br><hr>");
|
|
|
|
|
tline.tqreplace(pat[BoxVer1], "");
|
|
|
|
|
tline.tqreplace(pat[BoxVer2], "");
|
|
|
|
|
tline.replace(pat[BoxHori], "<br><hr>");
|
|
|
|
|
tline.replace(pat[BoxVer1], "");
|
|
|
|
|
tline.replace(pat[BoxVer2], "");
|
|
|
|
|
rxCollect += "<br>" + tline;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1393,7 +1393,7 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r
|
|
|
|
|
/*
|
|
|
|
|
* Two possibilities: either we are logged in or we sent bad password/login
|
|
|
|
|
*/
|
|
|
|
|
if (line.tqcontains("login:")) {
|
|
|
|
|
if (line.contains("login:")) {
|
|
|
|
|
/*
|
|
|
|
|
* This can only happen if the password/login is wrong.
|
|
|
|
|
*/
|
|
|
|
@ -1428,7 +1428,7 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r
|
|
|
|
|
* Ok, we are logged in! Now receive personal information. These
|
|
|
|
|
* are completely useless but what the heck.
|
|
|
|
|
*/
|
|
|
|
|
if (line.tqcontains(pat[Welcome])) {
|
|
|
|
|
if (line.contains(pat[Welcome])) {
|
|
|
|
|
char p[3][256];
|
|
|
|
|
time_t tmp;
|
|
|
|
|
// Using latin1() is okay, since the string comes from FIBS.
|
|
|
|
@ -1471,7 +1471,7 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r
|
|
|
|
|
* p[3] - timezone
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
if (line.tqcontains(pat[OwnInfo])) {
|
|
|
|
|
if (line.contains(pat[OwnInfo])) {
|
|
|
|
|
|
|
|
|
|
rxtqStatus = RxNormal;
|
|
|
|
|
|
|
|
|
@ -1537,7 +1537,7 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r
|
|
|
|
|
/*
|
|
|
|
|
* The beginning of a new login procedure starts starts here
|
|
|
|
|
*/
|
|
|
|
|
if (line.tqcontains(pat[OneName])) {
|
|
|
|
|
if (line.contains(pat[OneName])) {
|
|
|
|
|
rxtqStatus = RxNewLogin;
|
|
|
|
|
emit infoText(TQString("<font color=\"red\">") + rxCollect + "</font>");
|
|
|
|
|
rxCollect = "";
|
|
|
|
@ -1560,14 +1560,14 @@ void KBgEngineFIBS::handleMessageNewLogin(const TQString &line)
|
|
|
|
|
/*
|
|
|
|
|
* Request the new login
|
|
|
|
|
*/
|
|
|
|
|
if (line.tqcontains(pat[OneName])) {
|
|
|
|
|
if (line.contains(pat[OneName])) {
|
|
|
|
|
emit serverString(TQString("name ") + infoFIBS[FIBSUser]);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Ooops, user name already exists
|
|
|
|
|
*/
|
|
|
|
|
if (line.tqcontains(pat[OthrNam])) {
|
|
|
|
|
if (line.contains(pat[OthrNam])) {
|
|
|
|
|
TQString text = i18n("The selected login is alreay in use! Please select another one.");
|
|
|
|
|
bool ret, first = true;
|
|
|
|
|
TQString msg;
|
|
|
|
@ -1579,7 +1579,7 @@ void KBgEngineFIBS::handleMessageNewLogin(const TQString &line)
|
|
|
|
|
text += i18n("\n\nThe login may not contain spaces or colons!");
|
|
|
|
|
first = false;
|
|
|
|
|
}
|
|
|
|
|
} while (msg.tqcontains(' ') || msg.tqcontains(':'));
|
|
|
|
|
} while (msg.contains(' ') || msg.contains(':'));
|
|
|
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
|
infoFIBS[FIBSUser] = msg;
|
|
|
|
@ -1592,21 +1592,21 @@ void KBgEngineFIBS::handleMessageNewLogin(const TQString &line)
|
|
|
|
|
/*
|
|
|
|
|
* first time we send the password
|
|
|
|
|
*/
|
|
|
|
|
if (line.tqcontains(pat[YourNam])) {
|
|
|
|
|
if (line.contains(pat[YourNam])) {
|
|
|
|
|
emit serverString(infoFIBS[FIBSPswd]);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* second time we send the password
|
|
|
|
|
*/
|
|
|
|
|
if (line.tqcontains(pat[GivePwd])) {
|
|
|
|
|
if (line.contains(pat[GivePwd])) {
|
|
|
|
|
emit serverString(infoFIBS[FIBSPswd]);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* at this point we are done creating the account
|
|
|
|
|
*/
|
|
|
|
|
if (line.tqcontains(pat[RetypeP])) {
|
|
|
|
|
if (line.contains(pat[RetypeP])) {
|
|
|
|
|
|
|
|
|
|
TQString text = i18n("Your account has been created. Your new login is <u>%1</u>. To fully activate "
|
|
|
|
|
"this account, I will now close the connection. Once you reconnect, you can start "
|
|
|
|
@ -1632,7 +1632,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
* For now, the waves are ignored. They should probably go into
|
|
|
|
|
* the chat window -- but only optional
|
|
|
|
|
*/
|
|
|
|
|
if (line.tqcontains(pat[OneWave]) || line.tqcontains(pat[TwoWave]) || line.tqcontains(pat[YouWave])) {
|
|
|
|
|
if (line.contains(pat[OneWave]) || line.contains(pat[TwoWave]) || line.contains(pat[YouWave])) {
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1642,8 +1642,8 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
* ever gets a games window, they should be in there. For now, they
|
|
|
|
|
* are ignored.
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[GameBG1]) || line.tqcontains(pat[GameBG2]) || line.tqcontains(pat[GameRE1]) ||
|
|
|
|
|
line.tqcontains(pat[GameRE2]) || line.tqcontains(pat[GameEnd])) {
|
|
|
|
|
else if (line.contains(pat[GameBG1]) || line.contains(pat[GameBG2]) || line.contains(pat[GameRE1]) ||
|
|
|
|
|
line.contains(pat[GameRE2]) || line.contains(pat[GameEnd])) {
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1651,7 +1651,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Artefact caused by the login test procedure utilized.
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[NoLogin])) {
|
|
|
|
|
else if (line.contains(pat[NoLogin])) {
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1659,7 +1659,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Connection keep-alive response
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[KeepAlv])) {
|
|
|
|
|
else if (line.contains(pat[KeepAlv])) {
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1670,10 +1670,10 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
* Chat and personal messages - note that the chat window sends these messages
|
|
|
|
|
* back to us so we can display them if the user wants that.
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[ChatSay]) || line.tqcontains(pat[ChatSht]) || line.tqcontains(pat[ChatWis]) ||
|
|
|
|
|
line.tqcontains(pat[ChatKib]) || line.tqcontains(pat[SelfSay]) || line.tqcontains(pat[SelfSht]) ||
|
|
|
|
|
line.tqcontains(pat[SelfWis]) || line.tqcontains(pat[SelfKib]) || line.tqcontains(pat[SelfSlf]) ||
|
|
|
|
|
line.tqcontains(pat[MsgPers]) || line.tqcontains(pat[MsgDeli]) || line.tqcontains(pat[MsgSave])) {
|
|
|
|
|
else if (line.contains(pat[ChatSay]) || line.contains(pat[ChatSht]) || line.contains(pat[ChatWis]) ||
|
|
|
|
|
line.contains(pat[ChatKib]) || line.contains(pat[SelfSay]) || line.contains(pat[SelfSht]) ||
|
|
|
|
|
line.contains(pat[SelfWis]) || line.contains(pat[SelfKib]) || line.contains(pat[SelfSlf]) ||
|
|
|
|
|
line.contains(pat[MsgPers]) || line.contains(pat[MsgDeli]) || line.contains(pat[MsgSave])) {
|
|
|
|
|
|
|
|
|
|
emit chatMessage(line);
|
|
|
|
|
return;
|
|
|
|
@ -1684,12 +1684,12 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Beginning of games. In all these cases we are playing and not watching.
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[MatchB1]) || line.tqcontains(pat[MatchB2])) {
|
|
|
|
|
else if (line.contains(pat[MatchB1]) || line.contains(pat[MatchB2])) {
|
|
|
|
|
|
|
|
|
|
if (useAutoMsg[MsgBeg] && !autoMsg[MsgBeg].stripWhiteSpace().isEmpty())
|
|
|
|
|
emit serverString("kibitz " + autoMsg[MsgBeg]);
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[MatchB3]) || line.tqcontains(pat[MatchB4])) {
|
|
|
|
|
else if (line.contains(pat[MatchB3]) || line.contains(pat[MatchB4])) {
|
|
|
|
|
|
|
|
|
|
if (useAutoMsg[MsgBeg] && !autoMsg[MsgBeg].stripWhiteSpace().isEmpty())
|
|
|
|
|
emit serverString("kibitz " + autoMsg[MsgBeg]);
|
|
|
|
@ -1702,7 +1702,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
* The help should be handled separately. A fairly complete implementation of a
|
|
|
|
|
* help parsing can be found in KFibs.
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[HelpTxt])) {
|
|
|
|
|
else if (line.contains(pat[HelpTxt])) {
|
|
|
|
|
|
|
|
|
|
// do nothing
|
|
|
|
|
}
|
|
|
|
@ -1712,7 +1712,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Simple cases without the need for many comments...
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[RawBord])) {
|
|
|
|
|
else if (line.contains(pat[RawBord])) {
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Save the board string and create a new game state
|
|
|
|
@ -1766,7 +1766,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[PlsMove]) || line.tqcontains(pat[YouMove])) {
|
|
|
|
|
else if (line.contains(pat[PlsMove]) || line.contains(pat[YouMove])) {
|
|
|
|
|
|
|
|
|
|
KNotifyClient::event("move", i18n("Please make your move"));
|
|
|
|
|
|
|
|
|
@ -1777,13 +1777,13 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Being away and coming back
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[YouAway])) {
|
|
|
|
|
else if (line.contains(pat[YouAway])) {
|
|
|
|
|
|
|
|
|
|
emit changePlayertqStatus(infoFIBS[FIBSUser], KFibsPlayerList::Away, true);
|
|
|
|
|
actBack->setEnabled(true);
|
|
|
|
|
line += "<br><pre> </pre>" + i18n("(or use the corresponding menu entry to join the match)");
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[YouBack])) {
|
|
|
|
|
else if (line.contains(pat[YouBack])) {
|
|
|
|
|
|
|
|
|
|
emit changePlayertqStatus(infoFIBS[FIBSUser], KFibsPlayerList::Away, false);
|
|
|
|
|
actBack->setEnabled(false);
|
|
|
|
@ -1795,7 +1795,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Catch the response of the user responding to double or resign
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[YouGive]) || line.tqcontains(pat[RejCont]) || line.tqcontains(pat[AcptWin])) {
|
|
|
|
|
else if (line.contains(pat[YouGive]) || line.contains(pat[RejCont]) || line.contains(pat[AcptWin])) {
|
|
|
|
|
|
|
|
|
|
actAccept->setEnabled(false);
|
|
|
|
|
actReject->setEnabled(false);
|
|
|
|
@ -1806,20 +1806,20 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Catch the responses to newly set toggles
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[GreedyY]) || line.tqcontains(pat[GreedyN])) {
|
|
|
|
|
else if (line.contains(pat[GreedyY]) || line.contains(pat[GreedyN])) {
|
|
|
|
|
|
|
|
|
|
fibsOpt[OptGreedy]->setChecked(line.tqcontains(pat[GreedyY]));
|
|
|
|
|
fibsOpt[OptGreedy]->setChecked(line.contains(pat[GreedyY]));
|
|
|
|
|
line = "<font color=\"red\">" + line + "</font>";
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[DoubleY]) || line.tqcontains(pat[DoubleN])) {
|
|
|
|
|
else if (line.contains(pat[DoubleY]) || line.contains(pat[DoubleN])) {
|
|
|
|
|
|
|
|
|
|
fibsOpt[OptDouble]->setChecked(line.tqcontains(pat[DoubleY]));
|
|
|
|
|
fibsOpt[OptDouble]->setChecked(line.contains(pat[DoubleY]));
|
|
|
|
|
line = "<font color=\"red\">" + line + "</font>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (line.tqcontains(pat[RatingY]) || line.tqcontains(pat[RatingN])) {
|
|
|
|
|
else if (line.contains(pat[RatingY]) || line.contains(pat[RatingN])) {
|
|
|
|
|
|
|
|
|
|
fibsOpt[OptRatings]->setChecked(line.tqcontains(pat[RatingY]));
|
|
|
|
|
fibsOpt[OptRatings]->setChecked(line.contains(pat[RatingY]));
|
|
|
|
|
line = "<font color=\"red\">" + line + "</font>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1828,7 +1828,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* It's our turn to roll or double
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[YouTurn]) || line.tqcontains(pat[YouRoll])) {
|
|
|
|
|
else if (line.contains(pat[YouTurn]) || line.contains(pat[YouRoll])) {
|
|
|
|
|
|
|
|
|
|
emit allowCommand(Cube, playing);
|
|
|
|
|
emit allowCommand(Roll, playing);
|
|
|
|
@ -1843,17 +1843,17 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Got an invitation for a match
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[Invite0]) || line.tqcontains(pat[Invite2]) || line.tqcontains(pat[Invite3])) {
|
|
|
|
|
else if (line.contains(pat[Invite0]) || line.contains(pat[Invite2]) || line.contains(pat[Invite3])) {
|
|
|
|
|
|
|
|
|
|
rxCollect = rawline.left(rawline.tqfind(' '));
|
|
|
|
|
rxCollect = rawline.left(rawline.find(' '));
|
|
|
|
|
emit serverString("rawwho " + rxCollect);
|
|
|
|
|
|
|
|
|
|
if (line.tqcontains(pat[Invite0])) {
|
|
|
|
|
rawline.tqreplace(pat[Invite1], "");
|
|
|
|
|
rawline = rxCollect + " "+ rawline.left(rawline.tqfind(' '));
|
|
|
|
|
} else if (line.tqcontains(pat[Invite2])) {
|
|
|
|
|
if (line.contains(pat[Invite0])) {
|
|
|
|
|
rawline.replace(pat[Invite1], "");
|
|
|
|
|
rawline = rxCollect + " "+ rawline.left(rawline.find(' '));
|
|
|
|
|
} else if (line.contains(pat[Invite2])) {
|
|
|
|
|
rawline = rxCollect + " r";
|
|
|
|
|
} else if (line.tqcontains(pat[Invite3])) {
|
|
|
|
|
} else if (line.contains(pat[Invite3])) {
|
|
|
|
|
invitations += rxCollect + " u";
|
|
|
|
|
}
|
|
|
|
|
invitations += rawline;
|
|
|
|
@ -1862,23 +1862,23 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
|
|
|
|
|
// - rx status changes ------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
else if (line.tqcontains(pat[WhoisBG])) {
|
|
|
|
|
else if (line.contains(pat[WhoisBG])) {
|
|
|
|
|
rxtqStatus = RxWhois;
|
|
|
|
|
rxCollect = TQString("<br><u>") + line + "</u>";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[MotdBeg])) {
|
|
|
|
|
else if (line.contains(pat[MotdBeg])) {
|
|
|
|
|
rxtqStatus = RxMotd;
|
|
|
|
|
rxCollect = "";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[BegRate])) {
|
|
|
|
|
else if (line.contains(pat[BegRate])) {
|
|
|
|
|
rxtqStatus = RxRating;
|
|
|
|
|
rxCount = 0;
|
|
|
|
|
rxCollect = "<br>" + line;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[Goodbye])) {
|
|
|
|
|
else if (line.contains(pat[Goodbye])) {
|
|
|
|
|
rxtqStatus = RxGoodbye;
|
|
|
|
|
rxCollect = "<br><hr><br>";
|
|
|
|
|
handleServerData(rawline); // danger: recursion!
|
|
|
|
@ -1893,7 +1893,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Continue a mutli game match? We have to either leave or continue
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[ConLeav])) {
|
|
|
|
|
else if (line.contains(pat[ConLeav])) {
|
|
|
|
|
actConti->setEnabled(true);
|
|
|
|
|
actLeave->setEnabled(true);
|
|
|
|
|
line.append("<br><pre> </pre>" + i18n("(or use the corresponding menu "
|
|
|
|
@ -1902,9 +1902,9 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Beginning and end of user updates
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[WhoInfo])) {
|
|
|
|
|
rawline.tqreplace(pat[WhoInfo], "");
|
|
|
|
|
if (rawline.tqcontains(TQRegExp("^" + infoFIBS[FIBSUser] + " "))) {
|
|
|
|
|
else if (line.contains(pat[WhoInfo])) {
|
|
|
|
|
rawline.replace(pat[WhoInfo], "");
|
|
|
|
|
if (rawline.contains(TQRegExp("^" + infoFIBS[FIBSUser] + " "))) {
|
|
|
|
|
int ready;
|
|
|
|
|
// Using latin1() is fine, since the string is coming from FIBS.
|
|
|
|
|
sscanf(rawline.latin1(), "%*s %*s %*s %i %*s %*s %*s %*s %*s %*s %*s %*s", &ready);
|
|
|
|
@ -1913,7 +1913,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
emit fibsWhoInfo(rawline);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[WhoEnde])) {
|
|
|
|
|
else if (line.contains(pat[WhoEnde])) {
|
|
|
|
|
emit fibsWhoEnd();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1921,34 +1921,34 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
* This message is ignored. The instruction is given elsewhere (and slightly
|
|
|
|
|
* delayed in the flow of time).
|
|
|
|
|
*/
|
|
|
|
|
if (line.tqcontains(pat[TypJoin])) {
|
|
|
|
|
if (line.contains(pat[TypJoin])) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Watching other players
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[BegWtch])) {
|
|
|
|
|
else if (line.contains(pat[BegWtch])) {
|
|
|
|
|
emit allowCommand(Load, true);
|
|
|
|
|
rawline.tqreplace(pat[BegWtch], "");
|
|
|
|
|
rawline.replace(pat[BegWtch], "");
|
|
|
|
|
rawline.truncate(rawline.length()-1);
|
|
|
|
|
emit fibsStartNewGame(rawline);
|
|
|
|
|
load();
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[EndWtch])) {
|
|
|
|
|
else if (line.contains(pat[EndWtch])) {
|
|
|
|
|
emit gameOver();
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Blinding of players, the actual blind is handled by
|
|
|
|
|
* the player list
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[BegBlnd])) {
|
|
|
|
|
rawline.tqreplace(pat[BegBlnd], "");
|
|
|
|
|
else if (line.contains(pat[BegBlnd])) {
|
|
|
|
|
rawline.replace(pat[BegBlnd], "");
|
|
|
|
|
rawline.truncate(rawline.length()-1);
|
|
|
|
|
emit changePlayertqStatus(rawline, KFibsPlayerList::Blind, true);
|
|
|
|
|
line = "<font color=\"red\">" + line + "</font>";
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[EndBlnd])) {
|
|
|
|
|
rawline.tqreplace(pat[EndBlnd], "");
|
|
|
|
|
else if (line.contains(pat[EndBlnd])) {
|
|
|
|
|
rawline.replace(pat[EndBlnd], "");
|
|
|
|
|
rawline.truncate(rawline.length()-1);
|
|
|
|
|
emit changePlayertqStatus(rawline, KFibsPlayerList::Blind, false);
|
|
|
|
|
line = "<font color=\"red\">" + line + "</font>";
|
|
|
|
@ -1956,8 +1956,8 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Starting or reloading games or matches
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[BegGame])) {
|
|
|
|
|
rawline.tqreplace(pat[BegGame], "");
|
|
|
|
|
else if (line.contains(pat[BegGame])) {
|
|
|
|
|
rawline.replace(pat[BegGame], "");
|
|
|
|
|
rawline.truncate(rawline.length()-1);
|
|
|
|
|
emit fibsStartNewGame(rawline);
|
|
|
|
|
fibsOpt[OptDouble]->setChecked(true);
|
|
|
|
@ -1965,9 +1965,9 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
actConti->setEnabled(false);
|
|
|
|
|
actLeave->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[Reload1])) {
|
|
|
|
|
rawline.tqreplace(pat[Reload1], "");
|
|
|
|
|
rawline = rawline.left(rawline.tqfind(' '));
|
|
|
|
|
else if (line.contains(pat[Reload1])) {
|
|
|
|
|
rawline.replace(pat[Reload1], "");
|
|
|
|
|
rawline = rawline.left(rawline.find(' '));
|
|
|
|
|
rawline.truncate(rawline.length()-1);
|
|
|
|
|
emit fibsStartNewGame(rawline);
|
|
|
|
|
fibsOpt[OptDouble]->setChecked(true);
|
|
|
|
@ -1976,8 +1976,8 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
actLeave->setEnabled(false);
|
|
|
|
|
load();
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[Reload2])) {
|
|
|
|
|
rawline.tqreplace(pat[Reload2], "");
|
|
|
|
|
else if (line.contains(pat[Reload2])) {
|
|
|
|
|
rawline.replace(pat[Reload2], "");
|
|
|
|
|
emit fibsStartNewGame(rawline);
|
|
|
|
|
fibsOpt[OptDouble]->setChecked(true);
|
|
|
|
|
fibsOpt[OptGreedy]->setChecked(false);
|
|
|
|
@ -1989,7 +1989,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
* Opponent offered resignation or the cube. We have to accept
|
|
|
|
|
* or reject the offer.
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[RejAcpt])) {
|
|
|
|
|
else if (line.contains(pat[RejAcpt])) {
|
|
|
|
|
actAccept->setEnabled(true);
|
|
|
|
|
actReject->setEnabled(true);
|
|
|
|
|
line += "<br><pre> </pre>" + i18n("(or use the corresponding menu "
|
|
|
|
@ -1999,10 +1999,10 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
* This is strange: FIBS seems to not send a newline at the
|
|
|
|
|
* end of this pattern. So we work around that.
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[YouAcpt])) {
|
|
|
|
|
else if (line.contains(pat[YouAcpt])) {
|
|
|
|
|
actAccept->setEnabled(false);
|
|
|
|
|
actReject->setEnabled(false);
|
|
|
|
|
rawline.tqreplace(pat[YouAcpt], "");
|
|
|
|
|
rawline.replace(pat[YouAcpt], "");
|
|
|
|
|
line.truncate(line.length()-rawline.length());
|
|
|
|
|
if (!rawline.stripWhiteSpace().isEmpty()) {
|
|
|
|
|
handleServerData(rawline);
|
|
|
|
@ -2011,7 +2011,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Ending of games
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[EndLose])) {
|
|
|
|
|
else if (line.contains(pat[EndLose])) {
|
|
|
|
|
if (playing) {
|
|
|
|
|
KNotifyClient::event("game over l", i18n("Sorry, you lost the game."));
|
|
|
|
|
if (useAutoMsg[MsgLos] && !autoMsg[MsgLos].stripWhiteSpace().isEmpty())
|
|
|
|
@ -2019,7 +2019,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
}
|
|
|
|
|
emit gameOver();
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[EndVict])) {
|
|
|
|
|
else if (line.contains(pat[EndVict])) {
|
|
|
|
|
if (playing) {
|
|
|
|
|
KNotifyClient::event("game over w", i18n("Congratulations, you won the game!"));
|
|
|
|
|
if (useAutoMsg[MsgWin] && !autoMsg[MsgWin].stripWhiteSpace().isEmpty())
|
|
|
|
@ -2027,24 +2027,24 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
}
|
|
|
|
|
emit gameOver();
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[GameSav])) {
|
|
|
|
|
else if (line.contains(pat[GameSav])) {
|
|
|
|
|
emit gameOver();
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* User logs out. This has to be signalled to the player
|
|
|
|
|
* list. Get the true user names by working on the rawline.
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[UserLot])) {
|
|
|
|
|
rawline.tqreplace(pat[UserLot], "");
|
|
|
|
|
emit fibsLogout(rawline.left(rawline.tqfind(' ')));
|
|
|
|
|
else if (line.contains(pat[UserLot])) {
|
|
|
|
|
rawline.replace(pat[UserLot], "");
|
|
|
|
|
emit fibsLogout(rawline.left(rawline.find(' ')));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Emit the name of the newly logged in user.
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[UserLin])) {
|
|
|
|
|
rawline.tqreplace(pat[UserLin], "");
|
|
|
|
|
emit fibsLogin(rawline.left(rawline.tqfind(' ')));
|
|
|
|
|
else if (line.contains(pat[UserLin])) {
|
|
|
|
|
rawline.replace(pat[UserLin], "");
|
|
|
|
|
emit fibsLogin(rawline.left(rawline.find(' ')));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
@ -2052,11 +2052,11 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
* the 'boardstyle' variable, since we will not be able to display
|
|
|
|
|
* the board properly without it.
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[BoardSY])) {
|
|
|
|
|
else if (line.contains(pat[BoardSY])) {
|
|
|
|
|
// ignored
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (line.tqcontains(pat[BoardSN])) {
|
|
|
|
|
else if (line.contains(pat[BoardSN])) {
|
|
|
|
|
emit serverString("set boardstyle 3");
|
|
|
|
|
emit infoText(TQString("<font color=\"red\"><br>")
|
|
|
|
|
+ i18n("You should never set the 'boardstyle' variable "
|
|
|
|
@ -2071,7 +2071,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
* hasn't been processed, make it red, since it is a server resp.
|
|
|
|
|
* to something we just did.
|
|
|
|
|
*/
|
|
|
|
|
else if (line.tqcontains(pat[TwoStar])) {
|
|
|
|
|
else if (line.contains(pat[TwoStar])) {
|
|
|
|
|
line = "<font color=\"red\">" + line + "</font>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|