Debian Codegraph @

src/bnetd/handle_wol.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2001 Marco Ziech ([email protected])
3 * Copyright (C) 2005 Bryan Biedenkapp ([email protected])
4 * Copyright (C) 2006,2007,2008 Pelish ([email protected])
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (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, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/
22 #include "handle_wol.h"cxx . . $ `<file>/src/bnetd/handle_wol.h`/
23
24 #include <cctype>
25 #include <cinttypes>
26 #include <cstdint>
27 #include <cstdlib>
28 #include <cstring>
29
30 #include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/
31 #include "common/irc_protocol.h"cxx . . $ `<file>/src/common/irc_protocol.h`/
32 #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/
33 #include "common/bnethash.h"cxx . . $ `<file>/src/common/bnethash.h`/
34 #include "common/tag.h"cxx . . $ `<file>/src/common/tag.h`/
35 #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/
36 #include "common/list.h"cxx . . $ `<file>/src/common/list.h`/
37 #include "common/addr.h"cxx . . $ `<file>/src/common/addr.h`/
38 #include "common/trans.h"cxx . . $ `<file>/src/common/trans.h`/
39 #include "common/xstring.h"cxx . . $ `<file>/src/common/xstring.h`/
40
41 #include "common/packet.h"cxx . . $ `<file>/src/common/packet.h`/
42
43 #include "prefs.h"cxx . . $ `<file>/src/bnetd/prefs.h`/
44 #include "command.h"cxx . . $ `<file>/src/bnetd/command.h`/
45 #include "irc.h"cxx . . $ `<file>/src/bnetd/irc.h`/
46 #include "account.h"cxx . . $ `<file>/src/bnetd/account.h`/
47 #include "account_wrap.h"cxx . . $ `<file>/src/bnetd/account_wrap.h`/
48 #include "command_groups.h"cxx . . $ `<file>/src/bnetd/command_groups.h`/
49 #include "channel.h"cxx . . $ `<file>/src/bnetd/channel.h`/
50 #include "message.h"cxx . . $ `<file>/src/bnetd/message.h`/
51 #include "tick.h"cxx . . $ `<file>/src/bnetd/tick.h`/
52 #include "topic.h"cxx . . $ `<file>/src/bnetd/topic.h`/
53 #include "server.h"cxx . . $ `<file>/src/bnetd/server.h`/
54 #include "friends.h"cxx . . $ `<file>/src/bnetd/friends.h`/
55 #include "clan.h"cxx . . $ `<file>/src/bnetd/clan.h`/
56 #include "game.h"cxx . . $ `<file>/src/bnetd/game.h`/
57 #include "anongame_wol.h"cxx . . $ `<file>/src/bnetd/anongame_wol.h`/
58 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
59
60 namespace pvpgncxx . . $ pvpgn/
61 {
62
63 namespace bnetdcxx . . $ pvpgn/bnetd/
64 {
65
66 typedef int(*t_wol_commandcxx . . $ pvpgn/bnetd/t_wol_command#)(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
67
68 typedef structcxx . . $ pvpgn/bnetd/$anonymous_type_9c303aa629c1cbb7_0# {
69 const char * wol_command_stringcxx . . $ pvpgn/bnetd/$anonymous_type_9c303aa629c1cbb7_0#wol_command_string.;
70 t_wol_commandcxx . . $ pvpgn/bnetd/t_wol_command# wol_command_handlercxx . . $ pvpgn/bnetd/$anonymous_type_9c303aa629c1cbb7_0#wol_command_handler.;
71 } t_wol_command_table_rowcxx . . $ pvpgn/bnetd/t_wol_command_table_row#;
72
73 static int _handle_user_commandcxx . . $ pvpgn/bnetd/_handle_user_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
74 static int _handle_pass_commandcxx . . $ pvpgn/bnetd/_handle_pass_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
75 static int _handle_privmsg_commandcxx . . $ pvpgn/bnetd/_handle_privmsg_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
76 static int _handle_quit_commandcxx . . $ pvpgn/bnetd/_handle_quit_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
77
78 static int _handle_list_commandcxx . . $ pvpgn/bnetd/_handle_list_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
79 static int _handle_names_commandcxx . . $ pvpgn/bnetd/_handle_names_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
80 static int _handle_part_commandcxx . . $ pvpgn/bnetd/_handle_part_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
81
82 static int _handle_cvers_commandcxx . . $ pvpgn/bnetd/_handle_cvers_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
83 static int _handle_verchk_commandcxx . . $ pvpgn/bnetd/_handle_verchk_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
84 static int _handle_apgar_commandcxx . . $ pvpgn/bnetd/_handle_apgar_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
85 static int _handle_setopt_commandcxx . . $ pvpgn/bnetd/_handle_setopt_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
86 static int _handle_serial_commandcxx . . $ pvpgn/bnetd/_handle_serial_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
87
88 static int _handle_squadinfo_commandcxx . . $ pvpgn/bnetd/_handle_squadinfo_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
89 static int _handle_clanbyname_commandcxx . . $ pvpgn/bnetd/_handle_clanbyname_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
90 static int _handle_setcodepage_commandcxx . . $ pvpgn/bnetd/_handle_setcodepage_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
91 static int _handle_getcodepage_commandcxx . . $ pvpgn/bnetd/_handle_getcodepage_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
92 static int _handle_setlocale_commandcxx . . $ pvpgn/bnetd/_handle_setlocale_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
93 static int _handle_getlocale_commandcxx . . $ pvpgn/bnetd/_handle_getlocale_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
94 static int _handle_getinsider_commandcxx . . $ pvpgn/bnetd/_handle_getinsider_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
95 static int _handle_joingame_commandcxx . . $ pvpgn/bnetd/_handle_joingame_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
96 static int _handle_gameopt_commandcxx . . $ pvpgn/bnetd/_handle_gameopt_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
97 static int _handle_finduser_commandcxx . . $ pvpgn/bnetd/_handle_finduser_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
98 static int _handle_finduserex_commandcxx . . $ pvpgn/bnetd/_handle_finduserex_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
99 static int _handle_page_commandcxx . . $ pvpgn/bnetd/_handle_page_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
100 static int _handle_startg_commandcxx . . $ pvpgn/bnetd/_handle_startg_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
101 static int _handle_advertr_commandcxx . . $ pvpgn/bnetd/_handle_advertr_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
102 static int _handle_advertc_commandcxx . . $ pvpgn/bnetd/_handle_advertc_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
103 static int _handle_chanchk_commandcxx . . $ pvpgn/bnetd/_handle_chanchk_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
104 static int _handle_getbuddy_commandcxx . . $ pvpgn/bnetd/_handle_getbuddy_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
105 static int _handle_addbuddy_commandcxx . . $ pvpgn/bnetd/_handle_addbuddy_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
106 static int _handle_delbuddy_commandcxx . . $ pvpgn/bnetd/_handle_delbuddy_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
107 static int _handle_host_commandcxx . . $ pvpgn/bnetd/_handle_host_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
108 static int _handle_invmsg_commandcxx . . $ pvpgn/bnetd/_handle_invmsg_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
109 static int _handle_invdel_commandcxx . . $ pvpgn/bnetd/_handle_invdel_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
110 static int _handle_userip_commandcxx . . $ pvpgn/bnetd/_handle_userip_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
111
112 /* Ladder server commands (we will probalby move this commands to any another handle file */
113 static int _handle_listsearch_commandcxx . . $ pvpgn/bnetd/_handle_listsearch_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
114 static int _handle_rungsearch_commandcxx . . $ pvpgn/bnetd/_handle_rungsearch_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
115 static int _handle_highscore_commandcxx . . $ pvpgn/bnetd/_handle_highscore_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text);
116
117 /* state "connected" handlers */
118 static const t_wol_command_table_rowcxx . . $ pvpgn/bnetd/t_wol_command_table_row# wol_con_command_tablecxx . . $ pvpgn/bnetd/wol_con_command_table.[] =
119 {
120 { "NICK", _handle_nick_commandcxx . . $ pvpgn/bnetd/_handle_nick_command(93df5f0f7c1da4a4). },
121 { "USER", _handle_user_commandcxx . . $ pvpgn/bnetd/_handle_user_command(93df5f0f7c1da4a4). },
122 { "PING", _handle_ping_commandcxx . . $ pvpgn/bnetd/_handle_ping_command(93df5f0f7c1da4a4). },
123 { "PONG", _handle_pong_commandcxx . . $ pvpgn/bnetd/_handle_pong_command(93df5f0f7c1da4a4). },
124 { "PASS", _handle_pass_commandcxx . . $ pvpgn/bnetd/_handle_pass_command(93df5f0f7c1da4a4). },
125 { "PRIVMSG", _handle_privmsg_commandcxx . . $ pvpgn/bnetd/_handle_privmsg_command(93df5f0f7c1da4a4). },
126 { "QUIT", _handle_quit_commandcxx . . $ pvpgn/bnetd/_handle_quit_command(93df5f0f7c1da4a4). },
127
128 { "CVERS", _handle_cvers_commandcxx . . $ pvpgn/bnetd/_handle_cvers_command(93df5f0f7c1da4a4). },
129 { "VERCHK", _handle_verchk_commandcxx . . $ pvpgn/bnetd/_handle_verchk_command(93df5f0f7c1da4a4). },
130 { "APGAR", _handle_apgar_commandcxx . . $ pvpgn/bnetd/_handle_apgar_command(93df5f0f7c1da4a4). },
131 { "SETOPT", _handle_setopt_commandcxx . . $ pvpgn/bnetd/_handle_setopt_command(93df5f0f7c1da4a4). },
132 { "SERIAL", _handle_serial_commandcxx . . $ pvpgn/bnetd/_handle_serial_command(93df5f0f7c1da4a4). },
133
134 /* Ladder server commands */
135 { "LISTSEARCH", _handle_listsearch_commandcxx . . $ pvpgn/bnetd/_handle_listsearch_command(93df5f0f7c1da4a4). },
136 { "RUNGSEARCH", _handle_rungsearch_commandcxx . . $ pvpgn/bnetd/_handle_rungsearch_command(93df5f0f7c1da4a4). },
137 { "HIGHSCORE", _handle_highscore_commandcxx . . $ pvpgn/bnetd/_handle_highscore_command(93df5f0f7c1da4a4). },
138
139 { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! }
140 };
141
142 /* state "logged in" handlers */
143 static const t_wol_command_table_rowcxx . . $ pvpgn/bnetd/t_wol_command_table_row# wol_log_command_tablecxx . . $ pvpgn/bnetd/wol_log_command_table.[] =
144 {
145 { "LIST", _handle_list_commandcxx . . $ pvpgn/bnetd/_handle_list_command(93df5f0f7c1da4a4). },
146 { "TOPIC", _handle_topic_commandcxx . . $ pvpgn/bnetd/_handle_topic_command(93df5f0f7c1da4a4). },
147 { "JOIN", _handle_join_commandcxx . . $ pvpgn/bnetd/_handle_join_command(93df5f0f7c1da4a4). },
148 { "NAMES", _handle_names_commandcxx . . $ pvpgn/bnetd/_handle_names_command(93df5f0f7c1da4a4). },
149 { "PART", _handle_part_commandcxx . . $ pvpgn/bnetd/_handle_part_command(93df5f0f7c1da4a4). },
150
151 { "SQUADINFO", _handle_squadinfo_commandcxx . . $ pvpgn/bnetd/_handle_squadinfo_command(93df5f0f7c1da4a4). },
152 { "CLANBYNAME", _handle_clanbyname_commandcxx . . $ pvpgn/bnetd/_handle_clanbyname_command(93df5f0f7c1da4a4). },
153 { "SETCODEPAGE", _handle_setcodepage_commandcxx . . $ pvpgn/bnetd/_handle_setcodepage_command(93df5f0f7c1da4a4). },
154 { "SETLOCALE", _handle_setlocale_commandcxx . . $ pvpgn/bnetd/_handle_setlocale_command(93df5f0f7c1da4a4). },
155 { "GETCODEPAGE", _handle_getcodepage_commandcxx . . $ pvpgn/bnetd/_handle_getcodepage_command(93df5f0f7c1da4a4). },
156 { "GETLOCALE", _handle_getlocale_commandcxx . . $ pvpgn/bnetd/_handle_getlocale_command(93df5f0f7c1da4a4). },
157 { "GETINSIDER", _handle_getinsider_commandcxx . . $ pvpgn/bnetd/_handle_getinsider_command(93df5f0f7c1da4a4). },
158 { "JOINGAME", _handle_joingame_commandcxx . . $ pvpgn/bnetd/_handle_joingame_command(93df5f0f7c1da4a4). },
159 { "GAMEOPT", _handle_gameopt_commandcxx . . $ pvpgn/bnetd/_handle_gameopt_command(93df5f0f7c1da4a4). },
160 { "FINDUSER", _handle_finduser_commandcxx . . $ pvpgn/bnetd/_handle_finduser_command(93df5f0f7c1da4a4). },
161 { "FINDUSEREX", _handle_finduserex_commandcxx . . $ pvpgn/bnetd/_handle_finduserex_command(93df5f0f7c1da4a4). },
162 { "PAGE", _handle_page_commandcxx . . $ pvpgn/bnetd/_handle_page_command(93df5f0f7c1da4a4). },
163 { "STARTG", _handle_startg_commandcxx . . $ pvpgn/bnetd/_handle_startg_command(93df5f0f7c1da4a4). },
164 { "ADVERTR", _handle_advertr_commandcxx . . $ pvpgn/bnetd/_handle_advertr_command(93df5f0f7c1da4a4). },
165 { "ADVERTC", _handle_advertc_commandcxx . . $ pvpgn/bnetd/_handle_advertc_command(93df5f0f7c1da4a4). },
166 { "CHANCHK", _handle_chanchk_commandcxx . . $ pvpgn/bnetd/_handle_chanchk_command(93df5f0f7c1da4a4). },
167 { "GETBUDDY", _handle_getbuddy_commandcxx . . $ pvpgn/bnetd/_handle_getbuddy_command(93df5f0f7c1da4a4). },
168 { "ADDBUDDY", _handle_addbuddy_commandcxx . . $ pvpgn/bnetd/_handle_addbuddy_command(93df5f0f7c1da4a4). },
169 { "DELBUDDY", _handle_delbuddy_commandcxx . . $ pvpgn/bnetd/_handle_delbuddy_command(93df5f0f7c1da4a4). },
170 { "TIME", _handle_time_commandcxx . . $ pvpgn/bnetd/_handle_time_command(93df5f0f7c1da4a4). },
171 { "KICK", _handle_kick_commandcxx . . $ pvpgn/bnetd/_handle_kick_command(93df5f0f7c1da4a4). },
172 { "MODE", _handle_mode_commandcxx . . $ pvpgn/bnetd/_handle_mode_command(93df5f0f7c1da4a4). },
173 { "HOST", _handle_host_commandcxx . . $ pvpgn/bnetd/_handle_host_command(93df5f0f7c1da4a4). },
174 { "INVMSG", _handle_invmsg_commandcxx . . $ pvpgn/bnetd/_handle_invmsg_command(93df5f0f7c1da4a4). },
175 { "INVDEL", _handle_invdel_commandcxx . . $ pvpgn/bnetd/_handle_invdel_command(93df5f0f7c1da4a4). },
176 { "USERIP", _handle_userip_commandcxx . . $ pvpgn/bnetd/_handle_userip_command(93df5f0f7c1da4a4). },
177
178 { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! }
179 };
180
181 extern int handle_wol_con_commandcxx . . $ pvpgn/bnetd/handle_wol_con_command(893e223956009815).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, char const * command, int numparams, char ** params, char * text)
182 {
183 t_wol_command_table_rowcxx . . $ pvpgn/bnetd/t_wol_command_table_row# const *p;
184
185 for (p = wol_con_command_tablecxx . . $ pvpgn/bnetd/wol_con_command_table.; p->wol_command_stringcxx . . $ pvpgn/bnetd/$anonymous_type_9c303aa629c1cbb7_0#wol_command_string. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; p++) {
186 if (strcasecmp(command, p->wol_command_stringcxx . . $ pvpgn/bnetd/$anonymous_type_9c303aa629c1cbb7_0#wol_command_string.) == 0) {
187 if (p->wol_command_handlercxx . . $ pvpgn/bnetd/$anonymous_type_9c303aa629c1cbb7_0#wol_command_handler. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
188 return ((p->wol_command_handlercxx . . $ pvpgn/bnetd/$anonymous_type_9c303aa629c1cbb7_0#wol_command_handler.)(conn, numparams, params, text));
189 }
190 }
191 return -1;
192 }
193
194 extern int handle_wol_log_commandcxx . . $ pvpgn/bnetd/handle_wol_log_command(893e223956009815).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, char const * command, int numparams, char ** params, char * text)
195 {
196 t_wol_command_table_rowcxx . . $ pvpgn/bnetd/t_wol_command_table_row# const *p;
197
198 for (p = wol_log_command_tablecxx . . $ pvpgn/bnetd/wol_log_command_table.; p->wol_command_stringcxx . . $ pvpgn/bnetd/$anonymous_type_9c303aa629c1cbb7_0#wol_command_string. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; p++) {
199 if (strcasecmp(command, p->wol_command_stringcxx . . $ pvpgn/bnetd/$anonymous_type_9c303aa629c1cbb7_0#wol_command_string.) == 0) {
200 if (p->wol_command_handlercxx . . $ pvpgn/bnetd/$anonymous_type_9c303aa629c1cbb7_0#wol_command_handler. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
201 return ((p->wol_command_handlercxx . . $ pvpgn/bnetd/$anonymous_type_9c303aa629c1cbb7_0#wol_command_handler.)(conn, numparams, params, text));
202 }
203 }
204 return -1;
205 }
206
207 static int handle_wol_authenticatecxx . . $ pvpgn/bnetd/handle_wol_authenticate(2e9022cda97b266d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, char const * passhash)
208 {
209 t_accountcxx . . $ pvpgn/bnetd/t_account# * a;
210 char const * tempapgar;
211 char const * temphash;
212 char const * username;
213
214 if (!conn) {
215 ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("got NULL connection");
216 return 0;
217 }
218 if (!passhash) {
219 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL passhash");
220 return 0;
221 }
222 username = conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn);
223 if (!username) {
224 /* redundant sanity check */
225 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL conn->protocol.loggeduser");
226 return 0;
227 }
228 a = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username);
229 if (!a) {
230 /* FIXME: Send real error code */
231 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_notice, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "Authentication failed.");
232 return 0;
233 }
234 tempapgar = conn_wol_get_apgarcxx . . $ pvpgn/bnetd/conn_wol_get_apgar(5104e66f1dd67144).(conn);
235 temphash = account_get_wol_apgarcxx . . $ pvpgn/bnetd/account_get_wol_apgar(4b37305d4a4563d0).(a);
236
237 if (connlist_find_connection_by_accountcxx . . $ pvpgn/bnetd/connlist_find_connection_by_account(831fe2ed2f0bd703).(a) && prefs_get_kick_old_logincxx . . $ pvpgn/bnetd/prefs_get_kick_old_login(db52760e79bf9054).() == 0)
238 {
239 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NICKNAMEINUSEcxx . . $ `src/common/irc_protocol.h:412:9`!, stdcxx . . $ std/::stringcxx . . $ std/string#(stdcxx . . $ std/::stringcxx . . $ std/string#(conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn)) +cxx . . $ std/operator+(900ec9581c410ad9). " :Account is already in use!").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
240 }
241 else if (account_get_auth_lockcxx . . $ pvpgn/bnetd/account_get_auth_lock(367bfb076f70247b).(a) == 1)
242 {
243 /* FIXME: Send real error code */
244 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_notice, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "Authentication rejected (account is locked) ");
245 }
246 else {
247 if (!temphash) {
248 /* Account auto creating */
249 account_set_wol_apgarcxx . . $ pvpgn/bnetd/account_set_wol_apgar(4b12bc5edcfaeac7).(a, tempapgar);
250 temphash = account_get_wol_apgarcxx . . $ pvpgn/bnetd/account_get_wol_apgar(4b37305d4a4563d0).(a);
251 }
252 if ((tempapgar) && (temphash) && (stdcxx . . $ std/::strcmp(temphash, tempapgar) == 0)) {
253 /* LOGIN is OK. We sends motd */
254 conn_logincxx . . $ pvpgn/bnetd/conn_login(37ada50ef2b0abe1).(conn, a, username);
255 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(conn, conn_state_loggedincxx . . $ pvpgn/bnetd/conn_state_loggedin.);
256 irc_send_motdcxx . . $ pvpgn/bnetd/irc_send_motd(c4dfbc2386fe4fc3).(conn);
257 }
258 else {
259 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_BAD_LOGINcxx . . $ `src/common/irc_protocol.h:345:9`!, ":You have specified an invalid password for that nickname."); /* bad APGAR */
260 conn_increment_passfail_countcxx . . $ pvpgn/bnetd/conn_increment_passfail_count(c4dfbc2386fe4fc3).(conn);
261 //std::sprintf(temp,":Closing Link %s[Some.host]:(Password needed for that nickname.)",conn_get_loggeduser(conn));
262 //message_send_text(conn,message_type_error,conn,temp);
263 }
264 }
265 return 0;
266 }
267
268 extern int handle_wol_welcomecxx . . $ pvpgn/bnetd/handle_wol_welcome(c4dfbc2386fe4fc3).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn)
269 {
270 /* This function need rewrite */
271 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(conn, conn_state_bot_passwordcxx . . $ pvpgn/bnetd/conn_state_bot_password.);
272
273 if (conn_wol_get_apgarcxx . . $ pvpgn/bnetd/conn_wol_get_apgar(5104e66f1dd67144).(conn)) {
274 handle_wol_authenticatecxx . . $ pvpgn/bnetd/handle_wol_authenticate(2e9022cda97b266d).(conn, conn_wol_get_apgarcxx . . $ pvpgn/bnetd/conn_wol_get_apgar(5104e66f1dd67144).(conn));
275 }
276 else {
277 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_notice, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "No APGAR command received!");
278 }
279
280 return 0;
281 }
282
283 static int handle_wol_send_claninfocxx . . $ pvpgn/bnetd/handle_wol_send_claninfo(5de92b14b2087efe).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, t_clancxx . . $ pvpgn/bnetd/t_clan# * clan)
284 {
285 unsigned int clanid;
286 const char * clantag;
287 const char * clanname;
288
289 if (!conn)
290 {
291 ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("got NULL connection");
292 return -1;
293 }
294
295 if (clan)
296 {
297 clanid = clan_get_clanidcxx . . $ pvpgn/bnetd/clan_get_clanid(1e16ca1cec114489).(clan);
298 clantag = clantag_to_strcxx . . $ pvpgn/bnetd/clantag_to_str(81a3ae90da26a711).(clan_get_clantagcxx . . $ pvpgn/bnetd/clan_get_clantag(1e16ca1cec114489).(clan));
299 clanname = clan_get_namecxx . . $ pvpgn/bnetd/clan_get_name(49ae76a143b2b3).(clan);
300 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_BATTLECLANcxx . . $ `src/common/irc_protocol.h:342:9`!, stdcxx . . $ std/::stringcxx . . $ std/string#(stdcxx . . $ std/::to_stringcxx . . $ std/__cxx11/to_string(8c2ead51e4ae4fc6).(clanid) +cxx . . $ std/operator+(900ec9581c410ad9). "`" +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::stringcxx . . $ std/string#(clanname) +cxx . . $ std/operator+(900ec9581c410ad9). "`" +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::stringcxx . . $ std/string#(clantag) +cxx . . $ std/operator+(900ec9581c410ad9). "`0`0`1`0`0`0`0`0`0`0`x`x`x").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
301 }
302 else
303 {
304 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_IDNOEXISTcxx . . $ `src/common/irc_protocol.h:370:9`!, ":ID does not exist");
305 }
306
307 return 0;
308 }
309
310 /* Commands: */
311
312 static int _handle_user_commandcxx . . $ pvpgn/bnetd/_handle_user_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
313 {
314 /**
315 * In WOL isnt used USER command (only for backward compatibility)
316 * RFC 2812 says:
317 * USER <user> <mode> <unused> :<realname>
318 *
319 * There is WOL imput expected:
320 * USER UserName HostName irc.westwood.com :RealName
321 */
322
323 char * user = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
324 t_accountcxx . . $ pvpgn/bnetd/t_account# * a;
325
326 user = (char *)conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn);
327
328 if (conn_get_usercxx . . $ pvpgn/bnetd/conn_get_user(c99dbccf638f5c6).(conn)) {
329 /* FIXME: Send real ERROR code/message */
330 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_ALREADYREGISTREDcxx . . $ `src/common/irc_protocol.h:442:9`!, ":You are already registred");
331 }
332 else {
333 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}][** WOL **] got USER: user=\"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(conn), user);
334
335 a = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(user);
336 if (!a) {
337 /* Auto-create account */
338 t_accountcxx . . $ pvpgn/bnetd/t_account# * tempacct;
339 t_hashcxx . . $ pvpgn/t_hash# pass_hash;
340 char * pass = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(conn_wol_get_apgar(conn)); /* FIXME: Do not use bnet passhash when we have wol passhash */
341 strtolowercxx . . $ pvpgn/strtolower(7a9722d75b371431).(pass);
342
343 bnet_hashcxx . . $ pvpgn/bnet_hash(2a8392f275be648).(&pass_hash, stdcxx . . $ std/::strlen(pass), pass);
344 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)pass);
345
346 tempacct = accountlist_create_accountcxx . . $ pvpgn/bnetd/accountlist_create_account(fdad4c38d937b650).(user, hash_get_strcxx . . $ pvpgn/hash_get_str(d917ea147d03f908).(pass_hash));
347 if (!tempacct) {
348 /* FIXME: Send real ERROR code/message */
349 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_BAD_LOGINcxx . . $ `src/common/irc_protocol.h:345:9`!, ":Account creating failed");
350 return 0;
351 }
352
353 conn_set_usercxx . . $ pvpgn/bnetd/conn_set_user(c8fb97a9af134824).(conn, user);
354 conn_set_ownercxx . . $ pvpgn/bnetd/conn_set_owner(c8fb97a9af134824).(conn, user);
355 if (conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn))
356 handle_wol_welcomecxx . . $ pvpgn/bnetd/handle_wol_welcome(c4dfbc2386fe4fc3).(conn); /* only send the welcome if we have USER and NICK */
357 }
358 else {
359 conn_set_usercxx . . $ pvpgn/bnetd/conn_set_user(c8fb97a9af134824).(conn, user);
360 conn_set_ownercxx . . $ pvpgn/bnetd/conn_set_owner(c8fb97a9af134824).(conn, user);
361 if (conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn))
362 handle_wol_welcomecxx . . $ pvpgn/bnetd/handle_wol_welcome(c4dfbc2386fe4fc3).(conn); /* only send the welcome if we have USER and NICK */
363 }
364 }
365 return 0;
366 }
367
368 static int _handle_pass_commandcxx . . $ pvpgn/bnetd/_handle_pass_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
369 {
370 /**
371 * PASS is not used in WOL
372 * only for backward compatibility sent client PASS supersecret
373 * real password sent client by apgar command
374 */
375
376 return 0;
377 }
378
379 static int _handle_privmsg_commandcxx . . $ pvpgn/bnetd/_handle_privmsg_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
380 {
381 if ((numparams >= 1) && (text))
382 {
383 int i;
384 char ** e;
385
386 e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]);
387 /* FIXME: support wildcards! */
388
389 /* start amadeo: code was sent by some unkown fellow of pvpgn (maybe u wanna give us your name
390 for any credits), it adds nick-registration, i changed some things here and there... */
391 for (i = 0; ((e) && (e[i])); i++) {
392 if (strcasecmp(e[i], "matchbot") == 0) {
393 /* Anongames WOL support */
394 anongame_wol_privmsgcxx . . $ pvpgn/bnetd/anongame_wol_privmsg(93df5f0f7c1da4a4).(conn, numparams, params, text);
395 }
396 else if (conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(conn) == conn_state_loggedincxx . . $ pvpgn/bnetd/conn_state_loggedin.) {
397 if (e[i][0] == '#') {
398 /* channel message */
399 t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel;
400
401 //PELISH: We does not support talk for not inside-channel clients now but in WOL is that feature not needed
402 if (channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn)) {
403 if ((stdcxx . . $ std/::strlen(text) >= 9) && (stdcxx . . $ std/::strncmp(text, "\001ACTION ", 8) == 0) && (text[stdcxx . . $ std/::strlen(text) - 1] == '\001')) {
404 /* at least "\001ACTION \001" */
405 /* it's a CTCP ACTION message */
406 text = text + 8;
407 text[stdcxx . . $ std/::strlen(text) - 1] = '\0';
408 channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_emote, conn, text);
409 }
410 else {
411 if (text[0] == '/') {
412 /* "/" commands (like "/help..." */
413 handle_commandcxx . . $ pvpgn/bnetd/handle_command(2e9022cda97b266d).(conn, text);
414 }
415 else {
416 channel_message_logcxx . . $ pvpgn/bnetd/channel_message_log(3119144774c93d10).(channel, conn, 1, text);
417 channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_talk, conn, text);
418 }
419 }
420 }
421 else {
422 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHCHANNELcxx . . $ `src/common/irc_protocol.h:386:9`!, stdcxx . . $ std/::stringcxx . . $ std/string#(stdcxx . . $ std/::stringcxx . . $ std/string#(e[0]) +cxx . . $ std/operator+(900ec9581c410ad9). " :No such channel").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
423 }
424 }
425 else {
426 /* whisper */
427 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user;
428
429 if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(e[i])))
430 {
431 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(user, message_type_whisper, conn, text);
432 }
433 else
434 {
435 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHNICKcxx . . $ `src/common/irc_protocol.h:384:9`!, ":No such user");
436 }
437 }
438 }
439 }
440 if (e)
441 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
442 }
443 else
444 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "PRIVMSG :Not enough parameters");
445 return 0;
446 }
447
448 struct gamelist_datacxx . . $ pvpgn/bnetd/gamelist_data# {
449 unsigned tcountcxx . . $ pvpgn/bnetd/gamelist_data#tcount., countercxx . . $ pvpgn/bnetd/gamelist_data#counter.;
450 t_connectioncxx . . $ pvpgn/bnetd/t_connection# *conncxx . . $ pvpgn/bnetd/gamelist_data#conn.;
451 };
452
453 static int append_game_infocxx . . $ pvpgn/bnetd/append_game_info(7b7c187348591887).(t_game* game, void* vdata)
454 {
455 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
456 char temp_a[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
457 gamelist_datacxx . . $ pvpgn/bnetd/gamelist_data#* data = static_cast<gamelist_datacxx . . $ pvpgn/bnetd/gamelist_data#*>(vdata);
458 t_channelcxx . . $ pvpgn/bnetd/t_channel# * gamechannel;
459 const char * gamename;
460 stdcxx . . $ std/::stringcxx . . $ std/string# topicstrcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
461
462 stdcxx . . $ std/::memset(temp, 0, sizeof(temp));
463 stdcxx . . $ std/::memset(temp_a, 0, sizeof(temp_a));
464
465 data->tcountcxx . . $ pvpgn/bnetd/gamelist_data#tcount.++;
466
467 if (game_get_statuscxx . . $ pvpgn/bnetd/game_get_status(e13bf945064795ea).(game) != game_status_open) {
468 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] not listing because game is not open", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(data->conncxx . . $ pvpgn/bnetd/gamelist_data#conn.));
469 return 0;
470 }
471 if (game_get_clienttagcxx . . $ pvpgn/bnetd/game_get_clienttag(d7b85b5cd2056731).(game) != conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(data->conncxx . . $ pvpgn/bnetd/gamelist_data#conn.)) {
472 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] not listing because game is for a different client", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(data->conncxx . . $ pvpgn/bnetd/gamelist_data#conn.));
473 return 0;
474 }
475
476 if (!(gamechannel = game_get_channelcxx . . $ pvpgn/bnetd/game_get_channel(7d1a4b3311a97356).(game))) {
477 ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("game have no channel");
478 return 0;
479 }
480 if (!(gamename = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(gamechannel, data->conncxx . . $ pvpgn/bnetd/gamelist_data#conn.))) {
481 ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("game have no name");
482 return 0;
483 }
484
485 class_topiccxx . . $ pvpgn/bnetd/class_topic# Topiccxx . . $ pvpgn/bnetd/class_topic#class_topic(49f6e7a06ebc5aa8).;
486 topicstr =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). Topic.getcxx . . $ pvpgn/bnetd/class_topic#get(265576c0e07c2ac8).(channel_get_namecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(gamechannel));
487
488 if (topicstr.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() == false) {
489 if (stdcxx . . $ std/::strlen(gamename) + 1 + 20 + 1 + 1 + stdcxx . . $ std/::strlen(topicstr.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()) > MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) {
490 WARN0cxx . . $ `src/common/eventlog.h:78:9`!("LISTREPLY length exceeded");
491 return 0;
492 }
493 }
494 else {
495 if (stdcxx . . $ std/::strlen(gamename) + 1 + 20 + 1 + 1 > MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) {
496 WARN0cxx . . $ `src/common/eventlog.h:78:9`!("LISTREPLY length exceeded");
497 return 0;
498 }
499 }
500
501 /***
502 * WOLv1:
503 * : 326 u #nick's_game 1 0 2 0 0 1122334455 128::
504 * WOLv2:
505 * : 326 u #nick's_game 1 0 21 0 16777216 1122334455 128::g040
506 * : 326 u #nick's_game 1 0 41 1 2048 1122334455 128::g12P25,2097731398,0,0,0,WATERF~3.YRM // anon_game
507 */
508 /**
509 * The layout of the game list entry is something like this:
510 * #game_channel_name currentusers maxplayers gameType gameIsTournment gameExtension longIP LOCK::topic
511 */
512
513 stdcxx . . $ std/::strcat(temp, gamename);
514 stdcxx . . $ std/::strcat(temp, " ");
515
516 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp_a, sizeof(temp_a), "%u ", game_get_refcxx . . $ pvpgn/bnetd/game_get_ref(d7b85b5cd2056731).(game)); /* curent players */
517 stdcxx . . $ std/::strcat(temp, temp_a);
518
519 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp_a, sizeof(temp_a), "%u ", game_get_maxplayerscxx . . $ pvpgn/bnetd/game_get_maxplayers(d7b85b5cd2056731).(game)); /* max players */
520 stdcxx . . $ std/::strcat(temp, temp_a);
521
522 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp_a, sizeof(temp_a), "%u ", channel_wol_get_game_typecxx . . $ pvpgn/bnetd/channel_wol_get_game_type(28c764f7c20ec9b2).(gamechannel)); /* game type */
523 stdcxx . . $ std/::strcat(temp, temp_a);
524
525 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp_a, sizeof(temp_a), "%u ", (game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game) == game_type_ladder) ? 1 : 0); /* tournament */
526 stdcxx . . $ std/::strcat(temp, temp_a);
527
528 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp_a, sizeof(temp_a), "%s ", channel_wol_get_game_extensioncxx . . $ pvpgn/bnetd/channel_wol_get_game_extension(7800017c14723985).(gamechannel)); /* game extension */
529 stdcxx . . $ std/::strcat(temp, temp_a);
530
531 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp_a, sizeof(temp_a), "%u ", conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(game_get_ownercxx . . $ pvpgn/bnetd/game_get_owner(44263c0cd290cfb5).(game))); /* owner IP - FIXME: address translation here!! */
532 stdcxx . . $ std/::strcat(temp, temp_a);
533
534 if (stdcxx . . $ std/::strcmp(game_get_passcxx . . $ pvpgn/bnetd/game_get_pass(743fb6d1aa411c4e).(game), "") == 0)
535 stdcxx . . $ std/::strcat(temp, "128"); /* game is unloocked 128 == no_pass */
536 else
537 stdcxx . . $ std/::strcat(temp, "384"); /* game is loocked 384 == pass */
538
539 stdcxx . . $ std/::strcat(temp, "::");
540
541 if (topicstr.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()) {
542 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp_a, sizeof(temp_a), "%s", topicstr.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); /* topic */
543 stdcxx . . $ std/::strcat(temp, temp_a);
544 }
545
546 data->countercxx . . $ pvpgn/bnetd/gamelist_data#counter.++;
547 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(data->conncxx . . $ pvpgn/bnetd/gamelist_data#conn., RPL_GAME_CHANNELcxx . . $ `src/common/irc_protocol.h:333:9`!, temp);
548
549 return 0;
550 }
551
552 static int _handle_list_commandcxx . . $ pvpgn/bnetd/_handle_list_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
553 {
554 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
555 t_elemcxx . . $ pvpgn/t_elem# const * curr;
556
557 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_LISTSTARTcxx . . $ `src/common/irc_protocol.h:226:9`!, "Channel :Users Names"); /* backward compatibility */
558
559 if ((numparams == 0) || ((numparams == 2) && (params[0]) && (params[1]) && (stdcxx . . $ std/::strcmp(params[0], params[1]) != 0))) {
560 /**
561 * LIST all chat channels
562 * Emperor sends as params[0] == -1 if want QuickMatch channels too, 0 if not.
563 * This sends also NOX but we dunno why.
564 * DUNE 2000 use params[0] to determine channels by channeltype
565 */
566
567 LIST_TRAVERSE_CONSTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/list.h:95:9`!(channellist(), curr) {
568 t_channelcxx . . $ pvpgn/bnetd/t_channel# const * channel = (const t_channelcxx . . $ pvpgn/bnetd/t_channel#*)elem_get_data(curr);
569 char const * tempname;
570
571 tempname = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, conn);
572
573 if ((tag_check_wolv1cxx . . $ pvpgn/tag_check_wolv1(4c679297bf94b9eb).(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(conn))) && (stdcxx . . $ std/::strlen(tempname) > MAX_WOLV1_CHANNELNAME_LENcxx . . $ MAX_WOLV1_CHANNELNAME_LEN.))
574 continue;
575
576 /* FIXME: Delete this if games are not in channels */
577 if ((channel_wol_get_game_typecxx . . $ pvpgn/bnetd/channel_wol_get_game_type(28c764f7c20ec9b2).(channel) != 0))
578 continue;
579
580 sprintf(temp, "%s %u ", tempname, channel_get_lengthcxx . . $ pvpgn/bnetd/channel_get_length(28c764f7c20ec9b2).(channel));
581
582 if (channel_get_flagscxx . . $ pvpgn/bnetd/channel_get_flags(6768ecacf43d05ec).(channel) & channel_flags_permanentcxx . . $ pvpgn/bnetd/channel_flags_permanent.)
583 stdcxx . . $ std/::strcat(temp, "1"); /* Official channel */
584 else
585 stdcxx . . $ std/::strcat(temp, "0"); /* User channel */
586
587 if (tag_check_wolv1cxx . . $ pvpgn/tag_check_wolv1(4c679297bf94b9eb).(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(conn)))
588 stdcxx . . $ std/::strcat(temp, ":"); /* WOLv1 ends by ":" FIXME: Should be an TOPIC after ":"*/
589 else
590 stdcxx . . $ std/::strcat(temp, " 388"); /* WOLv2 ends by "388" */
591
592 if (stdcxx . . $ std/::strlen(temp) > MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.)
593 WARN0cxx . . $ `src/common/eventlog.h:78:9`!("LISTREPLY length exceeded");
594
595 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_CHANNELcxx . . $ `src/common/irc_protocol.h:334:9`!, temp);
596 }
597 }
598 /**
599 * Known channel game types:
600 * 0 = Westwood Chat channels, 1 = Command & Conquer Win95 channels, 2 = Red Alert Win95 channels,
601 * 3 = Red Alert Counterstrike channels, 4 = Red Alert Aftermath channels, 5 = CnC Sole Survivor channels,
602 * 12 = C&C Renegade channels, 14 = Dune 2000 channels, 16 = Nox channels, 18 = Tiberian Sun channels,
603 * 21 = Red Alert 1 v 3.03 channels, 31 = Emperor: Battle for Dune, 33 = Red Alert 2,
604 * 37 = Nox Quest channels, 38,39,40 = Quickgame channels, 41 = Yuri's Revenge
605 */
606 if ((numparams == 0) || ((numparams == 2) && (params[0]) && (params[1]) && (stdcxx . . $ std/::strcmp(params[0], params[1]) == 0))) {
607 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[** WOL **] LIST [Game]");
608 /* list games */
609 struct gamelist_datacxx . . $ pvpgn/bnetd/gamelist_data# data;
610 data.tcountcxx . . $ pvpgn/bnetd/gamelist_data#tcount. = 0;
611 data.countercxx . . $ pvpgn/bnetd/gamelist_data#counter. = 0;
612 data.conncxx . . $ pvpgn/bnetd/gamelist_data#conn. = conn;
613 gamelist_traversecxx . . $ pvpgn/bnetd/gamelist_traverse(c7b2023d64399da8).(&append_game_infocxx . . $ pvpgn/bnetd/append_game_info(7b7c187348591887)., &data, gamelist_source_none);
614 DEBUG3cxx . . $ `src/common/eventlog.h:91:9`!("[{}] LIST sent {} of {} games", conn_get_socket(conn), data.counter, data.tcount);
615 }
616 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_LISTENDcxx . . $ `src/common/irc_protocol.h:228:9`!, ":End of LIST command");
617 return 0;
618 }
619
620 static int _handle_quit_commandcxx . . $ pvpgn/bnetd/_handle_quit_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
621 {
622 if (conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn))
623 conn_quit_channelcxx . . $ pvpgn/bnetd/conn_quit_channel(2e9022cda97b266d).(conn, text);
624
625 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_QUITcxx . . $ `src/common/irc_protocol.h:360:9`!, ":goodbye");
626
627 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(conn, conn_state_destroycxx . . $ pvpgn/bnetd/conn_state_destroy.);
628
629 return 0;
630 }
631
632 static int _handle_names_commandcxx . . $ pvpgn/bnetd/_handle_names_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
633 {
634 t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel;
635
636 if (numparams >= 1) {
637 char ** e;
638 char const * verytemp;
639 int i;
640
641 e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]);
642 for (i = 0; ((e) && (e[i])); i++) {
643 verytemp = irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(e[i]);
644
645 if (!verytemp)
646 continue; /* something is wrong with the name ... */
647 channel = channellist_find_channel_by_namecxx . . $ pvpgn/bnetd/channellist_find_channel_by_name(7177a8438ab16268).(verytemp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
648 if ((!channel) && (!(channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn))))
649 continue; /* channel doesn't exist */
650 irc_send_rpl_namreplycxx . . $ pvpgn/bnetd/irc_send_rpl_namreply(9a6ccea331d9f4).(conn, channel);
651 }
652 if (e)
653 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
654 }
655 else if (numparams == 0) {
656 irc_send_rpl_namreplycxx . . $ pvpgn/bnetd/irc_send_rpl_namreply(9a6ccea331d9f4).(conn, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
657 }
658 return 0;
659 }
660
661 static int _handle_part_commandcxx . . $ pvpgn/bnetd/_handle_part_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
662 {
663 t_game * game;
664
665 conn_part_channelcxx . . $ pvpgn/bnetd/conn_part_channel(c4dfbc2386fe4fc3).(conn);
666
667 if ((game = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(conn)) && (game_get_statuscxx . . $ pvpgn/bnetd/game_get_status(e13bf945064795ea).(game) == game_status_open))
668 conn_set_gamecxx . . $ pvpgn/bnetd/conn_set_game(6346b62fdc8e3894).(conn, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, game_type_none, 0);
669
670 return 0;
671 }
672
673 /**
674 * Fallowing commands are only in Westwood Online protocol
675 */
676 static int _handle_cvers_commandcxx . . $ pvpgn/bnetd/_handle_cvers_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
677 {
678 t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag;
679
680 /* Ignore command but set clienttag */
681
682 /**
683 * Heres the imput expected:
684 * CVERS [oldvernum] [SKU]
685 *
686 * SKU is specific number for any WOL client (Tiberian sun, RedAlert 2 etc.)
687 * This is the best way to set clienttag, because CVERS is the first command which
688 * client send to server.
689 */
690
691 if (numparams == 2) {
692 clienttag = tag_sku_to_uintcxx . . $ pvpgn/tag_sku_to_uint(46cc46841198e427).(stdcxx . . $ std/::atoi(params[1]));
693 if (clienttag != CLIENTTAG_WWOL_UINTcxx . . $ `src/common/tag.h:146:9`!)
694 conn_set_clienttagcxx . . $ pvpgn/bnetd/conn_set_clienttag(d97ad1b62a895b69).(conn, clienttag);
695 }
696 else
697 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "CVERS :Not enough parameters");
698 return 0;
699 }
700
701 static int _handle_verchk_commandcxx . . $ pvpgn/bnetd/_handle_verchk_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
702 {
703 t_clienttagcxx . . $ pvpgn/t_clienttag# clienttag;
704
705 /**
706 * Heres the imput expected:
707 * vercheck [SKU] [version]
708 *
709 * Heres the output expected:
710 *
711 * 1) Update non-existant:
712 * :[servername] 379 [username] :none none none 1 [SKU] NONREQ
713 * 2) Update existant:
714 * :[servername] 379 [username] :none none none [oldversnum] [SKU] REQ
715 */
716
717 if (numparams == 2)
718 {
719 clienttag = tag_sku_to_uintcxx . . $ pvpgn/tag_sku_to_uint(46cc46841198e427).(stdcxx . . $ std/::atoi(params[0]));
720 if (clienttag != CLIENTTAG_WWOL_UINTcxx . . $ `src/common/tag.h:146:9`!)
721 conn_set_clienttagcxx . . $ pvpgn/bnetd/conn_set_clienttag(d97ad1b62a895b69).(conn, clienttag);
722
723 stdcxx . . $ std/::stringcxx . . $ std/string# tmp(":none none none 1 " +cxx . . $ std/operator+(39ed2c165380f78e). stdcxx . . $ std/::stringcxx . . $ std/string#(params[0]) +cxx . . $ std/operator+(900ec9581c410ad9). " NONREQ");
724 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[** WOL **] VERCHK {}", tmp.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
725 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_VERCHK_NONREQcxx . . $ `src/common/irc_protocol.h:346:9`!, tmp.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
726 }
727 else
728 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "VERCHK :Not enough parameters");
729
730 return 0;
731 }
732
733 static int _handle_apgar_commandcxx . . $ pvpgn/bnetd/_handle_apgar_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
734 {
735 char * apgar = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
736
737 if ((numparams >= 1) && (params[0])) {
738 apgar = params[0];
739 conn_wol_set_apgarcxx . . $ pvpgn/bnetd/conn_wol_set_apgar(c8fb97a9af134824).(conn, apgar);
740 }
741 else
742 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "APGAR :Not enough parameters");
743 return 0;
744 }
745
746 static int _handle_serial_commandcxx . . $ pvpgn/bnetd/_handle_serial_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
747 {
748 // Ignore command
749 return 0;
750 }
751
752 static int _handle_squadinfo_commandcxx . . $ pvpgn/bnetd/_handle_squadinfo_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
753 {
754 t_clancxx . . $ pvpgn/bnetd/t_clan# * clan;
755
756 if ((numparams >= 1) && (params[0])) {
757 if (stdcxx . . $ std/::strcmp(params[0], "0") == 0) {
758 /* 0 == claninfo for itself */
759 clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn));
760 handle_wol_send_claninfocxx . . $ pvpgn/bnetd/handle_wol_send_claninfo(5de92b14b2087efe).(conn, clan);
761 }
762 else {
763 /* claninfo for clanid (params[0]) */
764 clan = clanlist_find_clan_by_clanidcxx . . $ pvpgn/bnetd/clanlist_find_clan_by_clanid(8e7bfb2a07f0508e).(stdcxx . . $ std/::atoi(params[0]));
765 handle_wol_send_claninfocxx . . $ pvpgn/bnetd/handle_wol_send_claninfo(5de92b14b2087efe).(conn, clan);
766 }
767 }
768 else
769 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "SQUADINFO :Not enough parameters");
770 return 0;
771 }
772
773 static int _handle_clanbyname_commandcxx . . $ pvpgn/bnetd/_handle_clanbyname_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
774 {
775 t_clancxx . . $ pvpgn/bnetd/t_clan# * clan;
776
777 if ((numparams >= 1) && (params[0])) {
778 clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(params[0]));
779 handle_wol_send_claninfocxx . . $ pvpgn/bnetd/handle_wol_send_claninfo(5de92b14b2087efe).(conn, clan);
780 }
781 else
782 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "CLANBYNAME :Not enough parameters");
783 return 0;
784 }
785
786 static int _handle_setopt_commandcxx . . $ pvpgn/bnetd/_handle_setopt_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
787 {
788 char ** elems;
789
790 /**
791 * This is option for enabling/disabling Page and Find user.
792 *
793 * Heres the input expected:
794 * SETOPT 17,32
795 *
796 * First parameter: 16 == FindDisabled 17 == FindEnabled
797 * Second parameter: 32 == PageDisabled 33 == PageEnabled
798 */
799
800 if ((numparams >= 1) && (params[0])) {
801 elems = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]);
802
803 if ((elems) && (elems[0]) && (elems[1])) {
804 conn_wol_set_findmecxx . . $ pvpgn/bnetd/conn_wol_set_findme(6a76ece71ede8144).(conn, ((stdcxx . . $ std/::strcmp(elems[0], "17") == 0) ? true : false));
805 conn_wol_set_pagemecxx . . $ pvpgn/bnetd/conn_wol_set_pageme(6a76ece71ede8144).(conn, ((stdcxx . . $ std/::strcmp(elems[1], "33") == 0) ? true : false));
806 }
807 if (elems)
808 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(elems);
809 }
810 else
811 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "SETOPT :Not enough parameters");
812 return 0;
813 }
814
815 static int _handle_setcodepage_commandcxx . . $ pvpgn/bnetd/_handle_setcodepage_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
816 {
817 char * codepage = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
818
819 if ((numparams >= 1) && (params[0])) {
820 codepage = params[0];
821 conn_wol_set_codepagecxx . . $ pvpgn/bnetd/conn_wol_set_codepage(5b9d37d9dd0897d2).(conn, stdcxx . . $ std/::atoi(codepage));
822 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_SET_CODEPAGEcxx . . $ `src/common/irc_protocol.h:336:9`!, codepage);
823 }
824 else
825 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "SETCODEPAGE :Not enough parameters");
826 return 0;
827 }
828
829 static int _handle_getcodepage_commandcxx . . $ pvpgn/bnetd/_handle_getcodepage_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
830 {
831 stdcxx . . $ std/::stringcxx . . $ std/string# tempcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
832
833 if ((numparams >= 1) && (params[0]))
834 {
835 for (auto i = 0; i < numparams; i++)
836 {
837 int codepage = 0;
838 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(params[i]);
839 if (user)
840 codepage = conn_wol_get_codepagecxx . . $ pvpgn/bnetd/conn_wol_get_codepage(c4dfbc2386fe4fc3).(user);
841
842 temp.appendcxx . . $ std/__cxx11/basic_string#append(c0b47be1fddc0e75).(stdcxx . . $ std/::stringcxx . . $ std/string#(params[i]) +cxx . . $ std/operator+(900ec9581c410ad9). "`" +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::to_stringcxx . . $ std/__cxx11/to_string(3d81e17e7a87eecc).(codepage));
843
844 if (i < numparams - 1)
845 temp.appendcxx . . $ std/__cxx11/basic_string#append(978ca1133b5f6e74).("`");
846 }
847
848 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_GET_CODEPAGEcxx . . $ `src/common/irc_protocol.h:335:9`!, temp.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
849 }
850 else
851 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "GETCODEPAGE :Not enough parameters");
852 return 0;
853 }
854
855 static int _handle_setlocale_commandcxx . . $ pvpgn/bnetd/_handle_setlocale_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
856 {
857 t_accountcxx . . $ pvpgn/bnetd/t_account# * account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn);
858 int locale;
859
860 if ((numparams >= 1) && (params[0])) {
861 locale = stdcxx . . $ std/::atoi(params[0]);
862 account_set_localecxx . . $ pvpgn/bnetd/account_set_locale(9f6a50bf8c531a3f).(account, locale);
863 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_SET_LOCALEcxx . . $ `src/common/irc_protocol.h:331:9`!, params[0]);
864 }
865 else
866 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "SETLOCALE :Not enough parameters");
867 return 0;
868 }
869
870 static int _handle_getlocale_commandcxx . . $ pvpgn/bnetd/_handle_getlocale_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
871 {
872 stdcxx . . $ std/::stringcxx . . $ std/string# tempcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
873
874 if ((numparams >= 1) && (params[0]))
875 {
876 for (auto i = 0; i < numparams; i++)
877 {
878 int locale = 0;
879 t_accountcxx . . $ pvpgn/bnetd/t_account# * account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(params[i]);
880 if (account)
881 locale = account_get_localecxx . . $ pvpgn/bnetd/account_get_locale(367bfb076f70247b).(account);
882
883 temp.appendcxx . . $ std/__cxx11/basic_string#append(c0b47be1fddc0e75).(stdcxx . . $ std/::stringcxx . . $ std/string#(params[i]) +cxx . . $ std/operator+(900ec9581c410ad9). "`" +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::to_stringcxx . . $ std/__cxx11/to_string(3d81e17e7a87eecc).(locale));
884 if (i < numparams - 1)
885 temp.appendcxx . . $ std/__cxx11/basic_string#append(978ca1133b5f6e74).("`");
886 }
887 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_GET_LOCALEcxx . . $ `src/common/irc_protocol.h:330:9`!, temp.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
888 }
889 else
890 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "GETLOCALE :Not enough parameters");
891 return 0;
892 }
893
894 static int _handle_getinsider_commandcxx . . $ pvpgn/bnetd/_handle_getinsider_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
895 {
896 /**
897 * Here is imput expected:
898 * GETINSIDER [nickname]
899 * Here is output expected:
900 * :[servername] 399 [nick] [nickname]`0
901 */
902
903 if ((numparams >= 1) && (params[0]))
904 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_GET_INSIDERcxx . . $ `src/common/irc_protocol.h:352:9`!, stdcxx . . $ std/::stringcxx . . $ std/string#(stdcxx . . $ std/::stringcxx . . $ std/string#(params[0]) +cxx . . $ std/operator+(900ec9581c410ad9). "`0").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
905 else
906 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "GETINSIDER :Not enough parameters");
907
908 return 0;
909 }
910
911 static int _handle_joingame_commandcxx . . $ pvpgn/bnetd/_handle_joingame_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
912 {
913 char _temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
914
915 stdcxx . . $ std/::memset(_temp, 0, sizeof(_temp));
916
917 /**
918 * Basically this has 2 modes, Join Game and Create Game output is pretty much
919 * the same...input and output of JOINGAME is listed below. By the way, there is a
920 * hack in here, for Red Alert 1, it use's JOINGAME for some reason to join a lobby channel.
921 *
922 * Here is WOLv1 input expected:
923 * JOINGAME [#Game_channel_name] [MinPlayers] [MaxPlayers] [channelType] 1 1 [gameIsTournament]
924 * Knowed channelTypes (0-chat, 1-cnc, 2-ra1, 3-racs, 4-raam, 5-solsurv... listed in tag.cpp)
925 *
926 * Here is WOLv2 input expected:
927 * JOINGAME [#Game_channel_name] [MinPlayers] [MaxPlayers] [channelType] unknown unknown [gameIsTournament] [gameExtension] [password_optional]
928 *
929 * Heres the output expected:
930 * user!WWOL@hostname JOINGAME [MinPlayers] [MaxPlayers] [channelType] unknown clanID [longIP] [gameIsTournament] :[#Game_channel_name]
931 */
932 if ((numparams == 2) || (numparams == 3)) {
933 char ** e;
934
935 e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]);
936 if ((e) && (e[0])) {
937 char const * gamename = irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(e[0]);
938 // char * old_channel_name = NULL;
939 t_game * game;
940 t_game_type gametype;
941 t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel;
942 t_channelcxx . . $ pvpgn/bnetd/t_channel# * old_channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn);
943 char gamepass[MAX_GAMEPASS_LENcxx . . $ MAX_GAMEPASS_LEN.];
944
945 stdcxx . . $ std/::memset(gamepass, 0, sizeof(gamepass));
946
947 if ((conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(conn) == CLIENTTAG_REDALERT_UINTcxx . . $ `src/common/tag.h:126:9`!)
948 && (channellist_find_channel_by_namecxx . . $ pvpgn/bnetd/channellist_find_channel_by_name(7177a8438ab16268).(gamename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
949 && (gamelist_find_game_availablecxx . . $ pvpgn/bnetd/gamelist_find_game_available(e383c2f40f0b546f).(gamename, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(conn), game_type_all) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
950 /* BUG in Red Alert 1 v3.03e - forwarding to _handle_join_command */
951 DEBUG0cxx . . $ `src/common/eventlog.h:88:9`!("BUG in RA1 v3.03e - forwarding to _handle_join_command");
952 _handle_join_commandcxx . . $ pvpgn/bnetd/_handle_join_command(93df5f0f7c1da4a4).(conn, numparams, params, text);
953 if (e)
954 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
955 return 0;
956 }
957
958 if (!(gamename) || !(game = gamelist_find_game_availablecxx . . $ pvpgn/bnetd/gamelist_find_game_available(e383c2f40f0b546f).(gamename, conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(conn), game_type_all)))
959 {
960 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_GAMEHASCLOSEDcxx . . $ `src/common/irc_protocol.h:376:9`!, stdcxx . . $ std/::stringcxx . . $ std/string#(stdcxx . . $ std/::stringcxx . . $ std/string#(e[0]) +cxx . . $ std/operator+(900ec9581c410ad9). " :Game channel has closed").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
961
962 if (e)
963 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
964
965 return 0;
966 }
967
968 channel = game_get_channelcxx . . $ pvpgn/bnetd/game_get_channel(7d1a4b3311a97356).(game);
969
970 if (game_get_refcxx . . $ pvpgn/bnetd/game_get_ref(d7b85b5cd2056731).(game) == game_get_maxplayerscxx . . $ pvpgn/bnetd/game_get_maxplayers(d7b85b5cd2056731).(game))
971 {
972 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_CHANNELISFULLcxx . . $ `src/common/irc_protocol.h:453:9`!, stdcxx . . $ std/::stringcxx . . $ std/string#(stdcxx . . $ std/::stringcxx . . $ std/string#(e[0]) +cxx . . $ std/operator+(900ec9581c410ad9). " :Channel is full.").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
973
974 if (e)
975 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
976
977 return 0;
978 }
979
980 if (channel_check_banningcxx . . $ pvpgn/bnetd/channel_check_banning(af8c4400d4e536a9).(channel, conn))
981 {
982 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_BANNEDFROMCHANcxx . . $ `src/common/irc_protocol.h:456:9`!, stdcxx . . $ std/::stringcxx . . $ std/string#(stdcxx . . $ std/::stringcxx . . $ std/string#(e[0]) +cxx . . $ std/operator+(900ec9581c410ad9). " :You are banned from that channel.").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
983
984 if (e)
985 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
986
987 return 0;
988 }
989
990 if (stdcxx . . $ std/::strcmp(game_get_passcxx . . $ pvpgn/bnetd/game_get_pass(743fb6d1aa411c4e).(game), "") != 0)
991 {
992 if ((numparams == 3) && (params[2]) && (stdcxx . . $ std/::strcmp(params[2], game_get_passcxx . . $ pvpgn/bnetd/game_get_pass(743fb6d1aa411c4e).(game)) == 0))
993 {
994 stdcxx . . $ std/::strcpy(gamepass, params[2]);
995 }
996 else
997 {
998 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_BADCHANNELKEYcxx . . $ `src/common/irc_protocol.h:457:9`!, stdcxx . . $ std/::stringcxx . . $ std/string#(stdcxx . . $ std/::stringcxx . . $ std/string#(e[0]) +cxx . . $ std/operator+(900ec9581c410ad9). ":Bad password").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
999
1000 if (e)
1001 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
1002
1003 return 0;
1004 }
1005 }
1006
1007 gametype = game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game);
1008
1009 if ((conn_set_gamecxx . . $ pvpgn/bnetd/conn_set_game(6346b62fdc8e3894).(conn, gamename, gamepass, "", gametype, 0)) < 0)
1010 {
1011 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_GAMEHASCLOSEDcxx . . $ `src/common/irc_protocol.h:376:9`!, stdcxx . . $ std/::stringcxx . . $ std/string#(stdcxx . . $ std/::stringcxx . . $ std/string#(e[0]) +cxx . . $ std/operator+(900ec9581c410ad9). " :JOINGAME failed").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
1012 }
1013 else
1014 {
1015 /*conn_set_channel()*/
1016 channel = game_get_channelcxx . . $ pvpgn/bnetd/game_get_channel(7d1a4b3311a97356).(game);
1017 conn_set_channel_varcxx . . $ pvpgn/bnetd/conn_set_channel_var(681c2fcf151532c2).(conn, channel);
1018 channel_add_connectioncxx . . $ pvpgn/bnetd/channel_add_connection(cf5fcfcfa3727e22).(channel, conn);
1019 channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn);
1020
1021 if (channel != old_channel) {
1022 if (tag_check_wolv1cxx . . $ pvpgn/tag_check_wolv1(4c679297bf94b9eb).(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(conn))) {
1023 /* WOLv1 JOINGAME message */
1024 stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(_temp, "%u %u %u 1 1 %u :%s", channel_get_mincxx . . $ pvpgn/bnetd/channel_get_min(28c764f7c20ec9b2).(channel), game_get_maxplayerscxx . . $ pvpgn/bnetd/game_get_maxplayers(d7b85b5cd2056731).(game), channel_wol_get_game_typecxx . . $ pvpgn/bnetd/channel_wol_get_game_type(28c764f7c20ec9b2).(channel),
1025 ((game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game) == game_type_ladder) ? 1 : 0), irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, conn));
1026 }
1027 else {
1028 /* WOLv2 JOINGAME message with BATTLECLAN support */
1029 t_clancxx . . $ pvpgn/bnetd/t_clan# * clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn));
1030 unsigned int clanid = 0;
1031
1032 if (clan)
1033 clanid = clan_get_clanidcxx . . $ pvpgn/bnetd/clan_get_clanid(1e16ca1cec114489).(clan);
1034
1035 stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(_temp, "%u %u %u 1 %u %u %u :%s", channel_get_mincxx . . $ pvpgn/bnetd/channel_get_min(28c764f7c20ec9b2).(channel), game_get_maxplayerscxx . . $ pvpgn/bnetd/game_get_maxplayers(d7b85b5cd2056731).(game), channel_wol_get_game_typecxx . . $ pvpgn/bnetd/channel_wol_get_game_type(28c764f7c20ec9b2).(channel),
1036 clanid, conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(conn), ((game_get_typecxx . . $ pvpgn/bnetd/game_get_type(11fe09fff8b42355).(game) == game_type_ladder) ? 1 : 0), irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, conn));
1037 }
1038
1039 channel_set_userflagscxx . . $ pvpgn/bnetd/channel_set_userflags(c4dfbc2386fe4fc3).(conn);
1040 /* we have to send the JOINGAME acknowledgement */
1041 channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_wol_joingame, conn, _temp);
1042
1043 irc_send_topiccxx . . $ pvpgn/bnetd/irc_send_topic(9a6ccea331d9f4).(conn, channel);
1044
1045 irc_send_rpl_namreplycxx . . $ pvpgn/bnetd/irc_send_rpl_namreply(9a6ccea331d9f4).(conn, channel);
1046 }
1047 else
1048 {
1049 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_GAMEHASCLOSEDcxx . . $ `src/common/irc_protocol.h:376:9`!, stdcxx . . $ std/::stringcxx . . $ std/string#(stdcxx . . $ std/::stringcxx . . $ std/string#(e[0]) +cxx . . $ std/operator+(900ec9581c410ad9). " :JOINGAME failed").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
1050 }
1051 }
1052 }
1053 if (e)
1054 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
1055 return 0;
1056 }
1057 else if ((numparams >= 7)) {
1058 char ** e;
1059
1060 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[** WOL **] JOINGAME: * Create * ({}, {})",
1061 params[0], params[1]);
1062
1063 if ((numparams == 7)) {
1064 /* WOLv1 JOINGAME Create */
1065 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(_temp, sizeof(_temp), "%s %s %s %s 0 %s :%s", params[1], params[2], params[3], params[4], params[6], params[0]);
1066 }
1067 /* WOLv2 JOINGAME Create */
1068 else if ((numparams >= 8)) {
1069 t_clancxx . . $ pvpgn/bnetd/t_clan# * clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn));
1070 unsigned int clanid = 0;
1071
1072 if (clan)
1073 clanid = clan_get_clanidcxx . . $ pvpgn/bnetd/clan_get_clanid(1e16ca1cec114489).(clan);
1074 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(_temp, sizeof(_temp), "%s %s %s %s %u %u %s :%s", params[1], params[2], params[3], params[4], clanid, conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(conn), params[6], params[0]);
1075 }
1076 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[** WOL **] JOINGAME [Game Options] ({})", _temp);
1077
1078 e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]);
1079 if ((e) && (e[0])) {
1080 char const * gamename = irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(e[0]);
1081 t_game_type gametype;
1082 char gamepass[MAX_GAMEPASS_LENcxx . . $ MAX_GAMEPASS_LEN.];
1083
1084 stdcxx . . $ std/::memset(gamepass, 0, sizeof(gamepass));
1085
1086 if (stdcxx . . $ std/::strcmp(params[6], "1") == 0)
1087 gametype = game_type_ladder;
1088 else
1089 gametype = game_type_ffa;
1090 // gametype = game_type_none;
1091
1092 if ((numparams >= 8) && (params[8]))
1093 {
1094 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(gamepass, sizeof gamepass, "%s", params[8]);
1095 }
1096
1097 if ((!(gamename)) || ((conn_set_gamecxx . . $ pvpgn/bnetd/conn_set_game(6346b62fdc8e3894).(conn, gamename, gamepass, "", gametype, 0))<0)) {
1098 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHCHANNELcxx . . $ `src/common/irc_protocol.h:386:9`!, ":JOINGAME failed"); /* FIXME: be more precise; what is the real error code for that? */
1099 }
1100 else {
1101 t_game * game = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(conn);
1102 t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel = channel_createcxx . . $ pvpgn/bnetd/channel_create(e3bab94272034c0f).(gamename, gamename, 0, 0, 1, 1, prefs_get_chanlogcxx . . $ pvpgn/bnetd/prefs_get_chanlog(db52760e79bf9054).(), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, (prefs_get_maxusers_per_channelcxx . . $ pvpgn/bnetd/prefs_get_maxusers_per_channel(db52760e79bf9054).() > 0) ? prefs_get_maxusers_per_channelcxx . . $ pvpgn/bnetd/prefs_get_maxusers_per_channel(db52760e79bf9054).() : -1, 0, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1103 game_set_channelcxx . . $ pvpgn/bnetd/game_set_channel(d0d97163e3994052).(game, channel);
1104 conn_set_channel_varcxx . . $ pvpgn/bnetd/conn_set_channel_var(681c2fcf151532c2).(conn, channel);
1105 channel_add_connectioncxx . . $ pvpgn/bnetd/channel_add_connection(cf5fcfcfa3727e22).(channel, conn);
1106 channel_set_userflagscxx . . $ pvpgn/bnetd/channel_set_userflags(c4dfbc2386fe4fc3).(conn);
1107
1108 game_set_maxplayerscxx . . $ pvpgn/bnetd/game_set_maxplayers(9a59f4516a0d09ce).(game, stdcxx . . $ std/::atoi(params[2]));
1109
1110 channel_set_mincxx . . $ pvpgn/bnetd/channel_set_min(48cee1134ea01a3a).(channel, stdcxx . . $ std/::atoi(params[1]));
1111 // HACK: Currently, this is the best way to set the channel game type...
1112 channel_wol_set_game_typecxx . . $ pvpgn/bnetd/channel_wol_set_game_type(48cee1134ea01a3a).(channel, stdcxx . . $ std/::atoi(params[3]));
1113
1114 if (params[7])
1115 channel_wol_set_game_extensioncxx . . $ pvpgn/bnetd/channel_wol_set_game_extension(2cba118976651e77).(channel, params[7]);
1116 else
1117 channel_wol_set_game_extensioncxx . . $ pvpgn/bnetd/channel_wol_set_game_extension(2cba118976651e77).(channel, "0");
1118
1119 // we have to send the JOINGAME acknowledgement
1120 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_wol_joingame, conn, _temp);
1121 irc_send_topiccxx . . $ pvpgn/bnetd/irc_send_topic(9a6ccea331d9f4).(conn, channel);
1122 irc_send_rpl_namreplycxx . . $ pvpgn/bnetd/irc_send_rpl_namreply(9a6ccea331d9f4).(conn, channel);
1123 }
1124 }
1125 if (e)
1126 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
1127 }
1128 else
1129 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "JOINGAME :Not enough parameters");
1130 return 0;
1131 }
1132
1133 static int _handle_gameopt_commandcxx . . $ pvpgn/bnetd/_handle_gameopt_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1134 {
1135 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1136
1137 /**
1138 * Basically this has 2 modes as like in PRIVMSG - whisper and talk. What is in
1139 * text is pretty much unknown, we just dump this to the client to deal with...
1140 *
1141 * Heres the output expected (when gameopt is channel talk):
1142 * user!WWOL@hostname GAMEOPT #game_channel_name :gameOptions
1143 *
1144 * Heres the output expected (when gameopt is whispered):
1145 * user!WWOL@hostname GAMEOPT sender_nick_name :gameOptions
1146 */
1147
1148 if ((numparams >= 1) && (params[0]) && (text)) {
1149 int i;
1150 char ** e;
1151 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user;
1152 t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel;
1153
1154 e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]);
1155 /* FIXME: support wildcards! */
1156
1157 for (i = 0; ((e) && (e[i])); i++) {
1158 if (e[i][0] == '#') {
1159 /* channel gameopt */
1160 if (channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn)) {
1161 channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_gameopt_talk, conn, text);
1162 }
1163 else {
1164 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :No such channel", params[0]);
1165 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHCHANNELcxx . . $ `src/common/irc_protocol.h:386:9`!, temp);
1166 }
1167 }
1168 else {
1169 /* user gameopt */
1170 if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(e[i]))) {
1171 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(user, message_type_gameopt_whisper, conn, text);
1172 }
1173 else {
1174 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :No such nick", e[i]);
1175 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHNICKcxx . . $ `src/common/irc_protocol.h:384:9`!, temp);
1176 }
1177 }
1178 }
1179 if (e)
1180 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
1181 }
1182 else
1183 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "GAMEOPT :Not enough parameters");
1184 return 0;
1185 }
1186
1187 static int _handle_finduser_commandcxx . . $ pvpgn/bnetd/_handle_finduser_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1188 {
1189 char _temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1190 char const * wolname = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1191
1192 stdcxx . . $ std/::memset(_temp, 0, sizeof(_temp));
1193
1194 if ((numparams >= 1) && (params[0])) {
1195 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user;
1196
1197 if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(params[0])) && (conn_wol_get_findmecxx . . $ pvpgn/bnetd/conn_wol_get_findme(5a60a6624233dc9b).(user))) {
1198 wolname = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(user), conn);
1199 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(_temp, sizeof(_temp), "0 :%s", wolname); /* User found in channel wolname */
1200 }
1201 else
1202 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(_temp, sizeof(_temp), "1 :"); /* user not loged or have not allowed find */
1203
1204 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_FIND_USERcxx . . $ `src/common/irc_protocol.h:348:9`!, _temp);
1205 }
1206 else
1207 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "FINDUSER :Not enough parameters");
1208 return 0;
1209 }
1210
1211 static int _handle_finduserex_commandcxx . . $ pvpgn/bnetd/_handle_finduserex_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1212 {
1213 char _temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1214 char const * wolname = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1215
1216 stdcxx . . $ std/::memset(_temp, 0, sizeof(_temp));
1217
1218 if ((numparams >= 1) && (params[0])) {
1219 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user;
1220
1221 if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(params[0])) && (conn_wol_get_findmecxx . . $ pvpgn/bnetd/conn_wol_get_findme(5a60a6624233dc9b).(user))) {
1222 wolname = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(user), conn);
1223 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(_temp, sizeof(_temp), "0 :%s,0", wolname); /* User found in channel wolname */
1224 }
1225 else
1226 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(_temp, sizeof(_temp), "1 :"); /* user not loged or have not allowed find */
1227
1228 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_FIND_USER_EXcxx . . $ `src/common/irc_protocol.h:351:9`!, _temp);
1229 }
1230 else
1231 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "FINDUSEREX :Not enough parameters");
1232 return 0;;
1233 }
1234
1235 static int _handle_page_commandcxx . . $ pvpgn/bnetd/_handle_page_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1236 {
1237 char _temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1238 bool paged = false;
1239
1240 if ((numparams >= 1) && (params[0]) && (text)) {
1241 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user;
1242
1243 if (stdcxx . . $ std/::strcmp(params[0], "0") == 0) {
1244 /* PAGE for MY BATTLECLAN */
1245 t_clancxx . . $ pvpgn/bnetd/t_clan# * clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn));
1246
1247 if ((clan) && (clan_send_message_to_online_memberscxx . . $ pvpgn/bnetd/clan_send_message_to_online_members(5b3f105ee82e5d9c).(clan, message_type_page, conn, text) >= 1))
1248 paged = true;
1249 }
1250 else if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(params[0])) && (conn_wol_get_pagemecxx . . $ pvpgn/bnetd/conn_wol_get_pageme(5a60a6624233dc9b).(user))) {
1251 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(user, message_type_page, conn, text);
1252 paged = true;
1253 }
1254
1255 if (paged)
1256 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(_temp, sizeof(_temp), "0 :"); /* Page was succesfull */
1257 else
1258 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(_temp, sizeof(_temp), "1 :"); /* User not loged in or have not allowed page */
1259
1260 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_PAGEcxx . . $ `src/common/irc_protocol.h:349:9`!, _temp);
1261 }
1262 else
1263 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "PAGE :Not enough parameters");
1264 return 0;
1265 }
1266
1267 static int _handle_startg_commandcxx . . $ pvpgn/bnetd/_handle_startg_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1268 {
1269 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1270 char _temp_a[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1271 t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel;
1272 t_game * game;
1273
1274 /**
1275 * Imput expected:
1276 * STARTG [channel_name] [nick1](,nick2_optional)
1277 *
1278 * Heres the output expected (this can have up-to 8 entries (ie 8 players):
1279 * (we are assuming for this example that user1 is the game owner)
1280 *
1281 * WOLv1:
1282 * :user1!WWOL@hostname STARTG u :owner_ip gameNumber time_t
1283 *
1284 * WOLv2:
1285 * :user1!WWOL@hostname STARTG u :user1 xxx.xxx.xxx.xxx user2 xxx.xxx.xxx.xxx :gameNumber time_t
1286 */
1287
1288 if ((numparams >= 2) && (params[1])) {
1289 int i;
1290
1291 stdcxx . . $ std/::memset(temp, 0, sizeof(temp));
1292
1293 char ** e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[1]);
1294 /* FIXME: support wildcards! */
1295
1296 if (!(game = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(conn))) {
1297 ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("conn has not game");
1298 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
1299 return 0;
1300 }
1301
1302 stdcxx . . $ std/::strcat(temp, ":");
1303
1304 if (tag_check_wolv1cxx . . $ pvpgn/tag_check_wolv1(4c679297bf94b9eb).(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(conn))) {
1305 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user;
1306 channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn);
1307
1308 for (user = channel_get_firstcxx . . $ pvpgn/bnetd/channel_get_first(77c4a1edc1ac6ba1).(channel); user; user = channel_get_nextcxx . . $ pvpgn/bnetd/channel_get_next(181375335219f0cb).()) {
1309 char const * name = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(user);
1310 if (stdcxx . . $ std/::strcmp(conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(conn), name) != 0) {
1311 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s ", addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(game_get_ownercxx . . $ pvpgn/bnetd/game_get_owner(44263c0cd290cfb5).(game))));
1312 }
1313 }
1314 }
1315 else {
1316 for (i = 0; ((e) && (e[i])); i++) {
1317 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user;
1318 const char * addr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1319
1320 if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(e[i]))) {
1321 addr = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(user));
1322 }
1323 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(_temp_a, sizeof(_temp_a), "%s %s ", e[i], addr);
1324 stdcxx . . $ std/::strcat(temp, _temp_a);
1325 }
1326 stdcxx . . $ std/::strcat(temp, ":");
1327 }
1328
1329 game_set_statuscxx . . $ pvpgn/bnetd/game_set_status(5cd08b1f639ba8c2).(game, game_status_started);
1330
1331 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(_temp_a, sizeof(_temp_a), "%u %" PRId64cxx . . $ `<external>/15933738808807975373/inttypes.h:57:10`!, game_get_idcxx . . $ pvpgn/bnetd/game_get_id(d7b85b5cd2056731).(game), static_cast<stdcxx . . $ std/::int64_tcxx . . $ std/int64_t#>(game_get_start_timecxx . . $ pvpgn/bnetd/game_get_start_time(57cecc7178e653af).(game)));
1332 stdcxx . . $ std/::strcat(temp, _temp_a);
1333
1334 for (i = 0; ((e) && (e[i])); i++) {
1335 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user;
1336 if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(e[i]))) {
1337 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(user, message_wol_start_game, conn, temp);
1338 }
1339 }
1340
1341 if (e)
1342 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
1343 }
1344 else
1345 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "STARTG :Not enough parameters");
1346 return 0;
1347 }
1348
1349 static int _handle_advertr_commandcxx . . $ pvpgn/bnetd/_handle_advertr_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1350 {
1351 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1352
1353 stdcxx . . $ std/::memset(temp, 0, sizeof(temp));
1354
1355 /**
1356 * Heres the imput expected
1357 * ADVERTR [channel]
1358 *
1359 * Heres the output expected
1360 * :[servername] ADVERTR 5 [channel]
1361 */
1362
1363 if ((numparams >= 1) && (params[0])) {
1364 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "5 %s", params[0]);
1365 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_wol_advertr, conn, temp);
1366 }
1367 else
1368 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "ADVERTR :Not enough parameters");
1369 return 0;
1370 }
1371
1372 static int _handle_advertc_commandcxx . . $ pvpgn/bnetd/_handle_advertc_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1373 {
1374 /* FIXME: Not implemented yet */
1375 return 0;
1376 }
1377
1378 static int _handle_chanchk_commandcxx . . $ pvpgn/bnetd/_handle_chanchk_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1379 {
1380 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1381 t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel;
1382
1383 stdcxx . . $ std/::memset(temp, 0, sizeof(temp));
1384
1385 /**
1386 * Heres the imput expected
1387 * chanchk [channel]
1388 *
1389 * Heres the output expected
1390 * :[servername] CHANCHK [channel]
1391 */
1392
1393 if ((numparams >= 1) && (params[0]))
1394 {
1395 if ((channel = channellist_find_channel_by_namecxx . . $ pvpgn/bnetd/channellist_find_channel_by_name(7177a8438ab16268).(irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(params[0]), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)))
1396 {
1397 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof temp, "%s", params[0]);
1398 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_wol_chanchk, conn, temp);
1399 }
1400 else
1401 {
1402 /* FIXME: This is not dumped from original servers... this is probably wrong */
1403 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :No such channel", params[0]);
1404 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHCHANNELcxx . . $ `src/common/irc_protocol.h:386:9`!, temp);
1405 }
1406 }
1407 else
1408 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "CHANCHK :Not enough parameters");
1409 return 0;
1410 }
1411
1412 static int _handle_getbuddy_commandcxx . . $ pvpgn/bnetd/_handle_getbuddy_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1413 {
1414 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1415 char _temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1416 char const * friend_name;
1417 t_accountcxx . . $ pvpgn/bnetd/t_account# * my_acc;
1418 t_accountcxx . . $ pvpgn/bnetd/t_account# * friend_acc;
1419 t_listcxx . . $ pvpgn/t_list# * flist;
1420 t_friendcxx . . $ pvpgn/bnetd/t_friend# * fr;
1421 int num;
1422 unsigned int uid;
1423 int i;
1424
1425 stdcxx . . $ std/::memset(temp, 0, sizeof(temp));
1426 stdcxx . . $ std/::memset(_temp, 0, sizeof(_temp));
1427
1428 /**
1429 * Heres the output expected
1430 * :[servername] 333 [user] [buddy_name1]`[buddy_name2]`
1431 *
1432 * Without names:
1433 * :[servername] 333 [user]
1434 */
1435
1436 my_acc = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn);
1437 num = account_get_friendcountcxx . . $ pvpgn/bnetd/account_get_friendcount(367bfb076f70247b).(my_acc);
1438
1439 flist = account_get_friendscxx . . $ pvpgn/bnetd/account_get_friends(27f2e57ffe21264).(my_acc);
1440
1441 if (flist != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
1442 for (i = 0; i < num; i++) {
1443 if ((!(uid = account_get_friendcxx . . $ pvpgn/bnetd/account_get_friend(20c0a00602323ffe).(my_acc, i))) || (!(fr = friendlist_find_uidcxx . . $ pvpgn/bnetd/friendlist_find_uid(9da8c1d9dfa566eb).(flist, uid)))) {
1444 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "friend uid in list");
1445 continue;
1446 }
1447 friend_acc = friend_get_accountcxx . . $ pvpgn/bnetd/friend_get_account(9d018d83140d552c).(fr);
1448 friend_name = account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(friend_acc);
1449 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(_temp, sizeof(_temp), "%s`", friend_name);
1450 stdcxx . . $ std/::strcat(temp, _temp);
1451 }
1452 }
1453 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_GET_BUDDYcxx . . $ `src/common/irc_protocol.h:338:9`!, temp);
1454 return 0;
1455 }
1456
1457 static int _handle_addbuddy_commandcxx . . $ pvpgn/bnetd/_handle_addbuddy_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1458 {
1459 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1460 t_accountcxx . . $ pvpgn/bnetd/t_account# * my_acc;
1461 t_accountcxx . . $ pvpgn/bnetd/t_account# * friend_acc;
1462
1463 stdcxx . . $ std/::memset(temp, 0, sizeof(temp));
1464
1465 /**
1466 * Heres the imput expected
1467 * ADDBUDDY [buddy_name]
1468 *
1469 * Heres the output expected
1470 * :[servername] 334 [user] [buddy_name]
1471 */
1472
1473 if ((numparams >= 1) && (params[0])) {
1474 my_acc = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn);
1475 if (friend_acc = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(params[0])) {
1476 account_add_friendcxx . . $ pvpgn/bnetd/account_add_friend(1a0c18bb6c50312f).(my_acc, friend_acc);
1477 /* FIXME: Check if add friend is done if not then send right message */
1478
1479 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s", params[0]);
1480 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_ADD_BUDDYcxx . . $ `src/common/irc_protocol.h:339:9`!, temp);
1481 }
1482 else {
1483 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :No such nick", params[0]);
1484 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHNICKcxx . . $ `src/common/irc_protocol.h:384:9`!, temp);
1485 /* NOTE: this is not dumped from WOL, this not shows message
1486 but in Emperor doesnt gives name to list, in RA2 have no efect */
1487 }
1488 }
1489 else
1490 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "ADDBUDDY :Not enough parameters");
1491 return 0;
1492 }
1493
1494 static int _handle_delbuddy_commandcxx . . $ pvpgn/bnetd/_handle_delbuddy_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1495 {
1496 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1497 char const * friend_name;
1498 t_accountcxx . . $ pvpgn/bnetd/t_account# * my_acc;
1499 int num;
1500
1501 stdcxx . . $ std/::memset(temp, 0, sizeof(temp));
1502
1503 /**
1504 * Heres the imput expected
1505 * DELBUDDY [buddy_name]
1506 *
1507 * Heres the output expected
1508 * :[servername] 335 [user] [buddy_name]
1509 */
1510
1511 if ((numparams >= 1) && (params[0])) {
1512 friend_name = params[0];
1513 my_acc = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn);
1514
1515 num = account_remove_friend2cxx . . $ pvpgn/bnetd/account_remove_friend2(4b12bc5edcfaeac7).(my_acc, friend_name);
1516
1517 /**
1518 * FIXME: Check if remove friend is done if not then send right message
1519 * Btw I dont know another then RPL_DEL_BUDDY message yet.
1520 */
1521
1522 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s", friend_name);
1523 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_DEL_BUDDYcxx . . $ `src/common/irc_protocol.h:340:9`!, temp);
1524 }
1525 else
1526 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "DELBUDDY :Not enough parameters");
1527 return 0;
1528 }
1529
1530 static int _handle_host_commandcxx . . $ pvpgn/bnetd/_handle_host_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1531 {
1532 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1533 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user;
1534
1535 stdcxx . . $ std/::memset(temp, 0, sizeof(temp));
1536
1537 if ((numparams >= 1) && (params[0])) {
1538 if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(params[0]))) {
1539 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), ": %s", text);
1540 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(user, message_type_host, conn, temp);
1541 }
1542 else {
1543 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :No such nick", params[0]);
1544 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHNICKcxx . . $ `src/common/irc_protocol.h:384:9`!, temp);
1545 }
1546 }
1547 else
1548 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "HOST :Not enough parameters");
1549 return 0;
1550 }
1551
1552 static int _handle_invmsg_commandcxx . . $ pvpgn/bnetd/_handle_invmsg_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1553 {
1554 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1555 char ** e;
1556 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user;
1557 int i;
1558
1559 /**
1560 * Here is the imput expected:
1561 * INVMSG [channel] [unknown] [invited],[invited2_optional]
1562 * [unknown] can be 1 or 2
1563 *
1564 * Here is the output expected:
1565 * :user!WWOL@hostname INVMSG [invited] [channel] [unknown]
1566 */
1567
1568 if ((numparams >= 3) && (params[0]) && (params[1]) && (params[2])) {
1569 stdcxx . . $ std/::memset(temp, 0, sizeof(temp));
1570 e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[2]);
1571
1572 for (i = 0; ((e) && (e[i])); i++) {
1573 if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(e[i]))) {
1574 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s %s", params[0], params[1]);
1575 /* FIXME: set user to linvitelist! */
1576 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(user, message_type_invmsg, conn, temp);
1577 }
1578 }
1579
1580 if (e)
1581 irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e);
1582 }
1583 else {
1584 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "INVMSG :Not enough parameters");
1585 }
1586 return 0;
1587 }
1588
1589 static int _handle_invdel_commandcxx . . $ pvpgn/bnetd/_handle_invdel_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1590 {
1591 /* FIXME: Not implemented yet */
1592 return 0;
1593 }
1594
1595 static int _handle_userip_commandcxx . . $ pvpgn/bnetd/_handle_userip_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1596 {
1597 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1598 t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user;
1599 const char * addr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1600
1601 stdcxx . . $ std/::memset(temp, 0, sizeof(temp));
1602
1603 if ((numparams >= 1) && (params[0])) {
1604 if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(params[0]))) {
1605 addr = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(user));
1606 //FIXME: We are not sure of first parameter. It can be also nickname of command sender
1607 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s %s", params[0], addr);
1608 message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_wol_userip, conn, temp);
1609 }
1610 else {
1611 stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :No such nick", params[0]);
1612 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHNICKcxx . . $ `src/common/irc_protocol.h:384:9`!, temp);
1613 }
1614 }
1615 else
1616 irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "USERIP :Not enough parameters");
1617 return 0;
1618 }
1619
1620 /**
1621 * LADDER Server commands:
1622 */
1623 static int _ladder_sendcxx . . $ pvpgn/bnetd/_ladder_send(2e9022cda97b266d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, char const * command)
1624 {
1625 char data[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN. + 1];
1626 unsigned len = 0;
1627
1628 t_packetcxx . . $ pvpgn/t_packet#* const p = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_rawcxx . . $ pvpgn/packet_class_raw.);
1629 if (!p)
1630 {
1631 return -1;
1632 }
1633
1634 if (command)
1635 len = (stdcxx . . $ std/::strlen(command) + 6);
1636
1637 if (len > MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.)
1638 {
1639 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "message to send is too large ({} bytes)", len);
1640 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(p);
1641 return -1;
1642 }
1643
1644
1645 stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(data, "\r\n\r\n\r\n%s", command);
1646
1647 packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(p, 0);
1648 packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(p, data, len);
1649 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] sent \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(conn), data);
1650 conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn, p);
1651 packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(p);
1652
1653 /* In ladder server we must destroy connection after send packet */
1654 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(conn, conn_state_destroycxx . . $ pvpgn/bnetd/conn_state_destroy.);
1655
1656 return 0;
1657 }
1658
1659 static int _ladder_is_integercxx . . $ pvpgn/bnetd/_ladder_is_integer(1ef8e6ec083aabb9).(char * test)
1660 {
1661 for (char const* ptr = test; *ptr; ++ptr) {
1662 if (!stdcxx . . $ std/::isdigitcxx . . $ std/isdigit(a1851578aea3f541).(*ptr)) {
1663 return 0; /* Is not integer */
1664 }
1665 else
1666 return 1; /* Is integer */
1667 }
1668
1669 return -1; /* We shouldn't get here */
1670 }
1671
1672 static int _handle_listsearch_commandcxx . . $ pvpgn/bnetd/_handle_listsearch_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1673 {
1674 char ** e;
1675 int i = 0;
1676 unsigned rank = 0;
1677 unsigned points = 0;
1678 unsigned wins = 0;
1679 unsigned losses = 0;
1680 unsigned disconnects = 0;
1681 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1682 char data[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1683 t_accountcxx . . $ pvpgn/bnetd/t_account# * cl_account;
1684 t_clienttagcxx . . $ pvpgn/t_clienttag# cl_tag;
1685 t_ladder_idcxx . . $ pvpgn/bnetd/t_ladder_id# id = ladder_id_solocxx . . $ pvpgn/bnetd/ladder_id_solo.;
1686
1687 stdcxx . . $ std/::memset(data, 0, sizeof(data));
1688
1689 if ((numparams >= 1) && (params[0]) && (text)) {
1690 cl_tag = tag_sku_to_uintcxx . . $ pvpgn/tag_sku_to_uint(46cc46841198e427).(stdcxx . . $ std/::atoi(params[0]));
1691
1692 if (e = irc_get_ladderelemscxx . . $ pvpgn/bnetd/irc_get_ladderelems(c5fc499caf24bdd3).(text))
1693 {
1694 //TIMESTAMP 1147130452
1695 //TOTAL 12033
1696 //NOTFOUND
1697 // TIMESTAMP 1188740860
1698 // 'TOTAL 27466
1699 /* std::sprintf(temp,"TIMESTAMP %lu\n", std::time(NULL));
1700 std::strcat(data,temp);
1701 std::sprintf(temp,"TOTAL 88\n");
1702 std::strcat(data,temp);*/
1703
1704 for (i = 0; e[i]; i++) {
1705 /* Now we have in e[i] names */
1706 if (e[i] && (stdcxx . . $ std/::strcmp(e[i], ":") != 0)) {
1707 cl_account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(e[i]);
1708 if (cl_account && cl_tag && (rank = account_get_ladder_rankcxx . . $ pvpgn/bnetd/account_get_ladder_rank(829aa05f631ee398).(cl_account, cl_tag, id))) {
1709 points = account_get_ladder_pointscxx . . $ pvpgn/bnetd/account_get_ladder_points(829aa05f631ee398).(cl_account, cl_tag, id);
1710 wins = account_get_ladder_winscxx . . $ pvpgn/bnetd/account_get_ladder_wins(44091a2c7ac3910).(cl_account, cl_tag, id);
1711 losses = account_get_ladder_lossescxx . . $ pvpgn/bnetd/account_get_ladder_losses(44091a2c7ac3910).(cl_account, cl_tag, id);
1712 disconnects = account_get_ladder_disconnectscxx . . $ pvpgn/bnetd/account_get_ladder_disconnects(44091a2c7ac3910).(cl_account, cl_tag, id);
1713 stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "%u %s %u %u %u 0 %u\r\n", rank, e[i], points, wins, losses, disconnects);
1714 stdcxx . . $ std/::strcat(data, temp);
1715 }
1716 else
1717 stdcxx . . $ std/::strcat(data, "NOTFOUND\r\n");
1718 }
1719 }
1720 irc_unget_ladderelemscxx . . $ pvpgn/bnetd/irc_unget_ladderelems(b90f8021b121110e).(e);
1721
1722 _ladder_sendcxx . . $ pvpgn/bnetd/_ladder_send(2e9022cda97b266d).(conn, data);
1723 }
1724 }
1725 else {
1726 WARN0cxx . . $ `src/common/eventlog.h:78:9`!("Not enough parameters");
1727 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(conn, conn_state_destroycxx . . $ pvpgn/bnetd/conn_state_destroy.);
1728 return 0;
1729 }
1730 return 0;
1731 }
1732
1733 static int _handle_rungsearch_commandcxx . . $ pvpgn/bnetd/_handle_rungsearch_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1734 {
1735 char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1736 char data[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.];
1737 unsigned rank = 0;
1738 unsigned points = 0;
1739 unsigned wins = 0;
1740 unsigned losses = 0;
1741 unsigned disconnects = 0;
1742 t_accountcxx . . $ pvpgn/bnetd/t_account# * cl_account;
1743 t_clienttagcxx . . $ pvpgn/t_clienttag# cl_tag;
1744 t_ladder_idcxx . . $ pvpgn/bnetd/t_ladder_id# id = ladder_id_solocxx . . $ pvpgn/bnetd/ladder_id_solo.;
1745
1746 stdcxx . . $ std/::memset(data, 0, sizeof(data));
1747
1748 if ((numparams >= 4) && (params[0]) && (params[1]) && (params[3])) {
1749 cl_tag = tag_sku_to_uintcxx . . $ pvpgn/tag_sku_to_uint(46cc46841198e427).(stdcxx . . $ std/::atoi(params[3]));
1750
1751 if ((cl_tag != CLIENTTAG_TIBERNSUN_UINTcxx . . $ `src/common/tag.h:122:9`!) && (cl_tag != CLIENTTAG_TIBSUNXP_UINTcxx . . $ `src/common/tag.h:124:9`!)
1752 && (cl_tag != CLIENTTAG_REDALERT2_UINTcxx . . $ `src/common/tag.h:128:9`!) && (cl_tag != CLIENTTAG_YURISREV_UINTcxx . . $ `src/common/tag.h:140:9`!)) {
1753 // PELISH: We are not supporting ladders for all WOL clients yet
1754 stdcxx . . $ std/::strcat(data, "\r\n");
1755 _ladder_sendcxx . . $ pvpgn/bnetd/_ladder_send(2e9022cda97b266d).(conn, data);
1756 DEBUG1cxx . . $ `src/common/eventlog.h:89:9`!("Wants rung search for SKU {}", params[3]);
1757 return 0;
1758 }
1759
1760 if (_ladder_is_integercxx . . $ pvpgn/bnetd/_ladder_is_integer(1ef8e6ec083aabb9).(params[0]) == 0) {
1761 /* rungsearch want to line for one player (nick is in params[0]) */
1762 cl_account = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(params[0]);
1763 if (cl_account && cl_tag && (rank = account_get_ladder_rankcxx . . $ pvpgn/bnetd/account_get_ladder_rank(829aa05f631ee398).(cl_account, cl_tag, id))) {
1764 points = account_get_ladder_pointscxx . . $ pvpgn/bnetd/account_get_ladder_points(829aa05f631ee398).(cl_account, cl_tag, id);
1765 wins = account_get_ladder_winscxx . . $ pvpgn/bnetd/account_get_ladder_wins(44091a2c7ac3910).(cl_account, cl_tag, id);
1766 losses = account_get_ladder_lossescxx . . $ pvpgn/bnetd/account_get_ladder_losses(44091a2c7ac3910).(cl_account, cl_tag, id);
1767 disconnects = account_get_ladder_disconnectscxx . . $ pvpgn/bnetd/account_get_ladder_disconnects(44091a2c7ac3910).(cl_account, cl_tag, id);
1768 stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "%u %s %u %u %u 0 %u\r\n", rank, params[0], points, wins, losses, disconnects);
1769 }
1770 else
1771 stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "\r\n");
1772 _ladder_sendcxx . . $ pvpgn/bnetd/_ladder_send(2e9022cda97b266d).(conn, temp);
1773 }
1774 else {
1775 /* Standard RUNG search */
1776 unsigned start = stdcxx . . $ std/::atoi(params[0]);
1777 unsigned count = stdcxx . . $ std/::atoi(params[1]);
1778
1779 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "Start({}) Count({})", start, count);
1780
1781 LadderListcxx . . $ pvpgn/bnetd/LadderList#* ladderList = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1782
1783 ladderList = ladderscxx . . $ pvpgn/bnetd/ladders..getLadderListcxx . . $ pvpgn/bnetd/Ladders#getLadderList(2c0c64fbd1351270).(LadderKeycxx . . $ pvpgn/bnetd/LadderKey#LadderKey(f0da15e05d48c065).(id, cl_tag, ladder_sort_defaultcxx . . $ pvpgn/bnetd/ladder_sort_default., ladder_time_defaultcxx . . $ pvpgn/bnetd/ladder_time_default.));
1784 for (unsigned int i = start; i < start + count; i++) {
1785 const LadderReferencedObjectcxx . . $ pvpgn/bnetd/LadderReferencedObject#* referencedObject = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1786 cl_account = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1787 if (((referencedObject = ladderList->getReferencedObjectcxx . . $ pvpgn/bnetd/LadderList#getReferencedObject(56fd0941de524e93).(i))) && (cl_account = referencedObject->getAccountcxx . . $ pvpgn/bnetd/LadderReferencedObject#getAccount(bd50dfe41cbbfab3).())) {
1788 rank = account_get_ladder_rankcxx . . $ pvpgn/bnetd/account_get_ladder_rank(829aa05f631ee398).(cl_account, cl_tag, id);
1789 points = account_get_ladder_pointscxx . . $ pvpgn/bnetd/account_get_ladder_points(829aa05f631ee398).(cl_account, cl_tag, id);
1790 wins = account_get_ladder_winscxx . . $ pvpgn/bnetd/account_get_ladder_wins(44091a2c7ac3910).(cl_account, cl_tag, id);
1791 losses = account_get_ladder_lossescxx . . $ pvpgn/bnetd/account_get_ladder_losses(44091a2c7ac3910).(cl_account, cl_tag, id);
1792 disconnects = account_get_ladder_disconnectscxx . . $ pvpgn/bnetd/account_get_ladder_disconnects(44091a2c7ac3910).(cl_account, cl_tag, id);
1793 stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "%u %s %u %u %u 0 %u\r\n", rank, account_get_namecxx . . $ `src/bnetd/account.h:115:10`!(cl_account), points, wins, losses, disconnects);
1794 stdcxx . . $ std/::strcat(data, temp);
1795 }
1796 else {
1797 stdcxx . . $ std/::strcat(data, "\r\n");
1798 _ladder_sendcxx . . $ pvpgn/bnetd/_ladder_send(2e9022cda97b266d).(conn, data);
1799 return 0;
1800 }
1801 }
1802 _ladder_sendcxx . . $ pvpgn/bnetd/_ladder_send(2e9022cda97b266d).(conn, data);
1803 }
1804 }
1805 else {
1806 WARN0cxx . . $ `src/common/eventlog.h:78:9`!("Not enough parameters");
1807 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(conn, conn_state_destroycxx . . $ pvpgn/bnetd/conn_state_destroy.);
1808 return 0;
1809 }
1810 return 0;
1811 }
1812
1813 static int _handle_highscore_commandcxx . . $ pvpgn/bnetd/_handle_highscore_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text)
1814 {
1815 /* char ** e;
1816 int i = 0;
1817 unsigned rank = 2;
1818 unsigned points = 258;
1819 unsigned wins = 0;
1820 unsigned losses = 0;
1821 unsigned unknown = 0; // Here is nuber before Nick and Honor Badges in Yuri (1-999)
1822 unsigned disconnects = 0;
1823 char temp[MAX_IRC_MESSAGE_LEN];
1824 char data[MAX_IRC_MESSAGE_LEN];
1825 t_account * cl_account;
1826 t_clienttag cltag;
1827
1828 std::memset(temp,0,sizeof(temp));
1829 std::memset(data,0,sizeof(data));
1830
1831 if (text)
1832 e = irc_get_ladderelems(text);
1833
1834 if (params[0])
1835 cltag = tag_sku_to_uint(std::atoi(params[0]));
1836
1837 for (i=0;e[i];i++) {
1838 if (e[i] && (std::strcmp(e[i], ":") != 0)) {
1839 cl_account = accountlist_find_account(e[i]);
1840 if (cl_account) {
1841 wins = account_get_normal_wins(cl_account, cltag);
1842 losses = account_get_normal_losses(cl_account, cltag);
1843 disconnects = account_get_normal_disconnects(cl_account, cltag);
1844 std::sprintf(temp,"%u %s %u %u %u %u %u\r\n",rank+i,e[i],points,wins,losses,unknown,disconnects);
1845 std::strcat(data,temp);
1846 }
1847 else
1848 std::strcat(data,"NOTFOUND\r\n");
1849 }
1850 }
1851
1852 if (e)
1853 irc_unget_ladderelems(e);
1854
1855 _ladder_send(conn,data);
1856 */
1857 conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(conn, conn_state_destroycxx . . $ pvpgn/bnetd/conn_state_destroy.);
1858 return 0;
1859 }
1860
1861 }
1862
1863 }