| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2009 by The qGo Project * |
| 3 | * * |
| 4 | * This file is part of qGo. * |
| 5 | * * |
| 6 | * qGo is free software: you can redistribute it and/or modify * |
| 7 | * it under the terms of the GNU General Public License as published by * |
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
| 9 | * (at your option) any later version. * |
| 10 | * * |
| 11 | * This program is distributed in the hope that it will be useful, * |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 | * GNU General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU General Public License * |
| 17 | * along with this program; if not, see <http://www.gnu.org/licenses/> * |
| 18 | * or write to the Free Software Foundation, Inc., * |
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 20 | ***************************************************************************/ |
| 21 | |
| 22 | |
| 23 | #include <string.h> |
| 24 | #include "lgs.h"cxx . . $ `<file>/src/network/lgs.h`/ |
| 25 | #include "consoledispatch.h"cxx . . $ `<file>/src/network/consoledispatch.h`/ |
| 26 | #include "room.h"cxx . . $ `<file>/src/network/room.h`/ |
| 27 | #include "boarddispatch.h"cxx . . $ `<file>/src/network/boarddispatch.h`/ |
| 28 | #include "gamedialog.h"cxx . . $ `<file>/src/network/gamedialog.h`/ |
| 29 | #include "talk.h"cxx . . $ `<file>/src/network/talk.h`/ |
| 30 | #include "playergamelistings.h"cxx . . $ `<file>/src/network/playergamelistings.h`/ |
| 31 | |
| 32 | LGSConnectioncxx . . $ LGSConnection#::LGSConnectioncxx . . $ LGSConnection#LGSConnection(231cf4fc7da7cd6f).(const ConnectionCredentialscxx . . $ ConnectionCredentials# credentials) : |
| 33 | IGSConnectioncxx . . $ IGSConnection#(credentials) {} |
| 34 | |
| 35 | QStringcxx . . $ QString# LGSConnectioncxx . . $ LGSConnection#::getPlaceStringcxx . . $ LGSConnection#getPlaceString(4365c3963150523e).(void) |
| 36 | { |
| 37 | return "LGS"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 38 | } |
| 39 | |
| 40 | void LGSConnectioncxx . . $ LGSConnection#::sendPlayersRequestcxx . . $ LGSConnection#sendPlayersRequest(49f6e7a06ebc5aa8).(void) |
| 41 | { |
| 42 | sendTextcxx . . $ IGSConnection#sendText(85c52e162fed56f9).("who\r\n"); //no userlist, user gives simple info |
| 43 | } |
| 44 | |
| 45 | void LGSConnectioncxx . . $ LGSConnection#::sendTogglecxx . . $ LGSConnection#sendToggle(37c160c81b6367f7).(const QStringcxx . . $ QString# & param, bool val) |
| 46 | { |
| 47 | if(param ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "looking" || param ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "open") |
| 48 | return; //FIXME |
| 49 | IGSConnectioncxx . . $ IGSConnection#::sendTogglecxx . . $ IGSConnection#sendToggle(37c160c81b6367f7).(param, val); |
| 50 | } |
| 51 | |
| 52 | void LGSConnectioncxx . . $ LGSConnection#::requestGameInfocxx . . $ LGSConnection#requestGameInfo(cb2f890c2fdad230).(unsigned int game_id) |
| 53 | { |
| 54 | char string[20]; |
| 55 | snprintf(string, 20, "refresh %d\r\n", game_id); |
| 56 | sendTextcxx . . $ IGSConnection#sendText(85c52e162fed56f9).(string); |
| 57 | snprintf(string, 20, "all %d\r\n", game_id); |
| 58 | sendTextcxx . . $ IGSConnection#sendText(85c52e162fed56f9).(string); |
| 59 | } |
| 60 | |
| 61 | void LGSConnectioncxx . . $ LGSConnection#::onReadycxx . . $ LGSConnection#onReady(49f6e7a06ebc5aa8).(void) |
| 62 | { |
| 63 | if(firstonReadyCallcxx . . $ NetworkConnection#firstonReadyCall.) |
| 64 | { |
| 65 | if(connectionStatecxx . . $ NetworkConnection#connectionState. != PasswordSentcxx . . $ PasswordSent.) |
| 66 | return; |
| 67 | firstonReadyCallcxx . . $ NetworkConnection#firstonReadyCall. = 0; |
| 68 | setStatecxx . . $ NetworkConnection#setState(41e728cff2b23034).(Connectedcxx . . $ Connected.); |
| 69 | setKeepAlivecxx . . $ IGSConnection#setKeepAlive(d4f767463ce0a6b3).(600); |
| 70 | sendPlayersRequestcxx . . $ LGSConnection#sendPlayersRequest(49f6e7a06ebc5aa8).(); |
| 71 | sendGamesRequestcxx . . $ IGSConnection#sendGamesRequest(49f6e7a06ebc5aa8).(); |
| 72 | //dispatch->recvRoomListing(new RoomListing(0, "Lobby")); |
| 73 | //sendRoomListRequest(); |
| 74 | //qDebug("Ready!\n"); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | void LGSConnectioncxx . . $ LGSConnection#::handle_infocxx . . $ LGSConnection#handle_info(7df51288a9ebd664).(QStringcxx . . $ QString# line) |
| 79 | { |
| 80 | static PlayerListingcxx . . $ PlayerListing# * statsPlayer; |
| 81 | BoardDispatchcxx . . $ BoardDispatch# * boarddispatch; |
| 82 | Roomcxx . . $ Room# * room = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).(); |
| 83 | MoveRecordcxx . . $ MoveRecord# * aMove = new MoveRecordcxx . . $ MoveRecord#(); |
| 84 | static QStringcxx . . $ QString# memory_strcxx . . $ QString#QString(ced63f7c635d850d).; |
| 85 | static int memory = 0; |
| 86 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("9: %s", line.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 87 | line =cxx . . $ QString#`operator=`(4f35bf974e7f8568). line.removecxx . . $ QString#remove(6483560ce2afa901).(0, 2).trimmedcxx . . $ QString#trimmed(dca2c5857e9adf82).(); //remove command code |
| 88 | // status messages |
| 89 | if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Set open to be"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 90 | { |
| 91 | bool val = (line.indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).("False"cxx . . $ QString#QString(85c52e162fed56f9).) == -1); |
| 92 | room->recvTogglecxx . . $ Room#recvToggle(918ebd27a9ddbad3).(0, val); |
| 93 | } |
| 94 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Setting you open for matches"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 95 | room->recvTogglecxx . . $ Room#recvToggle(918ebd27a9ddbad3).(0, true); |
| 96 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Set looking to be"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 97 | { |
| 98 | bool val = (line.indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).("False"cxx . . $ QString#QString(85c52e162fed56f9).) == -1); |
| 99 | room->recvTogglecxx . . $ Room#recvToggle(918ebd27a9ddbad3).(1, val); |
| 100 | } |
| 101 | // 9 Set quiet to be False. |
| 102 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Set quiet to be"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 103 | { |
| 104 | bool val = (line.indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).("False"cxx . . $ QString#QString(85c52e162fed56f9).) == -1); |
| 105 | room->recvTogglecxx . . $ Room#recvToggle(918ebd27a9ddbad3).(2, val); |
| 106 | } |
| 107 | else if (line.indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).("Channel"cxx . . $ QString#QString(85c52e162fed56f9).) == 0) |
| 108 | { |
| 109 | // channel messages |
| 110 | QStringcxx . . $ QString# e1 = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 1, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 111 | if (e1.atcxx . . $ QString#at(13af7ae5a875439e).(e1.lengthcxx . . $ QString#length(455f465bc33b4cdf).()-1) ==cxx . . $ `operator==`(a468b2f18a3afe8). ':'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 112 | e1.truncatecxx . . $ QString#truncate(d4f767463ce0a6b3).(e1.lengthcxx . . $ QString#length(455f465bc33b4cdf).()-1); |
| 113 | #ifdef FIXME |
| 114 | int nr = e1.toInt(); |
| 115 | |
| 116 | if (line.contains("turned on.")) |
| 117 | { |
| 118 | // turn on channel |
| 119 | emit signal_channelinfo(nr, QString("*on*")); |
| 120 | } |
| 121 | else if (line.contains("turned off.")) |
| 122 | { |
| 123 | // turn off channel |
| 124 | emit signal_channelinfo(nr, QString("*off*")); |
| 125 | } |
| 126 | else if (!line.contains("Title:") || gsName == GS_UNKNOWN) |
| 127 | { |
| 128 | // keep in memory to parse next line correct |
| 129 | memory = nr; |
| 130 | emit signal_channelinfo(memory, line); |
| 131 | memory_str = "CHANNEL"; |
| 132 | } |
| 133 | #endif //FIXME |
| 134 | // return IT_OTHER; |
| 135 | } |
| 136 | #ifdef FIXME |
| 137 | else if (memory != 0 && !memory_str.isEmpty() && memory_str == "CHANNEL") |
| 138 | { |
| 139 | //emit signal_channelinfo(memory, line); |
| 140 | |
| 141 | // reset memory |
| 142 | memory = 0; |
| 143 | memory_str = QString(); |
| 144 | // return IT_OTHER; |
| 145 | } |
| 146 | #endif //FIXME |
| 147 | // IGS: channelinfo |
| 148 | // 9 #42 Title: Untitled -- Open |
| 149 | // 9 #42 broesel zero815 Granit |
| 150 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("#"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 151 | { |
| 152 | #ifdef FIXME |
| 153 | int nr = element(line, 0, "#", " ").toInt(); |
| 154 | QString msg = element(line, 0, " ", "EOL"); |
| 155 | emit signal_channelinfo(nr, msg); |
| 156 | #endif //FIXME |
| 157 | } |
| 158 | // NNGS: channels |
| 159 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("has left channel"cxx . . $ QString#QString(85c52e162fed56f9).) || line.containscxx . . $ QString#contains(8cce4688c16f48f3).("has joined channel"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 160 | { |
| 161 | QStringcxx . . $ QString# e1 = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 3, " "cxx . . $ QString#QString(85c52e162fed56f9)., "."cxx . . $ QString#QString(85c52e162fed56f9).); |
| 162 | #ifdef FIXME |
| 163 | int nr = e1.toInt(); |
| 164 | |
| 165 | // turn on channel to get full info |
| 166 | emit signal_channelinfo(nr, QString("*on*")); |
| 167 | #endif //FIXME |
| 168 | } |
| 169 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Game is titled:"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 170 | { |
| 171 | QStringcxx . . $ QString# t = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, ":"cxx . . $ QString#QString(85c52e162fed56f9)., "EOL"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 172 | //emit signal_title(t); |
| 173 | return; |
| 174 | } |
| 175 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("offers a new komi "cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 176 | { |
| 177 | // NNGS: 9 physician offers a new komi of 1.5. |
| 178 | QStringcxx . . $ QString# komi = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 6, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 179 | if (komi.atcxx . . $ QString#at(13af7ae5a875439e).(komi.lengthcxx . . $ QString#length(455f465bc33b4cdf).()-1) ==cxx . . $ `operator==`(a468b2f18a3afe8). '.'cxx . . $ QChar#QChar(f349c77f591a7878).) |
| 180 | komi.truncatecxx . . $ QString#truncate(d4f767463ce0a6b3).(komi.lengthcxx . . $ QString#length(455f465bc33b4cdf).() - 1); |
| 181 | QStringcxx . . $ QString# opponent = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 182 | |
| 183 | // true: request |
| 184 | //emit signal_komi(opponent, komi, true); |
| 185 | } |
| 186 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Komi set to"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 187 | { |
| 188 | // NNGS: 9 Komi set to -3.5 in match 10 |
| 189 | QStringcxx . . $ QString# komi = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 3, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 190 | QStringcxx . . $ QString# game_id = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 6, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 191 | |
| 192 | // false: no request |
| 193 | //emit signal_komi(game_id, komi, false); |
| 194 | } |
| 195 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("wants the komi to be"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 196 | { |
| 197 | // IGS: 9 qGoDev wants the komi to be 1.5 |
| 198 | QStringcxx . . $ QString# komi = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 6, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 199 | QStringcxx . . $ QString# opponent = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 200 | |
| 201 | // true: request |
| 202 | //emit signal_komi(opponent, komi, true); |
| 203 | } |
| 204 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Komi is now set to"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 205 | { |
| 206 | // 9 Komi is now set to -3.5. -> oppenent set for our game |
| 207 | QStringcxx . . $ QString# komi = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 5, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 208 | // error? "9 Komi is now set to -3.5.9 Komi is now set to -3.5" |
| 209 | if (komi.containscxx . . $ QString#contains(8cce4688c16f48f3).(".9"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 210 | komi =cxx . . $ QString#`operator=`(4f35bf974e7f8568). komi.leftcxx . . $ QString#left(3f3c3d0e9c0eb37f).(komi.lengthcxx . . $ QString#length(455f465bc33b4cdf).() - 2); |
| 211 | |
| 212 | // false: no request |
| 213 | //emit signal_komi(QString(), komi, false); |
| 214 | } |
| 215 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Set the komi to"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 216 | { |
| 217 | // NNGS: 9 Set the komi to -3.5 - I set for own game |
| 218 | QStringcxx . . $ QString# komi = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 4, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 219 | |
| 220 | // false: no request |
| 221 | //emit signal_komi(QString(), komi, false); |
| 222 | } |
| 223 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("game will count"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 224 | { |
| 225 | // IGS: 9 Game will not count towards ratings. |
| 226 | // 9 Game will count towards ratings. |
| 227 | //emit signal_freegame(false); |
| 228 | } |
| 229 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("game will not count"cxx . . $ QString#QString(85c52e162fed56f9)., Qtcxx . . $ Qt/::CaseInsensitivecxx . . $ Qt/CaseInsensitive.)) |
| 230 | { |
| 231 | // IGS: 9 Game will not count towards ratings. |
| 232 | // 9 Game will count towards ratings. |
| 233 | //emit signal_freegame(true); |
| 234 | } |
| 235 | else if ((line.containscxx . . $ QString#contains(8cce4688c16f48f3).("["cxx . . $ QString#QString(85c52e162fed56f9).) || line.containscxx . . $ QString#contains(8cce4688c16f48f3).("yes"cxx . . $ QString#QString(85c52e162fed56f9).)) && line.lengthcxx . . $ QString#length(455f465bc33b4cdf).() < 6) |
| 236 | { |
| 237 | // 9 [20] ... channelinfo |
| 238 | // 9 yes ... ayt |
| 239 | return; |
| 240 | } |
| 241 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("has restarted your game"cxx . . $ QString#QString(85c52e162fed56f9).) || |
| 242 | line.containscxx . . $ QString#contains(8cce4688c16f48f3).("has restored your old game"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 243 | { |
| 244 | if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("restarted"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 245 | // memory_str -> see case 15 for continuation |
| 246 | memory_str =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 247 | } |
| 248 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("I suggest that"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 249 | { |
| 250 | memory_str =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). line; |
| 251 | return; |
| 252 | } |
| 253 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("and set komi to"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 254 | { |
| 255 | #ifdef FIXME |
| 256 | // suggest message ... |
| 257 | if (!memory_str.isEmpty()) |
| 258 | // something went wrong... |
| 259 | return; |
| 260 | |
| 261 | line = line.simplified(); |
| 262 | |
| 263 | QString p1 = element(memory_str, 3, " "); |
| 264 | QString p2 = element(memory_str, 6, " ", ":"); |
| 265 | bool p1_play_white = memory_str.contains("play White"); |
| 266 | |
| 267 | QString h, k; |
| 268 | if (line.contains("even game")) |
| 269 | h = "0"; |
| 270 | else |
| 271 | h = element(line, 3, " "); |
| 272 | |
| 273 | k = element(line, 9, " ", "."); |
| 274 | |
| 275 | int size = 19; |
| 276 | if (line.contains("13x13")) |
| 277 | size = 13; |
| 278 | else if (line.contains("9x 9")) |
| 279 | { |
| 280 | size = 9; |
| 281 | memory_str = QString(); |
| 282 | } |
| 283 | |
| 284 | if (p1_play_white) |
| 285 | emit signal_suggest(p1, p2, h, k, size); |
| 286 | else |
| 287 | emit signal_suggest(p2, p1, h, k, size); |
| 288 | #endif //FIXME |
| 289 | return; |
| 290 | } |
| 291 | // 9 Match [19x19] in 1 minutes requested with xxxx as White. |
| 292 | // 9 Use <match xxxx B 19 1 10> or <decline xxxx> to respond. |
| 293 | // 9 NMatch requested with yfh2test(B 3 19 60 600 25 0 0 0). |
| 294 | // 9 Use <nmatch yfh2test B 3 19 60 600 25 0 0 0> or <decline yfh2test> to respond. |
| 295 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("<decline"cxx . . $ QString#QString(85c52e162fed56f9).) && line.containscxx . . $ QString#contains(8cce4688c16f48f3).("match"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 296 | { |
| 297 | // false -> not my request: used in mainwin.cpp |
| 298 | line =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, "<"cxx . . $ QString#QString(85c52e162fed56f9)., ">"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 299 | MatchRequestcxx . . $ MatchRequest# * aMatch = new MatchRequestcxx . . $ MatchRequest#(); |
| 300 | aMatch->opponentcxx . . $ MatchRequest#opponent. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). line.sectioncxx . . $ QString#section(eae3fc215228815e).(" "cxx . . $ QString#QString(85c52e162fed56f9)., 1, 1); |
| 301 | if(line.sectioncxx . . $ QString#section(eae3fc215228815e).(" "cxx . . $ QString#QString(85c52e162fed56f9).,2,2) ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "B") |
| 302 | aMatch->color_requestcxx . . $ MatchRequest#color_request. = MatchRequestcxx . . $ MatchRequest#::BLACKcxx . . $ MatchRequest#BLACK.; |
| 303 | else if(line.sectioncxx . . $ QString#section(eae3fc215228815e).(" "cxx . . $ QString#QString(85c52e162fed56f9).,2,2) ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "N") |
| 304 | aMatch->color_requestcxx . . $ MatchRequest#color_request. = MatchRequestcxx . . $ MatchRequest#::NIGIRIcxx . . $ MatchRequest#NIGIRI.; |
| 305 | else |
| 306 | aMatch->color_requestcxx . . $ MatchRequest#color_request. = MatchRequestcxx . . $ MatchRequest#::WHITEcxx . . $ MatchRequest#WHITE.; |
| 307 | if(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("nmatch"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 308 | { |
| 309 | aMatch->handicapcxx . . $ MatchRequest#handicap. = line.sectioncxx . . $ QString#section(eae3fc215228815e).(" "cxx . . $ QString#QString(85c52e162fed56f9).,3,3).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 310 | aMatch->board_sizecxx . . $ MatchRequest#board_size. = line.sectioncxx . . $ QString#section(eae3fc215228815e).(" "cxx . . $ QString#QString(85c52e162fed56f9).,4,4).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 311 | //what kind of time? var name? |
| 312 | aMatch->maintimecxx . . $ MatchRequest#maintime. = line.sectioncxx . . $ QString#section(eae3fc215228815e).(" "cxx . . $ QString#QString(85c52e162fed56f9).,5,5).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 313 | aMatch->periodtimecxx . . $ MatchRequest#periodtime. = line.sectioncxx . . $ QString#section(eae3fc215228815e).(" "cxx . . $ QString#QString(85c52e162fed56f9).,6,6).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 314 | aMatch->stones_periodscxx . . $ MatchRequest#stones_periods. = line.sectioncxx . . $ QString#section(eae3fc215228815e).(" "cxx . . $ QString#QString(85c52e162fed56f9). ,7,7).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 315 | //what is "nmatch"? |
| 316 | aMatch->nmatchcxx . . $ MatchRequest#nmatch. = true; |
| 317 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("nmatch in parser"); |
| 318 | } |
| 319 | else |
| 320 | { |
| 321 | aMatch->board_sizecxx . . $ MatchRequest#board_size. = line.sectioncxx . . $ QString#section(eae3fc215228815e).(" "cxx . . $ QString#QString(85c52e162fed56f9).,3,3).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 322 | aMatch->maintimecxx . . $ MatchRequest#maintime. = line.sectioncxx . . $ QString#section(eae3fc215228815e).(" "cxx . . $ QString#QString(85c52e162fed56f9).,4,4).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 323 | aMatch->periodtimecxx . . $ MatchRequest#periodtime. = line.sectioncxx . . $ QString#section(eae3fc215228815e).(" "cxx . . $ QString#QString(85c52e162fed56f9).,5,5).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 324 | aMatch->nmatchcxx . . $ MatchRequest#nmatch. = false; |
| 325 | } |
| 326 | PlayerListingcxx . . $ PlayerListing# * p = getPlayerListingNeverFailcxx . . $ IGSConnection#getPlayerListingNeverFail(38be696f4c5aa948).(aMatch->opponentcxx . . $ MatchRequest#opponent.); |
| 327 | const PlayerListingcxx . . $ PlayerListing# * us = getOurListingcxx . . $ NetworkConnection#getOurListing(c84291d55c8466c6).(); |
| 328 | if(us) |
| 329 | { |
| 330 | aMatch->our_namecxx . . $ MatchRequest#our_name. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). us->namecxx . . $ PlayerListing#name.; |
| 331 | aMatch->our_rankcxx . . $ MatchRequest#our_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). us->rankcxx . . $ PlayerListing#rank.; |
| 332 | } |
| 333 | aMatch->their_rankcxx . . $ MatchRequest#their_rank. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). p->rankcxx . . $ PlayerListing#rank.; |
| 334 | |
| 335 | GameDialogcxx . . $ GameDialog# * gameDialogDispatch = getGameDialogcxx . . $ NetworkConnection#getGameDialog(3dcc94127826259).(p); |
| 336 | gameDialogDispatch->recvRequestcxx . . $ GameDialog#recvRequest(461bc273ee812ab9).(aMatch); |
| 337 | delete aMatch; |
| 338 | } |
| 339 | // 9 Match [5] with guest17 in 1 accepted. |
| 340 | // 9 Creating match [5] with guest17. |
| 341 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Creating match"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 342 | { |
| 343 | QStringcxx . . $ QString# nr = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, "["cxx . . $ QString#QString(85c52e162fed56f9)., "]"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 344 | // maybe there's a blank within the brackets: ...[ 5]... |
| 345 | QStringcxx . . $ QString# dummy = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, "]"cxx . . $ QString#QString(85c52e162fed56f9)., "."cxx . . $ QString#QString(85c52e162fed56f9).).trimmedcxx . . $ QString#trimmed(30b3b70527b1c61a).(); |
| 346 | QStringcxx . . $ QString# opp = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(dummy, 1, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 347 | |
| 348 | // We let the 15 game record message create the board |
| 349 | //GameDialog * gameDialogDispatch = getGameDialog(opp); |
| 350 | //gameDialogDispatch->closeAndCreate(); |
| 351 | //GameDialog * gameDialogDispatch = |
| 352 | // getGameDialog(opp); |
| 353 | //MatchRequest * mr = gameDialogDispatch->getMatchRequest(); |
| 354 | //created_match_request = new MatchRequest(*mr); |
| 355 | //closeGameDialog(opp); |
| 356 | ////emit signal_matchCreate(nr, opp); |
| 357 | // automatic opening of a dialog tab for further conversation |
| 358 | ////emit signal_talk(opp, "", true); |
| 359 | } |
| 360 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Match"cxx . . $ QString#QString(85c52e162fed56f9).) && line.containscxx . . $ QString#contains(8cce4688c16f48f3).("accepted"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 361 | { |
| 362 | QStringcxx . . $ QString# nr = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, "["cxx . . $ QString#QString(85c52e162fed56f9)., "]"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 363 | QStringcxx . . $ QString# opp = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 3, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 364 | ////emit signal_matchCreate(nr, opp); |
| 365 | |
| 366 | } |
| 367 | // 9 frosla withdraws the match offer. |
| 368 | // 9 guest17 declines your request for a match. |
| 369 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("declines your request for a match"cxx . . $ QString#QString(85c52e162fed56f9).) || |
| 370 | line.containscxx . . $ QString#contains(8cce4688c16f48f3).("withdraws the match offer"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 371 | { |
| 372 | QStringcxx . . $ QString# opp = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 373 | PlayerListingcxx . . $ PlayerListing# * p = getPlayerListingNeverFailcxx . . $ IGSConnection#getPlayerListingNeverFail(38be696f4c5aa948).(opp); |
| 374 | GameDialogcxx . . $ GameDialog# * gameDialogDispatch = getGameDialogcxx . . $ NetworkConnection#getGameDialog(3dcc94127826259).(p); |
| 375 | gameDialogDispatch->recvRefuseMatchcxx . . $ GameDialog#recvRefuseMatch(d4f767463ce0a6b3).(1); |
| 376 | } |
| 377 | //9 yfh2test declines undo |
| 378 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("declines undo"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 379 | { |
| 380 | // not the cleanest way : we should send this to a message box |
| 381 | //emit signal_kibitz(0, element(line, 0, " "), line); |
| 382 | return; |
| 383 | } |
| 384 | |
| 385 | //9 yfh2test left this room |
| 386 | //9 yfh2test entered this room |
| 387 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("this room"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 388 | {} //emit signal_refresh(10); |
| 389 | |
| 390 | //9 Requesting match in 10 min with frosla as Black. |
| 391 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Requesting match in"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 392 | { |
| 393 | QStringcxx . . $ QString# opp = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 6, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 394 | //emit signal_opponentopen(opp); |
| 395 | } |
| 396 | // NNGS: 9 Removing @ K8 |
| 397 | // IGS: 9 Removing @ B5 |
| 398 | // 49 Game 265 qGoDev is removing @ B5 |
| 399 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("emoving @"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 400 | { |
| 401 | /* FIXME DOUBLE CHECK!!! */ |
| 402 | /*if (gsName != IGS) |
| 403 | { |
| 404 | QString pt = element(line, 2, " "); |
| 405 | //emit signal_removeStones(pt, 0); |
| 406 | }*/ |
| 407 | if(protocol_save_intcxx . . $ IGSConnection#protocol_save_int. < 0) |
| 408 | { |
| 409 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Received stone removal message without game in scoring mode"); |
| 410 | return; |
| 411 | } |
| 412 | else |
| 413 | { |
| 414 | boarddispatch = getBoardDispatchcxx . . $ NetworkConnection#getBoardDispatch(f34f0704202202).(protocol_save_intcxx . . $ IGSConnection#protocol_save_int.); |
| 415 | QStringcxx . . $ QString# pt = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 2, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 416 | aMove->flagscxx . . $ MoveRecord#flags. = MoveRecordcxx . . $ MoveRecord#::REMOVEcxx . . $ MoveRecord#REMOVE.; |
| 417 | aMove->xcxx . . $ MoveRecord#x. = (int)(pt.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().atcxx . . $ QByteArray#at(ed855a77b1899856).(0)); |
| 418 | aMove->xcxx . . $ MoveRecord#x. -= 'A'; |
| 419 | if(aMove->xcxx . . $ MoveRecord#x. < 9) //no I on IGS |
| 420 | aMove->xcxx . . $ MoveRecord#x.++; |
| 421 | pt.removecxx . . $ QString#remove(6483560ce2afa901).(0,1); |
| 422 | aMove->ycxx . . $ MoveRecord#y. = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(pt, 0, " "cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 423 | /* Do we need the board size here???*/ |
| 424 | aMove->ycxx . . $ MoveRecord#y. = 20 - aMove->ycxx . . $ MoveRecord#y.; |
| 425 | boarddispatch->recvMovecxx . . $ BoardDispatch#recvMove(d174a3d9cfb0dd75).(aMove); |
| 426 | // FIXME Set protocol_save_int to -1??? |
| 427 | delete aMove; |
| 428 | } |
| 429 | } |
| 430 | // 9 You can check your score with the score command, type 'done' when finished. |
| 431 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("check your score with the score command"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 432 | { |
| 433 | // if (gsName == IGS) |
| 434 | // IGS: store and wait until game number is known |
| 435 | // memory_str = QString("rmv@"); // -> continuation see 15 |
| 436 | // else |
| 437 | ////emit signal_removestones(0, 0); |
| 438 | ////emit signal_enterScoreMode(); |
| 439 | memory_str =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("rmv@"); |
| 440 | } |
| 441 | // IGS: 9 Board is restored to what it was when you started scoring |
| 442 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("what it was when you"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 443 | { |
| 444 | //emit signal_restoreScore(); |
| 445 | } |
| 446 | // WING: 9 Use <adjourn> to adjourn, or <decline adjourn> to decline. |
| 447 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Use adjourn to"cxx . . $ QString#QString(85c52e162fed56f9).) || line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Use <adjourn> to"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 448 | { |
| 449 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("parser->case 9: Use adjourn to"); |
| 450 | ////emit signal_requestDialog("adjourn", "decline adjourn", 0, 0); |
| 451 | boarddispatch = getBoardDispatchcxx . . $ NetworkConnection#getBoardDispatch(f34f0704202202).(memory); |
| 452 | boarddispatch->recvRequestAdjourncxx . . $ BoardDispatch#recvRequestAdjourn(49f6e7a06ebc5aa8).(); |
| 453 | } |
| 454 | // 9 frosla requests to pause the game. |
| 455 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("requests to pause"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 456 | { |
| 457 | //emit signal_requestDialog("pause", 0, 0, 0); |
| 458 | } |
| 459 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("been adjourned"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 460 | { |
| 461 | // remove game from list - special case: own game |
| 462 | #ifdef FIXME |
| 463 | aGame->nr = "@"; |
| 464 | aGame->running = false; |
| 465 | |
| 466 | //emit signal_game(aGame); |
| 467 | #endif //FIXME |
| 468 | /* There's several after the fact server INFO messages about |
| 469 | * games adjourning so we only need to close for one of them |
| 470 | * The 21 message might actually be better FIXME*/ |
| 471 | boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(memory); |
| 472 | if(boarddispatch) |
| 473 | { |
| 474 | boarddispatch->adjournGamecxx . . $ BoardDispatch#adjournGame(49f6e7a06ebc5aa8).(); |
| 475 | closeBoardDispatchcxx . . $ NetworkConnection#closeBoardDispatch(cb2f890c2fdad230).(memory); |
| 476 | } |
| 477 | } |
| 478 | // 9 Game 22: frosla vs frosla has adjourned. |
| 479 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("has adjourned"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 480 | { |
| 481 | int number = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, " "cxx . . $ QString#QString(85c52e162fed56f9)., ":"cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 482 | GameListingcxx . . $ GameListing# * aGame = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(number); |
| 483 | aGame->runningcxx . . $ GameListing#running. = false; |
| 484 | |
| 485 | // for information |
| 486 | //aGame->Sz = "has adjourned."; |
| 487 | |
| 488 | #ifdef OLD |
| 489 | //emit signal_game(aGame); |
| 490 | // //emit signal_move(aGame); |
| 491 | #endif //OLD |
| 492 | // No need to get existing listing because |
| 493 | // this is just to falsify the listing |
| 494 | room->recvGameListingcxx . . $ Room#recvGameListing(9a447f3b9a8a5041).(aGame); |
| 495 | } |
| 496 | // 9 Removing game 30 from observation list. |
| 497 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("from observation list"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 498 | { |
| 499 | // is done from qGoIF |
| 500 | // //emit signal_addToObservationList(-1); |
| 501 | // aGame->nr = element(line, 2, " ").toInt(); |
| 502 | // aGame->Sz = "-"; |
| 503 | // aGame->running = false; |
| 504 | //emit signal_observedGameClosed(element(line, 2, " ").toInt()); |
| 505 | return; |
| 506 | } |
| 507 | // 9 Adding game to observation list. |
| 508 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("to observation list"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 509 | { |
| 510 | /* Unfortunately, LGS and IGS have no number here, so |
| 511 | * we have to either guess or get it from the observe send |
| 512 | * which is easiest */ |
| 513 | getBoardDispatchcxx . . $ NetworkConnection#getBoardDispatch(f34f0704202202).(protocol_save_intcxx . . $ IGSConnection#protocol_save_int.); |
| 514 | protocol_save_intcxx . . $ IGSConnection#protocol_save_int. = -1; |
| 515 | return; |
| 516 | } |
| 517 | // 9 Games currently being observed: 31, 36, 45. |
| 518 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Games currently being observed"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 519 | { |
| 520 | if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("None"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 521 | { |
| 522 | //emit signal_addToObservationList(0); |
| 523 | } |
| 524 | else |
| 525 | { |
| 526 | #ifdef FIXME |
| 527 | // don't work correct at IGS!!! |
| 528 | int i = line.count(','); |
| 529 | qDebug(QString("observing %1 games").arg(i+1).toLatin1()); |
| 530 | // //emit signal_addToObservationList(i+1); |
| 531 | #endif //FIXME |
| 532 | } |
| 533 | |
| 534 | // return IT_OTHER; |
| 535 | } |
| 536 | // 9 1 minutes were added to your opponents clock |
| 537 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("minutes were added"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 538 | { |
| 539 | #ifdef FIXME |
| 540 | int t = element(line, 0, " ").toInt(); |
| 541 | emit signal_timeAdded(t, false); |
| 542 | #endif //FIXME |
| 543 | } |
| 544 | // 9 Your opponent has added 1 minutes to your clock. |
| 545 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("opponent has added"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 546 | { |
| 547 | #ifdef FIXME |
| 548 | int t = element(line, 4, " ").toInt(); |
| 549 | emit signal_timeAdded(t, true); |
| 550 | #endif //FIXME |
| 551 | } |
| 552 | // NNGS: 9 Game clock paused. Use "unpause" to resume. |
| 553 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Game clock paused"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 554 | { |
| 555 | #ifdef FIXME |
| 556 | emit signal_timeAdded(-1, true); |
| 557 | #endif //FIXME |
| 558 | } |
| 559 | // NNGS: 9 Game clock resumed. |
| 560 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Game clock resumed"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 561 | { |
| 562 | #ifdef FIXME |
| 563 | emit signal_timeAdded(-1, false); |
| 564 | #endif //FIXME |
| 565 | } |
| 566 | // 9 Increase frosla's time by 1 minute |
| 567 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("s time by"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 568 | { |
| 569 | #ifdef FIXME |
| 570 | int t = element(line, 4, " ").toInt(); |
| 571 | if (line.contains(getUsername())) |
| 572 | emit signal_timeAdded(t, true); |
| 573 | else |
| 574 | emit signal_timeAdded(t, false); |
| 575 | #endif //FIXME |
| 576 | } |
| 577 | // 9 Setting your . to Banana [text] (idle: 0 minutes) |
| 578 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Setting your . to"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 579 | { |
| 580 | QStringcxx . . $ QString# busy = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, "["cxx . . $ QString#QString(85c52e162fed56f9)., "]"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 581 | if (!busy.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 582 | { |
| 583 | QStringcxx . . $ QString# player = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 4, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 584 | // true = player |
| 585 | ////emit signal_talk(player, "[" + busy + "]", true); |
| 586 | } |
| 587 | } |
| 588 | /* I don't think we care about the case 9 messages like this. |
| 589 | * maybe in order to update the game lists !!! |
| 590 | * but not for the board. */ |
| 591 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("resigns."cxx . . $ QString#QString(85c52e162fed56f9).) || |
| 592 | line.containscxx . . $ QString#contains(8cce4688c16f48f3).("adjourned."cxx . . $ QString#QString(85c52e162fed56f9).) || |
| 593 | //don't intefere with status |
| 594 | //line.contains(" : W ", Qt::CaseSensitive) || |
| 595 | //line.contains(" : B ", Qt::CaseSensitive) || |
| 596 | line.containscxx . . $ QString#contains(8cce4688c16f48f3).("forfeits on"cxx . . $ QString#QString(85c52e162fed56f9).) || |
| 597 | line.containscxx . . $ QString#contains(8cce4688c16f48f3).("lost by"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 598 | { |
| 599 | GameResultcxx . . $ GameResult# * aGameResult; |
| 600 | int number = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, " "cxx . . $ QString#QString(85c52e162fed56f9)., ":"cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 601 | GameListingcxx . . $ GameListing# * aGame = room->getGameListingcxx . . $ Room#getGameListing(d402167d8f57cf00).(number); |
| 602 | aGame->runningcxx . . $ GameListing#running. = false; |
| 603 | // for information |
| 604 | aGame->resultcxx . . $ GameListing#result. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 4, " "cxx . . $ QString#QString(85c52e162fed56f9)., "}"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 605 | |
| 606 | boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(aGame->numbercxx . . $ GameListing#number.); |
| 607 | /* FIXME: This shouldn't create a new board if |
| 608 | * we're not watching it. |
| 609 | * Also WING sometimes sends 9 and sometimes sends 21 perhaps |
| 610 | * depending on whether its observed or resign versus score/result |
| 611 | * we don't want to send double messages.*/ |
| 612 | if(boarddispatch) |
| 613 | { |
| 614 | aGameResult = new GameResultcxx . . $ GameResult#(); |
| 615 | |
| 616 | if(line.containscxx . . $ QString#contains(8cce4688c16f48f3).(" : W "cxx . . $ QString#QString(85c52e162fed56f9)., Qtcxx . . $ Qt/::CaseSensitivecxx . . $ Qt/CaseSensitive.) || |
| 617 | line.containscxx . . $ QString#contains(8cce4688c16f48f3).(" : B "cxx . . $ QString#QString(85c52e162fed56f9)., Qtcxx . . $ Qt/::CaseSensitivecxx . . $ Qt/CaseSensitive.)) |
| 618 | { |
| 619 | aGameResult->resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::SCOREcxx . . $ GameResult#SCORE.; |
| 620 | |
| 621 | int posw, posb; |
| 622 | posw = aGame->resultcxx . . $ GameListing#result..indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).("W "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 623 | posb = aGame->resultcxx . . $ GameListing#result..indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).("B "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 624 | bool wfirst = posw < posb; |
| 625 | float sc1, sc2; |
| 626 | sc1 = aGame->resultcxx . . $ GameListing#result..midcxx . . $ QString#mid(44b7563da18aea72).(posw+1, posb-posw-2).toFloatcxx . . $ QString#toFloat(abac0204e50f9cf0).(); |
| 627 | //sc2 = aGame->result.right(aGame->result.length()-posb-1).toFloat(); |
| 628 | /* FIXME This may be right for IGS and wrong for WING */ |
| 629 | //sc2 = aGame->result.mid(posb +1, posb + 6).toFloat(); |
| 630 | sc2 = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(aGame->resultcxx . . $ GameListing#result., 4, " "cxx . . $ QString#QString(85c52e162fed56f9).).toFloatcxx . . $ QString#toFloat(abac0204e50f9cf0).(); |
| 631 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("sc1: %f sc2: %f\n", sc1, sc2); |
| 632 | if(sc1 > sc2) |
| 633 | { |
| 634 | aGameResult->winner_scorecxx . . $ GameResult#winner_score. = sc1; |
| 635 | aGameResult->loser_scorecxx . . $ GameResult#loser_score. = sc2; |
| 636 | } |
| 637 | else |
| 638 | { |
| 639 | aGameResult->winner_scorecxx . . $ GameResult#winner_score. = sc2; |
| 640 | aGameResult->loser_scorecxx . . $ GameResult#loser_score. = sc1; |
| 641 | |
| 642 | } |
| 643 | |
| 644 | if (!wfirst) |
| 645 | { |
| 646 | int h = posw; |
| 647 | posw = posb; |
| 648 | posb = h; |
| 649 | if(sc2 > sc1) |
| 650 | |
| 651 | aGameResult->winner_colorcxx . . $ GameResult#winner_color. = stoneWhitecxx . . $ stoneWhite.; |
| 652 | else |
| 653 | aGameResult->winner_colorcxx . . $ GameResult#winner_color. = stoneBlackcxx . . $ stoneBlack.; |
| 654 | } |
| 655 | else |
| 656 | { |
| 657 | if(sc1 > sc2) |
| 658 | aGameResult->winner_colorcxx . . $ GameResult#winner_color. = stoneWhitecxx . . $ stoneWhite.; |
| 659 | else |
| 660 | aGameResult->winner_colorcxx . . $ GameResult#winner_color. = stoneBlackcxx . . $ stoneBlack.; |
| 661 | } |
| 662 | |
| 663 | |
| 664 | } |
| 665 | else if(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("forfeits on time"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 666 | { |
| 667 | aGameResult->resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::TIMEcxx . . $ GameResult#TIME.; |
| 668 | if(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Black"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 669 | { |
| 670 | aGameResult->winner_colorcxx . . $ GameResult#winner_color. = stoneWhitecxx . . $ stoneWhite.; |
| 671 | } |
| 672 | else |
| 673 | { |
| 674 | aGameResult->winner_colorcxx . . $ GameResult#winner_color. = stoneBlackcxx . . $ stoneBlack.; |
| 675 | } |
| 676 | } |
| 677 | else if(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("resign"cxx . . $ QString#QString(85c52e162fed56f9)., Qtcxx . . $ Qt/::CaseInsensitivecxx . . $ Qt/CaseInsensitive.)) |
| 678 | { |
| 679 | aGameResult->resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::RESIGNcxx . . $ GameResult#RESIGN.; |
| 680 | if(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Black"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 681 | { |
| 682 | aGameResult->winner_colorcxx . . $ GameResult#winner_color. = stoneWhitecxx . . $ stoneWhite.; |
| 683 | } |
| 684 | else |
| 685 | { |
| 686 | aGameResult->winner_colorcxx . . $ GameResult#winner_color. = stoneBlackcxx . . $ stoneBlack.; |
| 687 | } |
| 688 | } |
| 689 | else if(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("lost by"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 690 | { |
| 691 | aGameResult->resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::SCOREcxx . . $ GameResult#SCORE.; |
| 692 | if(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Black"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 693 | { |
| 694 | aGameResult->winner_colorcxx . . $ GameResult#winner_color. = stoneWhitecxx . . $ stoneWhite.; |
| 695 | } |
| 696 | else |
| 697 | { |
| 698 | aGameResult->winner_colorcxx . . $ GameResult#winner_color. = stoneBlackcxx . . $ stoneBlack.; |
| 699 | |
| 700 | } |
| 701 | |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | |
| 706 | if (aGame->resultcxx . . $ GameListing#result..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 707 | aGame->resultcxx . . $ GameListing#result. =cxx . . $ QString#`operator=`(d02845eef0c33901). "-"; |
| 708 | else if (aGame->resultcxx . . $ GameListing#result..indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).(":"cxx . . $ QString#QString(85c52e162fed56f9).) != -1) |
| 709 | aGame->resultcxx . . $ GameListing#result..removecxx . . $ QString#remove(6483560ce2afa901).(0,2); |
| 710 | |
| 711 | if(boarddispatch) |
| 712 | { |
| 713 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("Receiving result!!!"); |
| 714 | boarddispatch->recvResultcxx . . $ BoardDispatch#recvResult(c72a8b5aed169521).(aGameResult); |
| 715 | /* is kibitzing this here what we want?*/ |
| 716 | /* FIXME... should be a shortened list, not the full |
| 717 | * result msg kibitz */ |
| 718 | boarddispatch->recvKibitzcxx . . $ BoardDispatch#recvKibitz(3458fe3960d5051).(""cxx . . $ QString#QString(85c52e162fed56f9)., linecxx . . $ QString#QString(132dd6869045752b).); |
| 719 | } |
| 720 | room->recvGameListingcxx . . $ Room#recvGameListing(9a447f3b9a8a5041).(aGame); |
| 721 | return; |
| 722 | } |
| 723 | // NNGS: 9 Messages: (after 'message' cmd) |
| 724 | // 8 File |
| 725 | // <msg> |
| 726 | // 8 File |
| 727 | // 9 Please type "erase" to erase your messages after reading |
| 728 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Messages:"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 729 | { |
| 730 | // parse like IGS cmd nr 14: Messages |
| 731 | memory = 14; |
| 732 | } |
| 733 | // IGS: 9 You have a message. To read your messages, type: message |
| 734 | // NNGS: 9 You have 1 messages. Type "messages" to display them |
| 735 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("You have"cxx . . $ QString#QString(85c52e162fed56f9).) && line.containscxx . . $ QString#contains(8cce4688c16f48f3).("messages"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 736 | { |
| 737 | // remove cmd nr |
| 738 | line =cxx . . $ QString#`operator=`(4f35bf974e7f8568). line.trimmedcxx . . $ QString#trimmed(dca2c5857e9adf82).(); |
| 739 | line =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). line.removecxx . . $ QString#remove(6483560ce2afa901).(0, 2); |
| 740 | getConsoleDispatchcxx . . $ NetworkConnection#getConsoleDispatch(5304ece8b917e47).()->recvTextcxx . . $ ConsoleDispatch#recvText(85c52e162fed56f9).(line.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 741 | return; |
| 742 | } |
| 743 | // 9 Observing game 2 (chmeng vs. myao) : |
| 744 | // 9 shanghai 9k* henry 15k |
| 745 | // 9 Found 2 observers. |
| 746 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Observing game "cxx . . $ QString#QString(85c52e162fed56f9)., Qtcxx . . $ Qt/::CaseSensitivecxx . . $ Qt/CaseSensitive.)) |
| 747 | { |
| 748 | // right now: only need for observers of teaching game |
| 749 | // game number |
| 750 | bool ok; |
| 751 | memory = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 2, " "cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(&ok); |
| 752 | if (ok) |
| 753 | { |
| 754 | memory_str =cxx . . $ QString#`operator=`(d02845eef0c33901). "observe"; |
| 755 | // FIXME |
| 756 | //emit signal_clearObservers(memory); |
| 757 | BoardDispatchcxx . . $ BoardDispatch# * boarddispatch = getIfBoardDispatchcxx . . $ NetworkConnection#getIfBoardDispatch(f34f0704202202).(memory); |
| 758 | if(boarddispatch) |
| 759 | { |
| 760 | GameDatacxx . . $ GameData# * g = boarddispatch->getGameDatacxx . . $ BoardDispatch#getGameData(f917540193955ea7).(); |
| 761 | g->white_namecxx . . $ GameData#white_name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, "("cxx . . $ QString#QString(85c52e162fed56f9)., " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 762 | g->black_namecxx . . $ GameData#black_name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 4, " "cxx . . $ QString#QString(85c52e162fed56f9)., ")"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 763 | boarddispatch->gameDataChangedcxx . . $ BoardDispatch#gameDataChanged(49f6e7a06ebc5aa8).(); |
| 764 | } |
| 765 | return; |
| 766 | } |
| 767 | } |
| 768 | else if (!memory_str.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).() && memory_str ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "observe" && line.containscxx . . $ QString#contains(8cce4688c16f48f3).("."cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 769 | { |
| 770 | // QString cnt = element(line, 1, " "); |
| 771 | // //emit signal_kibitz(memory, "00", ""); |
| 772 | |
| 773 | memory = 0; |
| 774 | memory_str =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(ced63f7c635d850d).(); |
| 775 | |
| 776 | return; |
| 777 | } |
| 778 | else if (!memory_str.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).() && memory_str ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "observe") |
| 779 | { |
| 780 | QStringcxx . . $ QString# name = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 781 | QStringcxx . . $ QString# rankcxx . . $ QString#QString(ced63f7c635d850d).; |
| 782 | boarddispatch = getBoardDispatchcxx . . $ NetworkConnection#getBoardDispatch(f34f0704202202).(memory); |
| 783 | if(!boarddispatch) |
| 784 | { |
| 785 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No boarddispatch for observer list\n"); |
| 786 | return; |
| 787 | } |
| 788 | |
| 789 | for (int i = 1; ! name.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).(); i++) |
| 790 | { |
| 791 | rank =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, i, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 792 | fixRankStringcxx . . $ IGSConnection#fixRankString(ee39f32778c92bb9).(&rank); |
| 793 | // send as kibitz from "0" |
| 794 | PlayerListingcxx . . $ PlayerListing# * p = getPlayerListingNeverFailcxx . . $ IGSConnection#getPlayerListingNeverFail(38be696f4c5aa948).(name); |
| 795 | boarddispatch->recvObservercxx . . $ BoardDispatch#recvObserver(fcd883ebbd0934ee).(p, true); |
| 796 | name =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, ++i , " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 797 | } |
| 798 | |
| 799 | return; |
| 800 | } |
| 801 | else if(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Found"cxx . . $ QString#QString(85c52e162fed56f9).) && line.containscxx . . $ QString#contains(8cce4688c16f48f3).("observers"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 802 | { |
| 803 | memory = 0; |
| 804 | memory_str =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(ced63f7c635d850d).(); |
| 805 | } |
| 806 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("****"cxx . . $ QString#QString(85c52e162fed56f9).) && line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Players"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 807 | return; |
| 808 | |
| 809 | // 9 qGoDev has resigned the game. |
| 810 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("has resigned the game"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 811 | { |
| 812 | boarddispatch = getBoardDispatchcxx . . $ NetworkConnection#getBoardDispatch(f34f0704202202).(memory); |
| 813 | if(!boarddispatch) |
| 814 | { |
| 815 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No board dispatch for \"resigned the game\"\n"); |
| 816 | return; |
| 817 | } |
| 818 | #ifdef FIXME |
| 819 | aGame->running = false; |
| 820 | #endif //FIXME |
| 821 | |
| 822 | GameResultcxx . . $ GameResult# * aGameResult = new GameResultcxx . . $ GameResult#(); |
| 823 | aGameResult->loser_namecxx . . $ GameResult#loser_name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 824 | aGameResult->resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::RESIGNcxx . . $ GameResult#RESIGN.; |
| 825 | /* We need to set unknown/none color here */ |
| 826 | boarddispatch->recvResultcxx . . $ BoardDispatch#recvResult(c72a8b5aed169521).(aGameResult); |
| 827 | return; |
| 828 | |
| 829 | } |
| 830 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("has run out of time"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 831 | { |
| 832 | boarddispatch = getBoardDispatchcxx . . $ NetworkConnection#getBoardDispatch(f34f0704202202).(protocol_save_intcxx . . $ IGSConnection#protocol_save_int.); |
| 833 | if(!boarddispatch) |
| 834 | { |
| 835 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("No board dispatch for \"has run out of time\"\n"); |
| 836 | return; |
| 837 | } |
| 838 | #ifdef FIXME |
| 839 | aGame->running = false; |
| 840 | #endif //FIXME |
| 841 | |
| 842 | GameResultcxx . . $ GameResult# * aGameResult = new GameResultcxx . . $ GameResult#(); |
| 843 | aGameResult->loser_namecxx . . $ GameResult#loser_name. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 844 | aGameResult->resultcxx . . $ GameResult#result. = GameResultcxx . . $ GameResult#::TIMEcxx . . $ GameResult#TIME.; |
| 845 | /* We need to set unknown/none color here */ |
| 846 | boarddispatch->recvResultcxx . . $ BoardDispatch#recvResult(c72a8b5aed169521).(aGameResult); |
| 847 | return; |
| 848 | |
| 849 | } |
| 850 | |
| 851 | |
| 852 | |
| 853 | //9 Player: yfh2 |
| 854 | //9 Game: go (1) |
| 855 | //9 Language: default |
| 856 | //9 Rating: 6k* 23 |
| 857 | //9 Rated Games: 21 |
| 858 | //9 Rank: 8k 21 |
| 859 | //9 Wins: 13 |
| 860 | //9 Losses: 16 |
| 861 | //9 Idle Time: (On server) 0s |
| 862 | //9 Address: [email protected] |
| 863 | //9 Country: France |
| 864 | //9 Reg date: Tue Nov 18 04:01:05 2003 |
| 865 | //9 Info: yfh2 |
| 866 | //9 Defaults (help defs): time 0, size 0, byo-yomi time 0, byo-yomi stones 0 |
| 867 | //9 Verbose Bell Quiet Shout Automail Open Looking Client Kibitz Chatter |
| 868 | //9 Off On On On On Off Off On On On |
| 869 | |
| 870 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Player:"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 871 | { |
| 872 | QStringcxx . . $ QString# name = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 1, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 873 | statsPlayer = getPlayerListingNeverFailcxx . . $ IGSConnection#getPlayerListingNeverFail(38be696f4c5aa948).(name); |
| 874 | #ifdef FIXME |
| 875 | /* So this would have cleared the structure, but |
| 876 | * we're just creating a new empty object later. |
| 877 | * One HUGE FIXME question is what we might be |
| 878 | * overriding on the other side. Maybe we need |
| 879 | * a bit vector specifying what has updated when |
| 880 | * the message is passed. So the notion before |
| 881 | * was that the structure was held until |
| 882 | * completely filled and then passed up*/ |
| 883 | |
| 884 | statsPlayer->extInfo = ""; |
| 885 | statsPlayer->won = ""; |
| 886 | statsPlayer->lost = ""; |
| 887 | statsPlayer->country = ""; |
| 888 | statsPlayer->nmatch_settings = ""; |
| 889 | statsPlayer->rank = ""; |
| 890 | statsPlayer->info = ""; |
| 891 | statsPlayer->address = ""; |
| 892 | statsPlayer->play_str = ""; |
| 893 | statsPlayer->obs_str = ""; |
| 894 | statsPlayer->idle = ""; |
| 895 | statsPlayer->rated = ""; |
| 896 | // not sure it is the best way : above code seem to make use of "signal" |
| 897 | // but we don't need this apparently for handling stats |
| 898 | #endif //FIXME |
| 899 | protocol_save_stringcxx . . $ IGSConnection#protocol_save_string. =cxx . . $ QString#`operator=`(d02845eef0c33901). "STATS"; |
| 900 | return; |
| 901 | } |
| 902 | |
| 903 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Address:"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 904 | { |
| 905 | statsPlayer->email_addresscxx . . $ PlayerListing#email_address. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 1, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 906 | return; |
| 907 | } |
| 908 | |
| 909 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Last Access"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 910 | { |
| 911 | statsPlayer->idletimecxx . . $ PlayerListing#idletime. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 4, " "cxx . . $ QString#QString(85c52e162fed56f9).)+cxx . . $ operator+(3d22f08efddf8107). " " +cxx . . $ operator+(fab9b4f80031f353). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 5, " "cxx . . $ QString#QString(85c52e162fed56f9).)+cxx . . $ operator+(3d22f08efddf8107)." " +cxx . . $ operator+(fab9b4f80031f353). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 6, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 912 | statsPlayer->seconds_idlecxx . . $ PlayerListing#seconds_idle. = idleTimeToSecondscxx . . $ IGSConnection#idleTimeToSeconds(9d92bb507a34628c).(statsPlayercxx . . $ QString#QString(132dd6869045752b).->idletimecxx . . $ PlayerListing#idletime.); |
| 913 | return; |
| 914 | } |
| 915 | |
| 916 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Rating:"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 917 | { |
| 918 | statsPlayer->rankcxx . . $ PlayerListing#rank. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 1, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 919 | fixRankStringcxx . . $ IGSConnection#fixRankString(ee39f32778c92bb9).(&(statsPlayer->rankcxx . . $ PlayerListing#rank.)); |
| 920 | statsPlayer->rank_scorecxx . . $ PlayerListing#rank_score. = rankToScorecxx . . $ IGSConnection#rankToScore(9d92bb507a34628c).(statsPlayercxx . . $ QString#QString(132dd6869045752b).->rankcxx . . $ PlayerListing#rank.); |
| 921 | return; |
| 922 | } |
| 923 | |
| 924 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Wins:"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 925 | { |
| 926 | statsPlayer->winscxx . . $ PlayerListing#wins. = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 1, " "cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 927 | return; |
| 928 | } |
| 929 | |
| 930 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Losses:"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 931 | { |
| 932 | statsPlayer->lossescxx . . $ PlayerListing#losses. = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 1, " "cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 933 | return; |
| 934 | } |
| 935 | |
| 936 | else if ((line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Country:"cxx . . $ QString#QString(85c52e162fed56f9).))||(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("From:"cxx . . $ QString#QString(85c52e162fed56f9).))) //IGS || LGS |
| 937 | { |
| 938 | statsPlayer->countrycxx . . $ PlayerListing#country. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 0, " "cxx . . $ QString#QString(85c52e162fed56f9).,"EOL"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 939 | return; |
| 940 | } |
| 941 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("User Level:"cxx . . $ QString#QString(85c52e162fed56f9).)) //LGS |
| 942 | { |
| 943 | statsPlayer->extInfocxx . . $ PlayerListing#extInfo. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). line; |
| 944 | return; |
| 945 | } |
| 946 | |
| 947 | |
| 948 | else if ((line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Info:"cxx . . $ QString#QString(85c52e162fed56f9).))&& !(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Rank Info:"cxx . . $ QString#QString(85c52e162fed56f9).))) |
| 949 | { |
| 950 | #ifdef FIXME |
| 951 | if (! statsPlayer->info.isEmpty()) |
| 952 | statsPlayer->info.append("\n"); |
| 953 | statsPlayer->info.append(line); |
| 954 | //emit signal_statsPlayer(statsPlayer); |
| 955 | #endif //FIXME |
| 956 | return; |
| 957 | } |
| 958 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Idle Time:"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 959 | { |
| 960 | statsPlayer->idletimecxx . . $ PlayerListing#idletime. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 2, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 961 | statsPlayer->seconds_idlecxx . . $ PlayerListing#seconds_idle. = idleTimeToSecondscxx . . $ IGSConnection#idleTimeToSeconds(9d92bb507a34628c).(statsPlayercxx . . $ QString#QString(132dd6869045752b).->idletimecxx . . $ PlayerListing#idletime.); |
| 962 | return; |
| 963 | } |
| 964 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Playing in game:"cxx . . $ QString#QString(85c52e162fed56f9).)) //IGS and LGS |
| 965 | { |
| 966 | statsPlayer->playingcxx . . $ PlayerListing#playing. = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 3, " "cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 967 | |
| 968 | return; |
| 969 | } |
| 970 | /*else if (line.contains("(playing game")) |
| 971 | { |
| 972 | //FIXME this is missing!! |
| 973 | statsPlayer->playing = element(line, 1, " ",":").toInt(); |
| 974 | return; |
| 975 | }*/ |
| 976 | else if (line.leftcxx . . $ QString#left(3f3c3d0e9c0eb37f).(5) ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "19x19") //LGS syntax |
| 977 | { |
| 978 | statsPlayer->rankcxx . . $ PlayerListing#rank. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 4, " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 979 | fixRankStringcxx . . $ IGSConnection#fixRankString(ee39f32778c92bb9).(&(statsPlayer->rankcxx . . $ PlayerListing#rank.)); |
| 980 | statsPlayer->rank_scorecxx . . $ PlayerListing#rank_score. = rankToScorecxx . . $ IGSConnection#rankToScore(9d92bb507a34628c).(statsPlayercxx . . $ QString#QString(132dd6869045752b).->rankcxx . . $ PlayerListing#rank.); |
| 981 | statsPlayer->rated_gamescxx . . $ PlayerListing#rated_games. = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 7, " "cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 982 | return; |
| 983 | } |
| 984 | |
| 985 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Wins/Losses"cxx . . $ QString#QString(85c52e162fed56f9).)) //LGS syntax |
| 986 | { |
| 987 | statsPlayer->winscxx . . $ PlayerListing#wins. = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 2, " "cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 988 | statsPlayer->lossescxx . . $ PlayerListing#losses. = elementcxx . . $ IGSConnection#element(b18f0c69f8da8728).(line, 4, " "cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 989 | return; |
| 990 | } |
| 991 | |
| 992 | else if (line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Last Access"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 993 | { |
| 994 | statsPlayer->idletimecxx . . $ PlayerListing#idletime. =cxx . . $ QString#`operator=`(d02845eef0c33901). "not on"; |
| 995 | return; |
| 996 | } |
| 997 | |
| 998 | else if(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("Full Name"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 999 | { |
| 1000 | if(statsPlayer) |
| 1001 | { |
| 1002 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!("talk name: %s", statsPlayer->namecxx . . $ PlayerListing#name..toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 1003 | Talkcxx . . $ Talk# * talk = getDefaultRoomcxx . . $ NetworkConnection#getDefaultRoom(93e93f117be81b18).()->getTalkcxx . . $ Room#getTalk(e709c6e389e35213).(statsPlayer); |
| 1004 | if(talk) |
| 1005 | talk->updatePlayerListingcxx . . $ Talk#updatePlayerListing(49f6e7a06ebc5aa8).(); |
| 1006 | statsPlayer = 0; |
| 1007 | } |
| 1008 | } |
| 1009 | |
| 1010 | //9 ROOM 01: FREE GAME ROOM;PSMNYACF;自由対局室;19;1;10;1,19,60,600,30,25,10,60,0 |
| 1011 | //9 ROOM 10: SLOW GAME ROOM;PSMNYACF;スロー対局室;19;1;20 |
| 1012 | //9 ROOM 92: PANDA OPEN ROOM;X;月例大会;19;10;15 |
| 1013 | else if (! line.leftcxx . . $ QString#left(3f3c3d0e9c0eb37f).(5).comparecxx . . $ QString#compare(c6f75f9b1a93e019).("ROOM "cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 1014 | { |
| 1015 | |
| 1016 | //emit signal_room(element(line,0," ",";"),(element(line, 1,";")=="X") || (element(line, 1,";")=="P")); |
| 1017 | return; |
| 1018 | } |
| 1019 | else if(line.containscxx . . $ QString#contains(8cce4688c16f48f3).("File"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 1020 | return; |
| 1021 | if (protocol_save_stringcxx . . $ IGSConnection#protocol_save_string. !=cxx . . $ QString#`operator!=`(7d4bdb1abc417636). "STATS") |
| 1022 | getConsoleDispatchcxx . . $ NetworkConnection#getConsoleDispatch(5304ece8b917e47).()->recvTextcxx . . $ ConsoleDispatch#recvText(85c52e162fed56f9).(line.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 1023 | } |
| 1024 | #ifdef OLD |
| 1025 | void WING_kibitz::handleMsg(QString line) |
| 1026 | { |
| 1027 | static QString memory_str; |
| 1028 | static int memory = 0; |
| 1029 | line = line.remove(0, 2).trimmed(); |
| 1030 | BoardDispatch * boarddispatch; |
| 1031 | qDebug("kibitz: %s", line.toLatin1().constData()); |
| 1032 | if (line.contains("Kibitz")) |
| 1033 | { |
| 1034 | // who is kibitzer |
| 1035 | memory_str = element(line, 0, " ", ":"); |
| 1036 | // game number |
| 1037 | memory = element(line, 1, "[", "]").toInt(); |
| 1038 | } |
| 1039 | else |
| 1040 | { |
| 1041 | if (memory_str.isEmpty()) |
| 1042 | // something went wrong... |
| 1043 | return; |
| 1044 | if(line.contains("Starting observation")) |
| 1045 | { |
| 1046 | QString name = element(memory_str, 0 , " "); |
| 1047 | QString rank = element(memory_str, 1, "[", "]"); |
| 1048 | fixRankString(&rank); |
| 1049 | qDebug("%s %s joining", name.toLatin1().constData(), rank.toLatin1().constData()); |
| 1050 | // send as kibitz from "0" |
| 1051 | ObserverListing ob(true, name, rank, rankToScore(rank)); |
| 1052 | boarddispatch = getBoardDispatch(memory); |
| 1053 | if(!boarddispatch) |
| 1054 | { |
| 1055 | qDebug("No board dispatch for this game!"); |
| 1056 | return; |
| 1057 | } |
| 1058 | boarddispatch->recvObserver(&ob); |
| 1059 | memory = 0; |
| 1060 | memory_str.clear(); |
| 1061 | return; |
| 1062 | } |
| 1063 | else if(line.contains("has entered byo-yomi again") || |
| 1064 | line.contains("is entering byo-yomi")) |
| 1065 | { |
| 1066 | qDebug("byo-yomi message"); |
| 1067 | memory = 0; |
| 1068 | memory_str.clear(); |
| 1069 | // just ignore though we could FIXME use it to |
| 1070 | // reset the time |
| 1071 | return; |
| 1072 | } |
| 1073 | else if(memory_str.contains("SgfComment")) |
| 1074 | { |
| 1075 | if(line.contains("dead @")) |
| 1076 | { |
| 1077 | boarddispatch = getBoardDispatch(memory); |
| 1078 | if(!boarddispatch) |
| 1079 | { |
| 1080 | qDebug("No board dispatch for this game!"); |
| 1081 | return; |
| 1082 | } |
| 1083 | boarddispatch->recvEnterScoreMode(); |
| 1084 | /* FIXME What if we're already in score mode, |
| 1085 | * what about the double pass signifying this??? */ |
| 1086 | MoveRecord * aMove = new MoveRecord(); |
| 1087 | aMove->flags = MoveRecord::REMOVE; |
| 1088 | QString point = element(line, 5, " ", "EOL"); |
| 1089 | qDebug("Removal point: %s", point.toLatin1().constData()); |
| 1090 | |
| 1091 | aMove->x = (int)(point.toLatin1().at(0)); |
| 1092 | aMove->x -= 'A'; |
| 1093 | point.remove(0,1); |
| 1094 | aMove->y = element(point, 0, " ").toInt(); |
| 1095 | GameListing * l = getDefaultRoom()->getGameListing(memory); |
| 1096 | if(!l) |
| 1097 | { |
| 1098 | qDebug("Move for unlisted game"); |
| 1099 | delete aMove; |
| 1100 | return; |
| 1101 | } |
| 1102 | if(l->board_size > 9) |
| 1103 | { |
| 1104 | if(aMove->x < 9) //no I on IGS |
| 1105 | aMove->x++; |
| 1106 | aMove->y = 20 - aMove->y; |
| 1107 | } |
| 1108 | boarddispatch->recvMove(aMove); |
| 1109 | delete aMove; |
| 1110 | } |
| 1111 | memory = 0; |
| 1112 | memory_str.clear(); |
| 1113 | return; |
| 1114 | } |
| 1115 | /* FIXME: Kibitz has this ugly little "->" which we might |
| 1116 | * want to cut off */ |
| 1117 | //emit signal_kibitz(memory, memory_str, line); |
| 1118 | boarddispatch = getBoardDispatch(memory); |
| 1119 | if(boarddispatch) |
| 1120 | boarddispatch->recvKibitz(memory_str, line); |
| 1121 | memory = 0; |
| 1122 | memory_str.clear(); |
| 1123 | } |
| 1124 | } |
| 1125 | #endif //OLD |