|
|
|
@ -947,7 +947,7 @@ void KBgEngineFIBS::connected()
|
|
|
|
|
/*
|
|
|
|
|
* Initialize the rx state machine
|
|
|
|
|
*/
|
|
|
|
|
rxtqStatus = RxConnect;
|
|
|
|
|
rxStatus = RxConnect;
|
|
|
|
|
rxCollect = "";
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -992,7 +992,7 @@ void KBgEngineFIBS::newAccount()
|
|
|
|
|
if (!queryConnection(true))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
rxtqStatus = RxNewLogin;
|
|
|
|
|
rxStatus = RxNewLogin;
|
|
|
|
|
rxCollect = "";
|
|
|
|
|
login = false;
|
|
|
|
|
connectFIBS();
|
|
|
|
@ -1289,7 +1289,7 @@ void KBgEngineFIBS::handleServerData(TQString &line)
|
|
|
|
|
*/
|
|
|
|
|
line.replace(pat[TabChar], " ");
|
|
|
|
|
|
|
|
|
|
switch (rxtqStatus) {
|
|
|
|
|
switch (rxStatus) {
|
|
|
|
|
|
|
|
|
|
case RxConnect:
|
|
|
|
|
handleMessageConnect(line, rawline);
|
|
|
|
@ -1345,7 +1345,7 @@ void KBgEngineFIBS::handleMessageWhois(const TQString &line)
|
|
|
|
|
{
|
|
|
|
|
rxCollect += "<br> " + line;
|
|
|
|
|
if (line.contains(pat[WhoisE1]) || line.contains(pat[WhoisE2])) {
|
|
|
|
|
rxtqStatus = RxNormal;
|
|
|
|
|
rxStatus = RxNormal;
|
|
|
|
|
emit infoText("<font color=\"darkgreen\">" + rxCollect + "<br></font>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1358,7 +1358,7 @@ void KBgEngineFIBS::handleMessageRating(const TQString &line)
|
|
|
|
|
rxCollect += "<br>" + line;
|
|
|
|
|
if (line.contains(pat[EndRate]) && ++rxCount == 2) {
|
|
|
|
|
emit infoText("<font color=\"blue\">" + rxCollect + "<br></font>");
|
|
|
|
|
rxtqStatus = RxNormal;
|
|
|
|
|
rxStatus = RxNormal;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1368,7 +1368,7 @@ void KBgEngineFIBS::handleMessageRating(const TQString &line)
|
|
|
|
|
void KBgEngineFIBS::handleMessageMotd(const TQString &line)
|
|
|
|
|
{
|
|
|
|
|
if (line.contains(pat[MotdEnd])) {
|
|
|
|
|
rxtqStatus = RxNormal;
|
|
|
|
|
rxStatus = RxNormal;
|
|
|
|
|
emit infoText("<font color=\"blue\"><pre>" + rxCollect + "</pre></font>");
|
|
|
|
|
/*
|
|
|
|
|
* just to be on the safe side, we set the value of boardstyle.
|
|
|
|
@ -1398,7 +1398,7 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r
|
|
|
|
|
* This can only happen if the password/login is wrong.
|
|
|
|
|
*/
|
|
|
|
|
if (rxCollect.isEmpty()) {
|
|
|
|
|
rxtqStatus = RxIgnore;
|
|
|
|
|
rxStatus = RxIgnore;
|
|
|
|
|
int ret = KMessageBox::warningContinueCancel
|
|
|
|
|
((TQWidget *)parent(), i18n("There was a problem with "
|
|
|
|
|
"your login and password. "
|
|
|
|
@ -1411,9 +1411,9 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r
|
|
|
|
|
infoFIBS[FIBSUser] = "";
|
|
|
|
|
infoFIBS[FIBSPswd] = "";
|
|
|
|
|
login = true;
|
|
|
|
|
connectFIBS(); // will reset the rxtqStatus
|
|
|
|
|
connectFIBS(); // will reset the rxStatus
|
|
|
|
|
} else {
|
|
|
|
|
rxtqStatus = RxConnect;
|
|
|
|
|
rxStatus = RxConnect;
|
|
|
|
|
emit serverString("");
|
|
|
|
|
emit serverString("");
|
|
|
|
|
}
|
|
|
|
@ -1473,7 +1473,7 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r
|
|
|
|
|
*/
|
|
|
|
|
if (line.contains(pat[OwnInfo])) {
|
|
|
|
|
|
|
|
|
|
rxtqStatus = RxNormal;
|
|
|
|
|
rxStatus = RxNormal;
|
|
|
|
|
|
|
|
|
|
int fibsOptions[NumFIBSOpt];
|
|
|
|
|
|
|
|
|
@ -1538,7 +1538,7 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r
|
|
|
|
|
* The beginning of a new login procedure starts starts here
|
|
|
|
|
*/
|
|
|
|
|
if (line.contains(pat[OneName])) {
|
|
|
|
|
rxtqStatus = RxNewLogin;
|
|
|
|
|
rxStatus = RxNewLogin;
|
|
|
|
|
emit infoText(TQString("<font color=\"red\">") + rxCollect + "</font>");
|
|
|
|
|
rxCollect = "";
|
|
|
|
|
TQString tmp = rawline;
|
|
|
|
@ -1613,7 +1613,7 @@ void KBgEngineFIBS::handleMessageNewLogin(const TQString &line)
|
|
|
|
|
"playing backgammon on FIBS.").tqarg(infoFIBS[FIBSUser]);
|
|
|
|
|
emit infoText("<br><hr><font color=\"blue\">" + text + "</font><br><hr>");
|
|
|
|
|
emit serverString("bye");
|
|
|
|
|
rxtqStatus = RxNormal;
|
|
|
|
|
rxStatus = RxNormal;
|
|
|
|
|
rxCollect = "";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1717,7 +1717,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
/*
|
|
|
|
|
* Save the board string and create a new game state
|
|
|
|
|
*/
|
|
|
|
|
KBgtqStatus *st = new KBgtqStatus(currBoard = rawline);
|
|
|
|
|
KBgStatus *st = new KBgStatus(currBoard = rawline);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Save important state data and stop the timeout
|
|
|
|
@ -1779,13 +1779,13 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
*/
|
|
|
|
|
else if (line.contains(pat[YouAway])) {
|
|
|
|
|
|
|
|
|
|
emit changePlayertqStatus(infoFIBS[FIBSUser], KFibsPlayerList::Away, true);
|
|
|
|
|
emit changePlayerStatus(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.contains(pat[YouBack])) {
|
|
|
|
|
|
|
|
|
|
emit changePlayertqStatus(infoFIBS[FIBSUser], KFibsPlayerList::Away, false);
|
|
|
|
|
emit changePlayerStatus(infoFIBS[FIBSUser], KFibsPlayerList::Away, false);
|
|
|
|
|
actBack->setEnabled(false);
|
|
|
|
|
actAway->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
@ -1863,23 +1863,23 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
// - rx status changes ------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
else if (line.contains(pat[WhoisBG])) {
|
|
|
|
|
rxtqStatus = RxWhois;
|
|
|
|
|
rxStatus = RxWhois;
|
|
|
|
|
rxCollect = TQString("<br><u>") + line + "</u>";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (line.contains(pat[MotdBeg])) {
|
|
|
|
|
rxtqStatus = RxMotd;
|
|
|
|
|
rxStatus = RxMotd;
|
|
|
|
|
rxCollect = "";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (line.contains(pat[BegRate])) {
|
|
|
|
|
rxtqStatus = RxRating;
|
|
|
|
|
rxStatus = RxRating;
|
|
|
|
|
rxCount = 0;
|
|
|
|
|
rxCollect = "<br>" + line;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (line.contains(pat[Goodbye])) {
|
|
|
|
|
rxtqStatus = RxGoodbye;
|
|
|
|
|
rxStatus = RxGoodbye;
|
|
|
|
|
rxCollect = "<br><hr><br>";
|
|
|
|
|
handleServerData(rawline); // danger: recursion!
|
|
|
|
|
return;
|
|
|
|
@ -1944,13 +1944,13 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline)
|
|
|
|
|
else if (line.contains(pat[BegBlnd])) {
|
|
|
|
|
rawline.replace(pat[BegBlnd], "");
|
|
|
|
|
rawline.truncate(rawline.length()-1);
|
|
|
|
|
emit changePlayertqStatus(rawline, KFibsPlayerList::Blind, true);
|
|
|
|
|
emit changePlayerStatus(rawline, KFibsPlayerList::Blind, true);
|
|
|
|
|
line = "<font color=\"red\">" + line + "</font>";
|
|
|
|
|
}
|
|
|
|
|
else if (line.contains(pat[EndBlnd])) {
|
|
|
|
|
rawline.replace(pat[EndBlnd], "");
|
|
|
|
|
rawline.truncate(rawline.length()-1);
|
|
|
|
|
emit changePlayertqStatus(rawline, KFibsPlayerList::Blind, false);
|
|
|
|
|
emit changePlayerStatus(rawline, KFibsPlayerList::Blind, false);
|
|
|
|
|
line = "<font color=\"red\">" + line + "</font>";
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
@ -2128,8 +2128,8 @@ KBgEngineFIBS::KBgEngineFIBS(TQWidget *parent, TQString *name, TQPopupMenu *pmen
|
|
|
|
|
connect(this, TQT_SIGNAL(fibsLogout (const TQString &)), playerlist, TQT_SLOT(deletePlayer(const TQString &)));
|
|
|
|
|
connect(this, TQT_SIGNAL(fibsWhoEnd()), playerlist, TQT_SLOT(stopUpdate()));
|
|
|
|
|
connect(this, TQT_SIGNAL(fibsConnectionClosed()), playerlist, TQT_SLOT(stopUpdate()));
|
|
|
|
|
connect(this, TQT_SIGNAL(changePlayertqStatus(const TQString &, int, bool)),
|
|
|
|
|
playerlist, TQT_SLOT(changePlayertqStatus(const TQString &, int, bool)));
|
|
|
|
|
connect(this, TQT_SIGNAL(changePlayerStatus(const TQString &, int, bool)),
|
|
|
|
|
playerlist, TQT_SLOT(changePlayerStatus(const TQString &, int, bool)));
|
|
|
|
|
connect(playerlist, TQT_SIGNAL(fibsCommand(const TQString &)), this, TQT_SLOT(handleCommand(const TQString &)));
|
|
|
|
|
connect(playerlist, TQT_SIGNAL(fibsInvite(const TQString &)), this, TQT_SLOT(fibsRequestInvitation(const TQString &)));
|
|
|
|
|
|
|
|
|
|