summaryrefslogtreecommitdiffstats
path: root/knights/io_internet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'knights/io_internet.cpp')
-rw-r--r--knights/io_internet.cpp144
1 files changed, 72 insertions, 72 deletions
diff --git a/knights/io_internet.cpp b/knights/io_internet.cpp
index b51dfb2..2c11193 100644
--- a/knights/io_internet.cpp
+++ b/knights/io_internet.cpp
@@ -311,7 +311,7 @@ void io_internet::recvCMD(const Command& command)
sendCMD( command );
break;
case CMD_Send_To_ICS:
- if(((Command)command).getData().tqcontains(TQRegExp("^(?:\\.|tell)")))
+ if(((Command)command).getData().contains(TQRegExp("^(?:\\.|tell)")))
{
writeToConsole(((Command)command).getData(), "K_PVT");
}
@@ -419,7 +419,7 @@ void io_internet::readCommand(KSocket* socket)
{
if(lineBuffer == "" || i != --lines.end())
{
- (*i).tqreplace( TQRegExp( "\\a" ), "" );
+ (*i).replace( TQRegExp( "\\a" ), "" );
parseLine(*i);
}
}
@@ -456,7 +456,7 @@ void io_internet::parseLoginData( TQString data )
if(loginStage == LOGIN_STAGE_NAME)
{
- if(data.tqcontains( "login:" ))
+ if(data.contains( "login:" ))
{
sendUserName();
}
@@ -468,9 +468,9 @@ void io_internet::parseLoginData( TQString data )
}
else if(loginStage == LOGIN_STAGE_PASSWORD)
{
- if(data.tqcontains("**** Invalid password! ****") ||
- data.tqcontains("Sorry, names can only consist of lower and upper case letters. Try again.") ||
- data.tqcontains("If you are not a registered player, enter guest or a unique ID."))
+ if(data.contains("**** Invalid password! ****") ||
+ data.contains("Sorry, names can only consist of lower and upper case letters. Try again.") ||
+ data.contains("If you are not a registered player, enter guest or a unique ID."))
{
loginDlg = new dlg_login( myParent, "LoginDialog", myResource);
loginDlg->disableServerSelect();
@@ -478,7 +478,7 @@ void io_internet::parseLoginData( TQString data )
connect(loginDlg, TQT_SIGNAL( cancelClicked() ), this, TQT_SLOT( selfDestruct() ) );
connect(loginDlg, TQT_SIGNAL( login(TQString, TQString) ), this, TQT_SLOT( setUserInfo(TQString, TQString) ) );
}
- else if(data.tqcontains("Press return to enter the server as"))
+ else if(data.contains("Press return to enter the server as"))
{
TQRegExp guestName("Logging you in as \"(\\w*)\"");
int pos = guestName.search(data);
@@ -488,7 +488,7 @@ void io_internet::parseLoginData( TQString data )
}
send("\n");
}
- else if(data.tqcontains("password:"))
+ else if(data.contains("password:"))
{
sendPassword();
}
@@ -526,13 +526,13 @@ void io_internet::parseLine( TQString line )
switch(parseMode)
{
case NORMAL_MODE: /* determine which mode we should go into */
- if(line.tqcontains(TQRegExp("^\\s*\\d{1,3}\\s+(?:\\d{1,4}|\\+\\+\\+\\+|\\-\\-\\-\\-)\\s+\\w{3,17}(\\(C\\))?\\s+\\d{1,3}\\s+\\d{1,3}")))
+ if(line.contains(TQRegExp("^\\s*\\d{1,3}\\s+(?:\\d{1,4}|\\+\\+\\+\\+|\\-\\-\\-\\-)\\s+\\w{3,17}(\\(C\\))?\\s+\\d{1,3}\\s+\\d{1,3}")))
{
updateSoughtList(line);
parseMode = UPDATE_SOUGHT_MODE;
}
/* CHALLENGE */
- else if( line.tqcontains(TQRegExp("^\\s*Challenge: ")))
+ else if( line.contains(TQRegExp("^\\s*Challenge: ")))
{
myResource->play( SND_CHALLENGE );
if( challenge != NULL )
@@ -543,7 +543,7 @@ void io_internet::parseLine( TQString line )
connect( challenge, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( nullifyChallenge() ) );
connect( challenge, TQT_SIGNAL( user1Clicked() ), this, TQT_SLOT( acceptChallenge() ) );
connect( challenge, TQT_SIGNAL( user2Clicked() ), this, TQT_SLOT( declineChallenge() ) );
- line.tqreplace(TQRegExp("^\\s*Challenge: "), "");
+ line.replace(TQRegExp("^\\s*Challenge: "), "");
challenge->setValues( line, userName );
parseMode = CHALLENGE_MODE;
}
@@ -555,12 +555,12 @@ void io_internet::parseLine( TQString line )
}
}
/* SOUGHT GAME */
- else if(line.tqcontains("seeking"))
+ else if(line.contains("seeking"))
{
// writeToConsole("seeking", "K_CH");
}
/* PRIVATE TELL */
- else if(line.tqcontains(TQRegExp(".+ tells you: .*")))
+ else if(line.contains(TQRegExp(".+ tells you: .*")))
{
/* First grab the user name so we can auto-respond later */
emit sendCMD( Command( 0, CMD_Set_Src_Tell, line.section(' ', 0, 0) ) );
@@ -568,19 +568,19 @@ void io_internet::parseLine( TQString line )
writeToConsole(line, "K_PVT");
}
/* SAY */
- else if(line.tqcontains( TQRegExp(".+ says: .*")))
+ else if(line.contains( TQRegExp(".+ says: .*")))
{
myResource->play(SND_SAY);
writeToConsole(line, "K_PVT");
return;
}
/* WHISPER & KIBITZ */
- else if(line.tqcontains(TQRegExp(".+ whispers: .*")) || line.tqcontains(TQRegExp(".+ kibitzes: .*")))
+ else if(line.contains(TQRegExp(".+ whispers: .*")) || line.contains(TQRegExp(".+ kibitzes: .*")))
{
writeToConsole(line, "K_WSP");
}
/* Important System Messages: Use Whisper Color */
- else if(line.tqcontains(TQRegExp("declines the draw request\\.$" )))
+ else if(line.contains(TQRegExp("declines the draw request\\.$" )))
{
writeToConsole(line, "K_WSP");
}
@@ -589,51 +589,51 @@ void io_internet::parseLine( TQString line )
{
writeToConsole(line, "K_WSP");
}
- else if( line.tqcontains( TQRegExp(".+rating adjustment:.+" ) ) )
+ else if( line.contains( TQRegExp(".+rating adjustment:.+" ) ) )
{
writeToConsole(line, "K_WSP");
}
/* SHOUTS */
- else if( line.tqcontains( TQRegExp("^c?t?s?-?shouts: ") ) )
+ else if( line.contains( TQRegExp("^c?t?s?-?shouts: ") ) )
{
writeToConsole(line, "K_SHT");
}
/* NOTIFY */
- else if((line.tqcontains(TQRegExp("\\s*Notification:"))) ||
- (line.tqcontains(TQRegExp("\\s*Present company includes:"))) ||
- (line.tqcontains(TQRegExp("\\s*Your arrival was noted by:"))))
+ else if((line.contains(TQRegExp("\\s*Notification:"))) ||
+ (line.contains(TQRegExp("\\s*Present company includes:"))) ||
+ (line.contains(TQRegExp("\\s*Your arrival was noted by:"))))
{
writeToConsole(line, "K_NOT");
myResource->play( SND_NOTIFICATION );
}
/* CHANNEL TELLS */
- else if(line.tqcontains(TQRegExp( ".\\(\\d+\\):" )))
+ else if(line.contains(TQRegExp( ".\\(\\d+\\):" )))
{
/* First grab the channel # so we can auto-respond later */
- j = line.tqfind(TQString("):"));
- i = line.tqfindRev(TQString("("), j) + 1;
+ j = line.find(TQString("):"));
+ i = line.findRev(TQString("("), j) + 1;
emit sendCMD( Command( 0, CMD_Set_Src_Channel, line.mid(i, j - i) ) );
writeToConsole(line, "K_CH");
}
- else if(line.tqcontains(TQRegExp("^<12>\\s")))
+ else if(line.contains(TQRegExp("^<12>\\s")))
{
/* a game move */
parseStyle12(line, PARSE12_MODE_MOVE);
}
- else if(line.tqcontains(TQRegExp("^<b1>\\s")))
+ else if(line.contains(TQRegExp("^<b1>\\s")))
{
/* a bughouse piece has been passed or a piece has been captured in crazyhouse */
writeToConsole(line, "K_CH");
}
- else if(line.tqcontains(TQRegExp("^\\\\")))
+ else if(line.contains(TQRegExp("^\\\\")))
{
writeToConsole(line, lastTag);
}
- else if(line.tqcontains(TQRegExp("^\\{?Game \\d+")) && line.tqcontains("Creating", TRUE))
+ else if(line.contains(TQRegExp("^\\{?Game \\d+")) && line.contains("Creating", TRUE))
{
parseMode = NEW_GAME_MODE;
}
- else if(line.tqcontains("You are now observing game"))
+ else if(line.contains("You are now observing game"))
{
parseMode = OBSERVE_GAME_MODE;
}
@@ -647,21 +647,21 @@ void io_internet::parseLine( TQString line )
}
parseMode = PARSE_MOVE_LIST_MODE;
}
- else if((line.tqcontains(TQRegExp("^\\{?Game \\d+")) || line.tqcontains(TQRegExp("Game \\d+"))) &&
+ else if((line.contains(TQRegExp("^\\{?Game \\d+")) || line.contains(TQRegExp("Game \\d+"))) &&
(
- line.tqcontains(" forfeits by disconnection", TRUE) ||
- line.tqcontains(" forfeits by disconnection}", TRUE) ||
- line.tqcontains(" forfeits on time} ", TRUE) ||
- line.tqcontains(" forfeits on time ", TRUE) ||
- line.tqcontains(" resigns} ", TRUE) ||
- line.tqcontains(" resigns ", TRUE) ||
- line.tqcontains(" Game drawn by mutual agreement ", TRUE) ||
- line.tqcontains(" Game drawn by mutual agreement} ", TRUE) ||
- line.tqcontains(", has lost contact or quit.", TRUE) ||
- line.tqcontains(" checkmated ", TRUE) ||
- line.tqcontains(" checkmated} ", TRUE) ||
- line.tqcontains("lost connection", TRUE) ||
- line.tqcontains("has no material to mate", TRUE)
+ line.contains(" forfeits by disconnection", TRUE) ||
+ line.contains(" forfeits by disconnection}", TRUE) ||
+ line.contains(" forfeits on time} ", TRUE) ||
+ line.contains(" forfeits on time ", TRUE) ||
+ line.contains(" resigns} ", TRUE) ||
+ line.contains(" resigns ", TRUE) ||
+ line.contains(" Game drawn by mutual agreement ", TRUE) ||
+ line.contains(" Game drawn by mutual agreement} ", TRUE) ||
+ line.contains(", has lost contact or quit.", TRUE) ||
+ line.contains(" checkmated ", TRUE) ||
+ line.contains(" checkmated} ", TRUE) ||
+ line.contains("lost connection", TRUE) ||
+ line.contains("has no material to mate", TRUE)
)
)
{
@@ -671,15 +671,15 @@ void io_internet::parseLine( TQString line )
{
/* don't know what to do with it, just send it to the console */
/* don't write the prompt to the console */
- if( line.tqcontains( TQRegExp( "^a?d?f?g?s?z?ics% " ) ) ||
- line.tqcontains( TQRegExp( "^cex% " ) ) ||
- line.tqcontains( TQRegExp( "^chess% " ) ) )
+ if( line.contains( TQRegExp( "^a?d?f?g?s?z?ics% " ) ) ||
+ line.contains( TQRegExp( "^cex% " ) ) ||
+ line.contains( TQRegExp( "^chess% " ) ) )
break;
writeToConsole(line, "K_STD");
}
break;
case UPDATE_SOUGHT_MODE:
- if(line.tqcontains(TQRegExp("\\d+\\s+ads? displayed.")))
+ if(line.contains(TQRegExp("\\d+\\s+ads? displayed.")))
{
updateSoughtList(line);
parseMode = NORMAL_MODE;
@@ -690,7 +690,7 @@ void io_internet::parseLine( TQString line )
}
break;
case NEW_GAME_MODE:
- if(line.tqcontains(TQRegExp("<12>\\s")))
+ if(line.contains(TQRegExp("<12>\\s")))
{
/* a game move */
parseStyle12(line, PARSE12_MODE_NEW);
@@ -701,7 +701,7 @@ void io_internet::parseLine( TQString line )
}
break;
case OBSERVE_GAME_MODE:
- if(line.tqcontains(TQRegExp("<12>\\s")))
+ if(line.contains(TQRegExp("<12>\\s")))
{
/* a game move */
parseStyle12(line, PARSE12_MODE_NEW);
@@ -716,9 +716,9 @@ void io_internet::parseLine( TQString line )
}
break;
case PARSE_MOVE_LIST_MODE:
- if(!line.tqcontains("{Still in progress}"))
+ if(!line.contains("{Still in progress}"))
{
- if(line.tqcontains(TQRegExp("\\d\\.")))
+ if(line.contains(TQRegExp("\\d\\.")))
{
parseMoveList(line);
}
@@ -847,9 +847,9 @@ void io_internet::parseStyle12(TQString line, const unsigned int Mode)
}
/* Verbose Coordinate Notation of previous move ( USE AS CAN ) */
- strcpy(move.CAN, fields[27].right(fields[27].length() - 2).tqreplace(TQRegExp("-"), ""));
+ strcpy(move.CAN, fields[27].right(fields[27].length() - 2).replace(TQRegExp("-"), ""));
/* SAN */
- strcpy(move.SAN, fields[29].tqreplace(TQRegExp("\\+"), "").tqreplace(TQRegExp("#"), ""));
+ strcpy(move.SAN, fields[29].replace(TQRegExp("\\+"), "").replace(TQRegExp("#"), ""));
/* fill the line for the command */
position_line += fields[1]; /* Internal Rank #7 */
@@ -889,31 +889,31 @@ void io_internet::parseStyle12(TQString line, const unsigned int Mode)
//{
// player.Raw = Handle;
/* SysAdmin */
-// if( Handle.tqcontains( TQRegExp("\\(\\*\\)") ) )
+// if( Handle.contains( TQRegExp("\\(\\*\\)") ) )
// {
// player.SysAdmin = TRUE;
-// Handle.tqreplace( TQRegExp("\\(\\*\\)"), TQString("") );
+// Handle.replace( TQRegExp("\\(\\*\\)"), TQString("") );
// }
// else player.SysAdmin = FALSE;
/* ServiceRep */
-// if( Handle.tqcontains( TQRegExp("\\(SR\\)") ) )
+// if( Handle.contains( TQRegExp("\\(SR\\)") ) )
// {
// player.ServiceRep = TRUE;
-// Handle.tqreplace( TQRegExp("\\(SR\\)"), TQString("") );
+// Handle.replace( TQRegExp("\\(SR\\)"), TQString("") );
// }
// else player.ServiceRep = FALSE;
/* Computer */
-// if( Handle.tqcontains( TQRegExp("\\(C\\)") ) )
+// if( Handle.contains( TQRegExp("\\(C\\)") ) )
// {
// player.Computer = TRUE;
-// Handle.tqreplace( TQRegExp("\\(C\\)"), TQString("") );
+// Handle.replace( TQRegExp("\\(C\\)"), TQString("") );
// }
// else player.Computer = FALSE;
/* Unregistered */
-// if( Handle.tqcontains( TQRegExp("\\(U\\)") ) )
+// if( Handle.contains( TQRegExp("\\(U\\)") ) )
// {
// player.Unregistered = TRUE;
-// Handle.tqreplace( TQRegExp("\\(U\\)"), TQString("") );
+// Handle.replace( TQRegExp("\\(U\\)"), TQString("") );
// }
// else player.Unregistered = FALSE;
// return;
@@ -960,13 +960,13 @@ void io_internet::writeToConsole(TQString text, TQString tag)
{
lastTag = tag;
/* Remove Bells */
- text.tqreplace( TQRegExp("\\x0007") , "" );
+ text.replace( TQRegExp("\\x0007") , "" );
/* Replace misc characters with rich-text friendly counterparts */
- text.tqreplace( TQRegExp("\\x003c"), "&#60;" );
- text.tqreplace( TQRegExp("\\x007c"), "&#124;" );
- text.tqreplace( TQRegExp( "\\f"), "");
- text.tqreplace( TQRegExp( "\\n"), "");
- text.tqreplace( TQRegExp( "\\r*" ), "" );
+ text.replace( TQRegExp("\\x003c"), "&#60;" );
+ text.replace( TQRegExp("\\x007c"), "&#124;" );
+ text.replace( TQRegExp( "\\f"), "");
+ text.replace( TQRegExp( "\\n"), "");
+ text.replace( TQRegExp( "\\r*" ), "" );
emit sendCMD( Command( 0, CMD_Append_To_Console, "<" + tag + ">" + text + "</" + tag + ">" ) );
}
@@ -978,7 +978,7 @@ void io_internet::writeToConsole(TQString text, TQString tag)
void io_internet::updateSoughtList(TQString soughtLine)
{
/* "ADS DISPLAYED" MESSAGE */
- if(soughtLine.tqcontains(TQRegExp("\\d+\\s+ads? displayed.")))
+ if(soughtLine.contains(TQRegExp("\\d+\\s+ads? displayed.")))
{
emit sendCMD( Command( 0, CMD_Show_Sought_List ) );
}
@@ -1064,11 +1064,11 @@ void io_internet::sendEndOfGameCommand(TQString line)
fields[fields.count() - 1] = fields[fields.count() - 1].stripWhiteSpace();
if(fields[fields.count() - 1] == "1-0" )
{
- if(fields[fields.count() - 2].tqcontains("resigns"))
+ if(fields[fields.count() - 2].contains("resigns"))
{
command.setCommand((int&)CMD_Black_Resign);
}
- else if(fields[fields.count() - 2].tqcontains("time"))
+ else if(fields[fields.count() - 2].contains("time"))
{
command.setCommand((int&)CMD_White_Called_Flag);
}
@@ -1079,11 +1079,11 @@ void io_internet::sendEndOfGameCommand(TQString line)
}
else if(fields[fields.count() - 1] == "0-1")
{
- if(fields[fields.count() - 2].tqcontains("resigns"))
+ if(fields[fields.count() - 2].contains("resigns"))
{
command.setCommand((int&)CMD_White_Resign);
}
- else if(fields[fields.count() - 2].tqcontains("time"))
+ else if(fields[fields.count() - 2].contains("time"))
{
command.setCommand((int&)CMD_Black_Called_Flag);
}