Debian Codegraph @

src/network/wing.cpp

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