| 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 "irc.h"cxx . . $ `<file>/src/bnetd/irc.h`/ |
| 23 | |
| 24 | #include <cinttypes> |
| 25 | #include <cstdint> |
| 26 | #include <cstdio> |
| 27 | #include <cstdlib> |
| 28 | #include <cstring> |
| 29 | #include <ctime> |
| 30 | |
| 31 | #include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/ |
| 32 | |
| 33 | #include "common/irc_protocol.h"cxx . . $ `<file>/src/common/irc_protocol.h`/ |
| 34 | #include "common/packet.h"cxx . . $ `<file>/src/common/packet.h`/ |
| 35 | #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 36 | #include "common/field_sizes.h"cxx . . $ `<file>/src/common/field_sizes.h`/ |
| 37 | #include "common/bnethash.h"cxx . . $ `<file>/src/common/bnethash.h`/ |
| 38 | #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/ |
| 39 | #include "common/addr.h"cxx . . $ `<file>/src/common/addr.h`/ |
| 40 | #include "common/tag.h"cxx . . $ `<file>/src/common/tag.h`/ |
| 41 | #include "common/list.h"cxx . . $ `<file>/src/common/list.h`/ |
| 42 | #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 43 | |
| 44 | #include "message.h"cxx . . $ `<file>/src/bnetd/message.h`/ |
| 45 | #include "channel.h"cxx . . $ `<file>/src/bnetd/channel.h`/ |
| 46 | #include "game.h"cxx . . $ `<file>/src/bnetd/game.h`/ |
| 47 | #include "connection.h"cxx . . $ `<file>/src/bnetd/connection.h`/ |
| 48 | #include "server.h"cxx . . $ `<file>/src/bnetd/server.h`/ |
| 49 | #include "account.h"cxx . . $ `<file>/src/bnetd/account.h`/ |
| 50 | #include "account_wrap.h"cxx . . $ `<file>/src/bnetd/account_wrap.h`/ |
| 51 | #include "prefs.h"cxx . . $ `<file>/src/bnetd/prefs.h`/ |
| 52 | #include "tick.h"cxx . . $ `<file>/src/bnetd/tick.h`/ |
| 53 | #include "handle_irc.h"cxx . . $ `<file>/src/bnetd/handle_irc.h`/ |
| 54 | #include "handle_wol.h"cxx . . $ `<file>/src/bnetd/handle_wol.h`/ |
| 55 | #include "command_groups.h"cxx . . $ `<file>/src/bnetd/command_groups.h`/ |
| 56 | #include "topic.h"cxx . . $ `<file>/src/bnetd/topic.h`/ |
| 57 | #include "clan.h"cxx . . $ `<file>/src/bnetd/clan.h`/ |
| 58 | #include "command.h"cxx . . $ `<file>/src/bnetd/command.h`/ |
| 59 | #include "anongame_wol.h"cxx . . $ `<file>/src/bnetd/anongame_wol.h`/ |
| 60 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 61 | |
| 62 | namespace pvpgncxx . . $ pvpgn/ |
| 63 | { |
| 64 | |
| 65 | namespace bnetdcxx . . $ pvpgn/bnetd/ |
| 66 | { |
| 67 | |
| 68 | typedef structcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0# { |
| 69 | char const * nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.; |
| 70 | char const * usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user.; |
| 71 | char const * hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host.; |
| 72 | } t_irc_message_fromcxx . . $ pvpgn/bnetd/t_irc_message_from#; |
| 73 | |
| 74 | |
| 75 | static char ** irc_split_elemscxx . . $ pvpgn/bnetd/irc_split_elems(ca01b5a8ca285a2).(char * list, int separator, int ignoreblank); |
| 76 | static int irc_unget_elemscxx . . $ pvpgn/bnetd/irc_unget_elems(b90f8021b121110e).(char ** elems); |
| 77 | static char * irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(t_irc_message_fromcxx . . $ pvpgn/bnetd/t_irc_message_from# const * from, char const * command, char const * dest, char const * text); |
| 78 | |
| 79 | extern int irc_send_cmdcxx . . $ pvpgn/bnetd/irc_send_cmd(973a17a902b892b0).(t_connection * conn, char const * command, char const * params) |
| 80 | { |
| 81 | t_packetcxx . . $ pvpgn/t_packet# * p; |
| 82 | char data[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN. + 1]; |
| 83 | char const * ircname = server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).(); |
| 84 | char const * nick; |
| 85 | |
| 86 | if (!conn) { |
| 87 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 88 | return -1; |
| 89 | } |
| 90 | if (!command) { |
| 91 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL command"); |
| 92 | return -1; |
| 93 | } |
| 94 | if (!(p = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_rawcxx . . $ pvpgn/packet_class_raw.))) { |
| 95 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not create packet"); |
| 96 | return -1; |
| 97 | } |
| 98 | |
| 99 | nick = conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn); |
| 100 | if (!nick) |
| 101 | nick = "UserName"; |
| 102 | |
| 103 | if (params) |
| 104 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(data, sizeof(data), ":%s %s %s %s", ircname, command, nick, params); |
| 105 | else |
| 106 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(data, sizeof(data), ":%s %s %s", ircname, command, nick); |
| 107 | |
| 108 | DEBUG2cxx . . $ `src/common/eventlog.h:90:9`!("[{}] sent \"{}\"", conn_get_socket(conn), data); |
| 109 | stdcxx . . $ std/::strcat(data, "\r\n"); |
| 110 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(p, 0); |
| 111 | packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(p, data, stdcxx . . $ std/::strlen(data)); |
| 112 | conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn, p); |
| 113 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(p); |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | extern int irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(t_connection * conn, int code, char const * params) |
| 118 | { |
| 119 | char temp[4]; /* '000\0' */ |
| 120 | |
| 121 | if (!conn) { |
| 122 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 123 | return -1; |
| 124 | } |
| 125 | if ((code > 999) || (code < 0)) { /* more than 3 digits or negative */ |
| 126 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "invalid message code ({})", code); |
| 127 | return -1; |
| 128 | } |
| 129 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "%03u", code); |
| 130 | return irc_send_cmdcxx . . $ pvpgn/bnetd/irc_send_cmd(973a17a902b892b0).(conn, temp, params); |
| 131 | } |
| 132 | |
| 133 | extern int irc_send_pingcxx . . $ pvpgn/bnetd/irc_send_ping(c4dfbc2386fe4fc3).(t_connection * conn) |
| 134 | { |
| 135 | t_packetcxx . . $ pvpgn/t_packet# * p; |
| 136 | char data[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 137 | |
| 138 | if (!conn) { |
| 139 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 140 | return -1; |
| 141 | } |
| 142 | |
| 143 | if ((conn_get_classcxx . . $ pvpgn/bnetd/conn_get_class(1f98a8b9c19f47bc).(conn) == conn_class_wserv) || |
| 144 | (conn_get_classcxx . . $ pvpgn/bnetd/conn_get_class(1f98a8b9c19f47bc).(conn) == conn_class_wgameres) || |
| 145 | (conn_get_classcxx . . $ pvpgn/bnetd/conn_get_class(1f98a8b9c19f47bc).(conn) == conn_class_wladder)) |
| 146 | return 0; |
| 147 | |
| 148 | if (!(p = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_rawcxx . . $ pvpgn/packet_class_raw.))) { |
| 149 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not create packet"); |
| 150 | return -1; |
| 151 | } |
| 152 | |
| 153 | conn_set_ircpingcxx . . $ pvpgn/bnetd/conn_set_ircping(c14bb6458e7562a).(conn, get_tickscxx . . $ pvpgn/bnetd/get_ticks(db52760e79bf9054).()); |
| 154 | if (conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(conn) == conn_state_bot_username) |
| 155 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(data, "PING :%u", conn_get_ircpingcxx . . $ pvpgn/bnetd/conn_get_ircping(8bd2285a65940781).(conn)); /* Undernet doesn't reveal the servername yet ... neither do we */ |
| 156 | else if ((6 + stdcxx . . $ std/::strlen(server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()) + 2 + 1) <= MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) |
| 157 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(data, "PING :%s", server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()); |
| 158 | else |
| 159 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "maximum message length exceeded"); |
| 160 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] sent \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(conn), data); |
| 161 | stdcxx . . $ std/::strcat(data, "\r\n"); |
| 162 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(p, 0); |
| 163 | packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(p, data, stdcxx . . $ std/::strlen(data)); |
| 164 | conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn, p); |
| 165 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(p); |
| 166 | return 0; |
| 167 | } |
| 168 | |
| 169 | extern int irc_send_pongcxx . . $ pvpgn/bnetd/irc_send_pong(2e9022cda97b266d).(t_connection * conn, char const * params) |
| 170 | { |
| 171 | t_packetcxx . . $ pvpgn/t_packet# * p; |
| 172 | char data[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 173 | |
| 174 | if (!conn) { |
| 175 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 176 | return -1; |
| 177 | } |
| 178 | if ((1 + stdcxx . . $ std/::strlen(server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()) + 1 + 4 + 1 + stdcxx . . $ std/::strlen(server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()) + ((params) ? (2 + stdcxx . . $ std/::strlen(params)) : (0)) + 2 + 1) > MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) { |
| 179 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "max message length exceeded"); |
| 180 | return -1; |
| 181 | } |
| 182 | if (!(p = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_rawcxx . . $ pvpgn/packet_class_raw.))) { |
| 183 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not create packet"); |
| 184 | return -1; |
| 185 | } |
| 186 | |
| 187 | if (params) |
| 188 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(data, ":%s PONG %s :%s", server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).(), server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).(), params); |
| 189 | else |
| 190 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(data, ":%s PONG %s", server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).(), server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()); |
| 191 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] sent \"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(conn), data); |
| 192 | stdcxx . . $ std/::strcat(data, "\r\n"); |
| 193 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(p, 0); |
| 194 | packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(p, data, stdcxx . . $ std/::strlen(data)); |
| 195 | conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(conn, p); |
| 196 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(p); |
| 197 | return 0; |
| 198 | } |
| 199 | |
| 200 | extern int irc_authenticatecxx . . $ pvpgn/bnetd/irc_authenticate(2e9022cda97b266d).(t_connection * conn, char const * passhash) |
| 201 | { |
| 202 | /* FIXME: Move this function to handle_irc.* file! */ |
| 203 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 204 | t_hashcxx . . $ pvpgn/t_hash# h1; |
| 205 | t_hashcxx . . $ pvpgn/t_hash# h2; |
| 206 | t_accountcxx . . $ pvpgn/bnetd/t_account# * a; |
| 207 | char const * temphash; |
| 208 | char const * username; |
| 209 | |
| 210 | if (!conn) { |
| 211 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 212 | return 0; |
| 213 | } |
| 214 | if (!passhash) { |
| 215 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL passhash"); |
| 216 | return 0; |
| 217 | } |
| 218 | username = conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn); |
| 219 | if (!username) { |
| 220 | /* redundant sanity check */ |
| 221 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL conn->protocol.loggeduser"); |
| 222 | return 0; |
| 223 | } |
| 224 | a = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(username); |
| 225 | if (!a) { |
| 226 | 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."); |
| 227 | return 0; |
| 228 | } |
| 229 | |
| 230 | 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) { |
| 231 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :Account is already in use!", conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn)); |
| 232 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NICKNAMEINUSEcxx . . $ `src/common/irc_protocol.h:412:9`!, temp); |
| 233 | } |
| 234 | else if (account_get_auth_lockcxx . . $ pvpgn/bnetd/account_get_auth_lock(367bfb076f70247b).(a) == 1) { |
| 235 | 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) "); |
| 236 | } |
| 237 | else |
| 238 | { |
| 239 | hash_set_strcxx . . $ pvpgn/hash_set_str(bc9a1c18029b2ef4).(&h1, passhash); |
| 240 | temphash = account_get_passcxx . . $ pvpgn/bnetd/account_get_pass(4b37305d4a4563d0).(a); |
| 241 | hash_set_strcxx . . $ pvpgn/hash_set_str(bc9a1c18029b2ef4).(&h2, temphash); |
| 242 | if (hash_eqcxx . . $ pvpgn/hash_eq(4301982f75a4a5fa).(h1, h2)) { |
| 243 | conn_logincxx . . $ pvpgn/bnetd/conn_login(37ada50ef2b0abe1).(conn, a, username); |
| 244 | conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(conn, conn_state_loggedin); |
| 245 | conn_set_clienttagcxx . . $ pvpgn/bnetd/conn_set_clienttag(d97ad1b62a895b69).(conn, CLIENTTAG_IIRC_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:116:9`!); /* IIRC hope here is ok */ |
| 246 | 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 successful. You are now logged in."); |
| 247 | return 1; |
| 248 | } |
| 249 | else { |
| 250 | 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."); /* wrong password */ |
| 251 | conn_increment_passfail_countcxx . . $ pvpgn/bnetd/conn_increment_passfail_count(c4dfbc2386fe4fc3).(conn); |
| 252 | } |
| 253 | } |
| 254 | return 0; |
| 255 | } |
| 256 | |
| 257 | /* Channel name conversion rules: */ |
| 258 | /* Not allowed in IRC (RFC2812): NUL, BELL, CR, LF, ' ', ':' and ','*/ |
| 259 | /* ' ' -> '_' */ |
| 260 | /* '_' -> '%_' */ |
| 261 | /* '%' -> '%%' */ |
| 262 | /* '\b' -> '%b' */ |
| 263 | /* '\n' -> '%n' */ |
| 264 | /* '\r' -> '%r' */ |
| 265 | /* ':' -> '%=' */ |
| 266 | /* ',' -> '%-' */ |
| 267 | /* In IRC a channel can be specified by '#'+channelname or '!'+channelid */ |
| 268 | extern char const * irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(t_channelcxx . . $ pvpgn/bnetd/t_channel# const * channel, t_connection * c) |
| 269 | { |
| 270 | char const * bname; |
| 271 | static char out[MAX_CHANNELNAME_LENcxx . . $ MAX_CHANNELNAME_LEN.]; |
| 272 | unsigned int outpos; |
| 273 | int i; |
| 274 | |
| 275 | if (!channel) |
| 276 | return "*"; |
| 277 | |
| 278 | stdcxx . . $ std/::memset(out, 0, sizeof(out)); |
| 279 | out[0] = '#'; |
| 280 | outpos = 1; |
| 281 | |
| 282 | if ((conn_get_wolcxx . . $ pvpgn/bnetd/conn_get_wol(c4dfbc2386fe4fc3).(c) == 1) && (channel_get_clienttagcxx . . $ pvpgn/bnetd/channel_get_clienttag(6768ecacf43d05ec).(channel) != 0 && (conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c) == channel_get_clienttagcxx . . $ pvpgn/bnetd/channel_get_clienttag(6768ecacf43d05ec).(channel)))) |
| 283 | bname = channel_get_shortnamecxx . . $ pvpgn/bnetd/channel_get_shortname(7800017c14723985).(channel); /* We converting unreadable "lob 18 0" names to human redable ones */ |
| 284 | else |
| 285 | bname = channel_get_namecxx . . $ pvpgn/bnetd/channel_get_name(7800017c14723985).(channel); |
| 286 | |
| 287 | for (i = 0; bname[i] != '\0'; i++) { |
| 288 | if (bname[i] == ' ') { |
| 289 | out[outpos++] = '_'; |
| 290 | } |
| 291 | else if (bname[i] == '_') { |
| 292 | out[outpos++] = '%'; |
| 293 | out[outpos++] = '_'; |
| 294 | } |
| 295 | else if (bname[i] == '%') { |
| 296 | out[outpos++] = '%'; |
| 297 | out[outpos++] = '%'; |
| 298 | } |
| 299 | else if (bname[i] == '\b') { |
| 300 | out[outpos++] = '%'; |
| 301 | out[outpos++] = 'b'; |
| 302 | } |
| 303 | else if (bname[i] == '\n') { |
| 304 | out[outpos++] = '%'; |
| 305 | out[outpos++] = 'n'; |
| 306 | } |
| 307 | else if (bname[i] == '\r') { |
| 308 | out[outpos++] = '%'; |
| 309 | out[outpos++] = 'r'; |
| 310 | } |
| 311 | else if (bname[i] == ':') { |
| 312 | out[outpos++] = '%'; |
| 313 | out[outpos++] = '='; |
| 314 | } |
| 315 | else if (bname[i] == ',') { |
| 316 | out[outpos++] = '%'; |
| 317 | out[outpos++] = '-'; |
| 318 | } |
| 319 | else { |
| 320 | out[outpos++] = bname[i]; |
| 321 | } |
| 322 | if ((outpos + 2) >= (sizeof(out))) { |
| 323 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(out, "!%u", channel_get_channelidcxx . . $ pvpgn/bnetd/channel_get_channelid(6768ecacf43d05ec).(channel)); |
| 324 | return out; |
| 325 | } |
| 326 | } |
| 327 | return out; |
| 328 | } |
| 329 | |
| 330 | extern char const * irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(char const * pircname) |
| 331 | { |
| 332 | static char out[MAX_CHANNELNAME_LENcxx . . $ MAX_CHANNELNAME_LEN.]; |
| 333 | unsigned int outpos; |
| 334 | int special; |
| 335 | int i; |
| 336 | char const * ircname = pircname + 1; |
| 337 | |
| 338 | if (!ircname) { |
| 339 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL ircname"); |
| 340 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 341 | } |
| 342 | |
| 343 | outpos = 0; |
| 344 | stdcxx . . $ std/::memset(out, 0, sizeof(out)); |
| 345 | special = 0; |
| 346 | if (pircname[0] == '!') { |
| 347 | t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel; |
| 348 | |
| 349 | channel = channellist_find_channel_bychannelidcxx . . $ pvpgn/bnetd/channellist_find_channel_bychannelid(ed5f201769bfa7d2).(stdcxx . . $ std/::atoi(ircname)); |
| 350 | if (channel) |
| 351 | return channel_get_namecxx . . $ pvpgn/bnetd/channel_get_name(7800017c14723985).(channel); |
| 352 | else |
| 353 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 354 | } |
| 355 | else if (pircname[0] != '#') { |
| 356 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 357 | } |
| 358 | for (i = 0; ircname[i] != '\0'; i++) { |
| 359 | if (ircname[i] == '_') { |
| 360 | out[outpos++] = ' '; |
| 361 | } |
| 362 | else if (ircname[i] == '%') { |
| 363 | if (special) { |
| 364 | out[outpos++] = '%'; |
| 365 | special = 0; |
| 366 | } |
| 367 | else { |
| 368 | special = 1; |
| 369 | } |
| 370 | } |
| 371 | else if (special) { |
| 372 | if (ircname[i] == '_') { |
| 373 | out[outpos++] = '_'; |
| 374 | } |
| 375 | else if (ircname[i] == 'b') { |
| 376 | out[outpos++] = '\b'; |
| 377 | } |
| 378 | else if (ircname[i] == 'n') { |
| 379 | out[outpos++] = '\n'; |
| 380 | } |
| 381 | else if (ircname[i] == 'r') { |
| 382 | out[outpos++] = '\r'; |
| 383 | } |
| 384 | else if (ircname[i] == '=') { |
| 385 | out[outpos++] = ':'; |
| 386 | } |
| 387 | else if (ircname[i] == '-') { |
| 388 | out[outpos++] = ','; |
| 389 | } |
| 390 | else { |
| 391 | /* maybe it's just a typo :) */ |
| 392 | out[outpos++] = '%'; |
| 393 | out[outpos++] = ircname[i]; |
| 394 | } |
| 395 | } |
| 396 | else { |
| 397 | out[outpos++] = ircname[i]; |
| 398 | } |
| 399 | if ((outpos + 2) >= (sizeof(out))) { |
| 400 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 401 | } |
| 402 | } |
| 403 | return out; |
| 404 | } |
| 405 | |
| 406 | /* splits an string list into its elements */ |
| 407 | /* (list will be modified) */ |
| 408 | static char ** irc_split_elemscxx . . $ pvpgn/bnetd/irc_split_elems(ca01b5a8ca285a2).(char * list, int separator, int ignoreblank) |
| 409 | { |
| 410 | int i; |
| 411 | int count; |
| 412 | char ** out; |
| 413 | |
| 414 | if (!list) { |
| 415 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL list"); |
| 416 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 417 | } |
| 418 | |
| 419 | for (count = 0, i = 0; list[i] != '\0'; i++) { |
| 420 | if (list[i] == separator) { |
| 421 | count++; |
| 422 | if (ignoreblank) { |
| 423 | /* ignore more than one separators "in a row" */ |
| 424 | while ((list[i + 1] != '\0') && (list[i] == separator)) i++; |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | count++; /* count separators -> we have one more element ... */ |
| 429 | /* we also need a terminating element */ |
| 430 | out = (char**)xmalloccxx . . $ `src/common/xalloc.h:43:9`!((count + 1)*sizeof(char *)); |
| 431 | |
| 432 | out[0] = list; |
| 433 | if (count > 1) { |
| 434 | for (i = 1; i < count; i++) { |
| 435 | out[i] = stdcxx . . $ std/::strchr(out[i - 1], separator); |
| 436 | if (!out[i]) { |
| 437 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "BUG: wrong number of separators"); |
| 438 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(out); |
| 439 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 440 | } |
| 441 | if (ignoreblank) |
| 442 | while ((*out[i] + 1) == separator) out[i]++; |
| 443 | *out[i]++ = '\0'; |
| 444 | } |
| 445 | if ((ignoreblank) && (out[count - 1]) && (*out[count - 1] == '\0')) { |
| 446 | out[count - 1] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; /* last element is blank */ |
| 447 | } |
| 448 | } |
| 449 | else if ((ignoreblank) && (*out[0] == '\0')) { |
| 450 | out[0] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; /* now we have 2 terminators ... never mind */ |
| 451 | } |
| 452 | out[count] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; /* terminating element */ |
| 453 | return out; |
| 454 | } |
| 455 | |
| 456 | static int irc_unget_elemscxx . . $ pvpgn/bnetd/irc_unget_elems(b90f8021b121110e).(char ** elems) |
| 457 | { |
| 458 | if (!elems) { |
| 459 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL elems"); |
| 460 | return -1; |
| 461 | } |
| 462 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(elems); |
| 463 | return 0; |
| 464 | } |
| 465 | |
| 466 | extern char ** irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(char * list) |
| 467 | { |
| 468 | return irc_split_elemscxx . . $ pvpgn/bnetd/irc_split_elems(ca01b5a8ca285a2).(list, ',', 0); |
| 469 | } |
| 470 | |
| 471 | extern int irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(char ** elems) |
| 472 | { |
| 473 | return irc_unget_elemscxx . . $ pvpgn/bnetd/irc_unget_elems(b90f8021b121110e).(elems); |
| 474 | } |
| 475 | |
| 476 | extern char ** irc_get_paramelemscxx . . $ pvpgn/bnetd/irc_get_paramelems(c5fc499caf24bdd3).(char * list) |
| 477 | { |
| 478 | return irc_split_elemscxx . . $ pvpgn/bnetd/irc_split_elems(ca01b5a8ca285a2).(list, ' ', 1); |
| 479 | } |
| 480 | |
| 481 | extern int irc_unget_paramelemscxx . . $ pvpgn/bnetd/irc_unget_paramelems(b90f8021b121110e).(char ** elems) |
| 482 | { |
| 483 | return irc_unget_elemscxx . . $ pvpgn/bnetd/irc_unget_elems(b90f8021b121110e).(elems); |
| 484 | } |
| 485 | |
| 486 | extern char ** irc_get_ladderelemscxx . . $ pvpgn/bnetd/irc_get_ladderelems(c5fc499caf24bdd3).(char * list) |
| 487 | { |
| 488 | return irc_split_elemscxx . . $ pvpgn/bnetd/irc_split_elems(ca01b5a8ca285a2).(list, ':', 1); |
| 489 | } |
| 490 | |
| 491 | extern int irc_unget_ladderelemscxx . . $ pvpgn/bnetd/irc_unget_ladderelems(b90f8021b121110e).(char ** elems) |
| 492 | { |
| 493 | return irc_unget_elemscxx . . $ pvpgn/bnetd/irc_unget_elems(b90f8021b121110e).(elems); |
| 494 | } |
| 495 | |
| 496 | static char * irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(t_irc_message_fromcxx . . $ pvpgn/bnetd/t_irc_message_from# const * from, char const * command, char const * dest, char const * text) |
| 497 | { |
| 498 | char * myfrom; |
| 499 | char const * mydest = ""; |
| 500 | char const * mytext = ""; |
| 501 | int len; |
| 502 | char * msg; |
| 503 | |
| 504 | if (!command) { |
| 505 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL command"); |
| 506 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 507 | } |
| 508 | if (from) { |
| 509 | if ((!from->nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.) || (!from->usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user.) || (!from->hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host.)) { |
| 510 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got malformed from"); |
| 511 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 512 | } |
| 513 | myfrom = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(from->nick) + 1 + std::strlen(from->user) + 1 + std::strlen(from->host) + 1); /* nick + "!" + user + "@" + host + "\0" */ |
| 514 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(myfrom, "%s!%s@%s", from->nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick., from->usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user., from->hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host.); |
| 515 | } |
| 516 | else |
| 517 | myfrom = xstrdupcxx . . $ `src/common/xalloc.h:49:9`!(server_get_hostname()); |
| 518 | if (dest) |
| 519 | mydest = dest; |
| 520 | |
| 521 | if (text) |
| 522 | mytext = text; |
| 523 | |
| 524 | len = 1 + stdcxx . . $ std/::strlen(myfrom) + 1 + |
| 525 | stdcxx . . $ std/::strlen(command) + 1 + |
| 526 | stdcxx . . $ std/::strlen(mydest) + 1 + |
| 527 | 1 + stdcxx . . $ std/::strlen(mytext) + 1; |
| 528 | |
| 529 | |
| 530 | msg = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(len); |
| 531 | |
| 532 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(msg, ":%s\n%s\n%s\n%s", myfrom, command, mydest, mytext); |
| 533 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(myfrom); |
| 534 | return msg; |
| 535 | } |
| 536 | |
| 537 | extern int irc_message_postformatcxx . . $ pvpgn/bnetd/irc_message_postformat(143918d49aad93d2).(t_packetcxx . . $ pvpgn/t_packet# * packet, t_connection const * dest) |
| 538 | { |
| 539 | /* the four elements */ |
| 540 | char * e1; |
| 541 | char * e1_2; |
| 542 | char * e2; |
| 543 | char * e3; |
| 544 | char * e4; |
| 545 | char const * tname = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 546 | char const * toname = "AUTH"; /* fallback name */ |
| 547 | const char * temp; |
| 548 | |
| 549 | if (!packet) { |
| 550 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL packet"); |
| 551 | return -1; |
| 552 | } |
| 553 | if (!dest) { |
| 554 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL dest"); |
| 555 | return -1; |
| 556 | } |
| 557 | |
| 558 | e1 = (char*)packet_get_raw_datacxx . . $ pvpgn/packet_get_raw_data(ed324b086ed1b636).(packet, 0); |
| 559 | e2 = stdcxx . . $ std/::strchr(e1, '\n'); |
| 560 | if (!e2) { |
| 561 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "malformed message (e2 missing)"); |
| 562 | return -1; |
| 563 | } |
| 564 | *e2++ = '\0'; |
| 565 | e3 = stdcxx . . $ std/::strchr(e2, '\n'); |
| 566 | if (!e3) { |
| 567 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "malformed message (e3 missing)"); |
| 568 | return -1; |
| 569 | } |
| 570 | *e3++ = '\0'; |
| 571 | e4 = stdcxx . . $ std/::strchr(e3, '\n'); |
| 572 | if (!e4) { |
| 573 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "malformed message (e4 missing)"); |
| 574 | return -1; |
| 575 | } |
| 576 | *e4++ = '\0'; |
| 577 | |
| 578 | if (prefs_get_hide_addrcxx . . $ pvpgn/bnetd/prefs_get_hide_addr(db52760e79bf9054).() && !(account_get_command_groupscxx . . $ pvpgn/bnetd/account_get_command_groups(c7ab9369555c44b8).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(dest)) & command_get_groupcxx . . $ pvpgn/bnetd/command_get_group(c61c63047ce273de).("/admin-addr"))) |
| 579 | { |
| 580 | e1_2 = stdcxx . . $ std/::strchr(e1, '@'); |
| 581 | if (e1_2) |
| 582 | { |
| 583 | *e1_2++ = '\0'; |
| 584 | } |
| 585 | } |
| 586 | else |
| 587 | e1_2 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 588 | |
| 589 | if (e3[0] == '\0') { /* fill in recipient */ |
| 590 | if ((tname = conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(dest))) |
| 591 | toname = tname; |
| 592 | } |
| 593 | else |
| 594 | toname = e3; |
| 595 | |
| 596 | if (stdcxx . . $ std/::strcmp(toname, "\r") == 0) { |
| 597 | toname = ""; /* HACK: the target field is really empty */ |
| 598 | temp = ""; |
| 599 | } |
| 600 | else |
| 601 | temp = " "; |
| 602 | |
| 603 | if (stdcxx . . $ std/::strlen(e1) + 1 + stdcxx . . $ std/::strlen(e2) + 1 + stdcxx . . $ std/::strlen(toname) + stdcxx . . $ std/::strlen(temp) + stdcxx . . $ std/::strlen(e4) + 2 + 1 <= MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) { |
| 604 | char msg[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN. + 1]; |
| 605 | |
| 606 | if (e1_2) |
| 607 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(msg, "%s@hidden %s %s%s%s", e1, e2, toname, temp, e4); |
| 608 | else |
| 609 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(msg, "%s %s %s%s%s", e1, e2, toname, temp, e4); |
| 610 | |
| 611 | DEBUG2cxx . . $ `src/common/eventlog.h:90:9`!("[{}] sent \"{}\"", conn_get_socket(dest), msg); |
| 612 | stdcxx . . $ std/::strcat(msg, "\r\n"); |
| 613 | |
| 614 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(packet, 0); |
| 615 | packet_append_datacxx . . $ pvpgn/packet_append_data(d82347a7305550af).(packet, msg, stdcxx . . $ std/::strlen(msg)); |
| 616 | if (tname) |
| 617 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(dest, tname); |
| 618 | return 0; |
| 619 | } |
| 620 | else { |
| 621 | /* FIXME: split up message? */ |
| 622 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "maximum IRC message length exceeded"); |
| 623 | if (tname) |
| 624 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(dest, tname); |
| 625 | return -1; |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | extern int irc_message_formatcxx . . $ pvpgn/bnetd/irc_message_format(575532a37bbcaa3d).(t_packetcxx . . $ pvpgn/t_packet# * packet, t_message_type type, t_connection * me, t_connection * dst, char const * text, unsigned int dstflags) |
| 630 | { |
| 631 | char * msg; |
| 632 | char const * ctag; |
| 633 | t_irc_message_fromcxx . . $ pvpgn/bnetd/t_irc_message_from# from; |
| 634 | |
| 635 | if (!packet) |
| 636 | { |
| 637 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL packet"); |
| 638 | return -1; |
| 639 | } |
| 640 | |
| 641 | msg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 642 | if (me) |
| 643 | ctag = clienttag_uint_to_str(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(me)); |
| 644 | else |
| 645 | ctag = clienttag_uint_to_str(CLIENTTAG_IIRC_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:116:9`!); |
| 646 | |
| 647 | switch (type) |
| 648 | { |
| 649 | /* case message_type_adduser: this is sent manually in handle_irc */ |
| 650 | case message_type_adduser: |
| 651 | /* when we do it somewhere else, then we can also make sure to not get our logs spammed */ |
| 652 | break; |
| 653 | case message_type_join: |
| 654 | { |
| 655 | t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel; |
| 656 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 657 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 658 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 659 | |
| 660 | channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(me); |
| 661 | |
| 662 | if (tag_check_wolv2(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(dst))) { |
| 663 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 664 | t_clancxx . . $ pvpgn/bnetd/t_clan# * clan; |
| 665 | unsigned int clanid = 0; |
| 666 | stdcxx . . $ std/::memset(temp, 0, sizeof(temp)); |
| 667 | |
| 668 | /** |
| 669 | * For WOLv2 the channel JOIN output must be like the following: |
| 670 | * user!WWOL@hostname JOIN :clanID,longIP channelName |
| 671 | */ |
| 672 | |
| 673 | clan = account_get_clancxx . . $ pvpgn/bnetd/account_get_clan(b1e25e267411fd2e).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(me)); |
| 674 | |
| 675 | if (clan) |
| 676 | clanid = clan_get_clanidcxx . . $ pvpgn/bnetd/clan_get_clanid(1e16ca1cec114489).(clan); |
| 677 | |
| 678 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":%u,%u", clanid, conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 679 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "JOIN", temp, irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, dst)); |
| 680 | } |
| 681 | else { |
| 682 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "JOIN", "\r", irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, dst)); |
| 683 | } |
| 684 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 685 | } |
| 686 | break; |
| 687 | case message_type_part: |
| 688 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 689 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 690 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 691 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "PART", "\r", irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(me), dst)); |
| 692 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 693 | break; |
| 694 | case message_type_talk: |
| 695 | case message_type_whisper: |
| 696 | { |
| 697 | char const * dest; |
| 698 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 699 | |
| 700 | if (me) { |
| 701 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 702 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 703 | } |
| 704 | else { |
| 705 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).(); |
| 706 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).(); |
| 707 | } |
| 708 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 709 | |
| 710 | if (type == message_type_talk) |
| 711 | dest = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(me), dst); /* FIXME: support more channels and choose right one! */ |
| 712 | else |
| 713 | dest = ""; /* will be replaced with username in postformat */ |
| 714 | |
| 715 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":%s", text); |
| 716 | |
| 717 | if ((conn_get_wolcxx . . $ pvpgn/bnetd/conn_get_wol(c4dfbc2386fe4fc3).(me) != 1) && (conn_get_wolcxx . . $ pvpgn/bnetd/conn_get_wol(c4dfbc2386fe4fc3).(dst) == 1) && (conn_wol_get_pagemecxx . . $ pvpgn/bnetd/conn_wol_get_pageme(5a60a6624233dc9b).(dst)) |
| 718 | && (type == message_type_whisper) && (conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(me) != (conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(dst)))) |
| 719 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "PAGE", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, temp); |
| 720 | else |
| 721 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "PRIVMSG", dest, temp); |
| 722 | |
| 723 | if (me) |
| 724 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 725 | } |
| 726 | break; |
| 727 | case message_type_emote: |
| 728 | { |
| 729 | char const * dest; |
| 730 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 731 | |
| 732 | /* "\001ACTION " + text + "\001" + \0 */ |
| 733 | |
| 734 | /* PELISH: WOLv1, DUNE2000 and RENEGADE shows emotes automaticaly to self */ |
| 735 | if ((me == dst) && ((tag_check_wolv1(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(dst))) || |
| 736 | (conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(dst) == CLIENTTAG_DUNE2000_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:130:9`!) || |
| 737 | (conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(dst) == CLIENTTAG_RENEGADE_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:136:9`!) || |
| 738 | (conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(dst) == CLIENTTAG_RENGDFDS_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:138:9`!))) |
| 739 | break; |
| 740 | |
| 741 | if ((8 + stdcxx . . $ std/::strlen(text) + 1 + 1) <= MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) { |
| 742 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":\001ACTION %s\001", text); |
| 743 | } |
| 744 | else { |
| 745 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":\001ACTION (maximum message length exceeded)\001"); |
| 746 | } |
| 747 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 748 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 749 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 750 | /* FIXME: also supports whisper emotes? */ |
| 751 | dest = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(me), dst); /* FIXME: support more channels and choose right one! */ |
| 752 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "PRIVMSG", dest, temp); |
| 753 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 754 | } |
| 755 | break; |
| 756 | case message_type_broadcast: |
| 757 | case message_type_info: |
| 758 | case message_type_error: |
| 759 | { |
| 760 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 761 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":%s", text); |
| 762 | if (conn_get_wolcxx . . $ pvpgn/bnetd/conn_get_wol(c4dfbc2386fe4fc3).(dst) == 1) { |
| 763 | if ((type == message_type_info) || (type == message_type_error)) |
| 764 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "PAGE", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, temp); |
| 765 | else |
| 766 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "NOTICE", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, temp); |
| 767 | } |
| 768 | else |
| 769 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "NOTICE", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, temp); |
| 770 | } |
| 771 | break; |
| 772 | case message_type_channel: |
| 773 | /* ignore it */ |
| 774 | break; |
| 775 | case message_type_userflags: |
| 776 | /* ignore it but maybe will be used for set MODE +o if user is operator |
| 777 | * but at this time is this command sended only once when user join |
| 778 | * first channel */ |
| 779 | break; |
| 780 | case message_type_mode: |
| 781 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 782 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 783 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 784 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "MODE", "\r", text); |
| 785 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 786 | break; |
| 787 | case message_type_nick: |
| 788 | { |
| 789 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(me); |
| 790 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 791 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 792 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "NICK", "\r", text); |
| 793 | } |
| 794 | break; |
| 795 | case message_type_notice: |
| 796 | { |
| 797 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 798 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":%s", text); |
| 799 | |
| 800 | if (me && conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me)) |
| 801 | { |
| 802 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 803 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 804 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 805 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "NOTICE", "", temp); |
| 806 | } |
| 807 | else |
| 808 | { |
| 809 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "NOTICE", "", temp); |
| 810 | } |
| 811 | } |
| 812 | break; |
| 813 | case message_type_namreply: |
| 814 | { |
| 815 | t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel; |
| 816 | |
| 817 | channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(me); |
| 818 | |
| 819 | irc_send_rpl_namreplycxx . . $ pvpgn/bnetd/irc_send_rpl_namreply(9a6ccea331d9f4).(dst, channel); |
| 820 | } |
| 821 | break; |
| 822 | case message_type_topic: |
| 823 | { |
| 824 | t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel; |
| 825 | channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(me); |
| 826 | irc_send_topiccxx . . $ pvpgn/bnetd/irc_send_topic(9a6ccea331d9f4).(dst, channel); |
| 827 | } |
| 828 | break; |
| 829 | case message_type_kick: |
| 830 | { |
| 831 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 832 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 833 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 834 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 835 | if (text) |
| 836 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "%s :%s", conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me), text); |
| 837 | else |
| 838 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "%s :", conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me)); |
| 839 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "KICK", irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(me), dst), temp); |
| 840 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 841 | } |
| 842 | break; |
| 843 | case message_type_quit: |
| 844 | if (conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(dst) == CLIENTTAG_IIRC_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:116:9`!) { |
| 845 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 846 | if (text) |
| 847 | sprintf(temp, ":%s", text); |
| 848 | else |
| 849 | sprintf(temp, ":"); |
| 850 | |
| 851 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 852 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 853 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 854 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "QUIT", "\r", temp); |
| 855 | } |
| 856 | else { |
| 857 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 858 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 859 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 860 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "PART", "\r", irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(me), dst)); |
| 861 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 862 | } |
| 863 | break; |
| 864 | |
| 865 | /** |
| 866 | * Westwood Online Extensions |
| 867 | */ |
| 868 | case message_type_host: |
| 869 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 870 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 871 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 872 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "HOST", "\r", text); |
| 873 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 874 | break; |
| 875 | case message_type_invmsg: |
| 876 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 877 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 878 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 879 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "INVMSG", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, text); |
| 880 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 881 | break; |
| 882 | case message_type_page: |
| 883 | { |
| 884 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 885 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 886 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 887 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 888 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":%s", text); |
| 889 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "PAGE", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, temp); |
| 890 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 891 | } |
| 892 | break; |
| 893 | case message_wol_joingame: |
| 894 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 895 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 896 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 897 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "JOINGAME", "\r", text); |
| 898 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 899 | break; |
| 900 | case message_type_gameopt_talk: |
| 901 | case message_type_gameopt_whisper: |
| 902 | { |
| 903 | char const * dest; |
| 904 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 905 | |
| 906 | if (me) { |
| 907 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 908 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 909 | } |
| 910 | else { |
| 911 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).(); |
| 912 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).(); |
| 913 | } |
| 914 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 915 | |
| 916 | if (type == message_type_gameopt_talk) |
| 917 | dest = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(me), dst); /* FIXME: support more channels and choose right one! */ |
| 918 | else |
| 919 | dest = ""; /* will be replaced with username in postformat */ |
| 920 | |
| 921 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":%s", text); |
| 922 | |
| 923 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "GAMEOPT", dest, temp); |
| 924 | |
| 925 | if (me) |
| 926 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 927 | } |
| 928 | break; |
| 929 | case message_wol_start_game: |
| 930 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 931 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 932 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 933 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "STARTG", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, text); |
| 934 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 935 | break; |
| 936 | case message_wol_advertr: |
| 937 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "ADVERTR", "\r", text); |
| 938 | break; |
| 939 | case message_wol_chanchk: |
| 940 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "CHANCHK", "\r", text); |
| 941 | break; |
| 942 | case message_wol_userip: |
| 943 | from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick. = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(me); |
| 944 | from.usercxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#user. = ctag; |
| 945 | from.hostcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#host. = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(me)); |
| 946 | msg = irc_message_preformatcxx . . $ pvpgn/bnetd/irc_message_preformat(562b301690314e61).(&from, "USERIP", "\r", text); |
| 947 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(me, from.nickcxx . . $ pvpgn/bnetd/$anonymous_type_8ceef776731a85c_0#nick.); |
| 948 | break; |
| 949 | default: |
| 950 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "{} not yet implemented", type); |
| 951 | return -1; |
| 952 | } |
| 953 | |
| 954 | if (msg) { |
| 955 | packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(packet, msg); |
| 956 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(msg); |
| 957 | return 0; |
| 958 | } |
| 959 | return -1; |
| 960 | } |
| 961 | |
| 962 | int irc_send_rpl_namreply_internalcxx . . $ pvpgn/bnetd/irc_send_rpl_namreply_internal(9a6ccea331d9f4).(t_connection * c, t_channelcxx . . $ pvpgn/bnetd/t_channel# const * channel){ |
| 963 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 964 | char const * ircname; |
| 965 | int first = 1; |
| 966 | t_connection * m; |
| 967 | |
| 968 | if (!channel) { |
| 969 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL channel"); |
| 970 | return -1; |
| 971 | } |
| 972 | |
| 973 | stdcxx . . $ std/::memset(temp, 0, sizeof(temp)); |
| 974 | ircname = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, c); |
| 975 | if (!ircname) { |
| 976 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "channel has NULL ircname"); |
| 977 | return -1; |
| 978 | } |
| 979 | /* '@' = secret; '*' = private; '=' = public */ |
| 980 | if ((1 + 1 + stdcxx . . $ std/::strlen(ircname) + 2 + 1) <= MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) { |
| 981 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "%c %s :", ((channel_get_permanentcxx . . $ pvpgn/bnetd/channel_get_permanent(28c764f7c20ec9b2).(channel)) ? ('=') : ('*')), ircname); |
| 982 | } |
| 983 | else { |
| 984 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "maximum message length exceeded"); |
| 985 | return -1; |
| 986 | } |
| 987 | |
| 988 | if (!(channel_get_flagscxx . . $ pvpgn/bnetd/channel_get_flags(6768ecacf43d05ec).(channel) & channel_flags_thevoidcxx . . $ pvpgn/bnetd/channel_flags_thevoid.)) |
| 989 | for (m = channel_get_firstcxx . . $ pvpgn/bnetd/channel_get_first(77c4a1edc1ac6ba1).(channel); m; m = channel_get_nextcxx . . $ pvpgn/bnetd/channel_get_next(181375335219f0cb).()) { |
| 990 | char const * name = conn_get_chatnamecxx . . $ pvpgn/bnetd/conn_get_chatname(c99dbccf638f5c6).(m); |
| 991 | char flg[5] = ""; |
| 992 | unsigned int flags; |
| 993 | |
| 994 | if (!name) |
| 995 | continue; |
| 996 | flags = conn_get_flagscxx . . $ pvpgn/bnetd/conn_get_flags(8bd2285a65940781).(m); |
| 997 | if (flags & MF_BLIZZARDcxx . . $ `src/common/bnet_protocol.h:2570:9`!) |
| 998 | stdcxx . . $ std/::strcat(flg, "@"); |
| 999 | else if ((flags & MF_BNETcxx . . $ `src/common/bnet_protocol.h:2576:9`!) || (flags & MF_GAVELcxx . . $ `src/common/bnet_protocol.h:2572:9`!)) |
| 1000 | stdcxx . . $ std/::strcat(flg, "%"); |
| 1001 | else if (flags & MF_VOICEcxx . . $ `src/common/bnet_protocol.h:2574:9`!) |
| 1002 | stdcxx . . $ std/::strcat(flg, "+"); |
| 1003 | if ((stdcxx . . $ std/::strlen(temp) + ((!first) ? (1) : (0)) + stdcxx . . $ std/::strlen(flg) + stdcxx . . $ std/::strlen(name) + 1) <= sizeof(temp)) { |
| 1004 | if (!first) stdcxx . . $ std/::strcat(temp, " "); |
| 1005 | if (conn_get_wolcxx . . $ pvpgn/bnetd/conn_get_wol(c4dfbc2386fe4fc3).(c) == 1) { |
| 1006 | char _temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1007 | t_gamecxx . . $ pvpgn/bnetd/t_game# * game = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(m); |
| 1008 | if ((first) && ((stdcxx . . $ std/::strcmp(ircname, "#Lob_38_0") == 0) || |
| 1009 | (stdcxx . . $ std/::strcmp(ircname, "#Lob_39_0") == 0) || |
| 1010 | (stdcxx . . $ std/::strcmp(ircname, "#Lob_40_0") == 0))) { |
| 1011 | |
| 1012 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(_temp, "@matchbot,0,0 "); |
| 1013 | stdcxx . . $ std/::strcat(temp, _temp); |
| 1014 | first = 0; |
| 1015 | |
| 1016 | } |
| 1017 | |
| 1018 | if ((game) && (game_get_channelcxx . . $ pvpgn/bnetd/game_get_channel(7d1a4b3311a97356).(game) == channel)) { |
| 1019 | if (game_get_ownercxx . . $ pvpgn/bnetd/game_get_owner(44263c0cd290cfb5).(game) == m) { |
| 1020 | /* PELISH: Only game owners will have OP flag (this prevent official OP to be normal player) */ |
| 1021 | stdcxx . . $ std/::strcat(temp, "@"); |
| 1022 | } |
| 1023 | } |
| 1024 | else { |
| 1025 | if ((flags & MF_BNETcxx . . $ `src/common/bnet_protocol.h:2576:9`!) || (flags & MF_GAVELcxx . . $ `src/common/bnet_protocol.h:2572:9`!)) |
| 1026 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(flg, "@"); /* PELISH: WOL does not understand to '%' char so we using '@' for TempOP too */ |
| 1027 | stdcxx . . $ std/::strcat(temp, flg); |
| 1028 | } |
| 1029 | if (tag_check_wolv2(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c))) { |
| 1030 | /* BATTLECLAN Support */ |
| 1031 | stdcxx . . $ std/::memset(_temp, 0, sizeof(_temp)); |
| 1032 | 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).(m)); |
| 1033 | unsigned int clanid = 0; |
| 1034 | |
| 1035 | if (clan) |
| 1036 | clanid = clan_get_clanidcxx . . $ pvpgn/bnetd/clan_get_clanid(1e16ca1cec114489).(clan); |
| 1037 | |
| 1038 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(_temp, "%s,%u,%u", name, clanid, conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(m)); |
| 1039 | stdcxx . . $ std/::strcat(temp, _temp); |
| 1040 | } |
| 1041 | else { |
| 1042 | stdcxx . . $ std/::strcat(temp, name); |
| 1043 | } |
| 1044 | } |
| 1045 | else { |
| 1046 | stdcxx . . $ std/::strcat(temp, flg); |
| 1047 | stdcxx . . $ std/::strcat(temp, name); |
| 1048 | } |
| 1049 | |
| 1050 | first = 0; |
| 1051 | } |
| 1052 | conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(m, name); |
| 1053 | } |
| 1054 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(c, RPL_NAMREPLYcxx . . $ `src/common/irc_protocol.h:257:9`!, temp); |
| 1055 | |
| 1056 | return 0; |
| 1057 | } |
| 1058 | |
| 1059 | extern int irc_send_rpl_namreplycxx . . $ pvpgn/bnetd/irc_send_rpl_namreply(9a6ccea331d9f4).(t_connection * c, t_channelcxx . . $ pvpgn/bnetd/t_channel# const * channel) |
| 1060 | { |
| 1061 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1062 | char const * ircname; |
| 1063 | |
| 1064 | if (!c) { |
| 1065 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 1066 | return -1; |
| 1067 | } |
| 1068 | |
| 1069 | if (channel) { |
| 1070 | ircname = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, c); |
| 1071 | if (!ircname) { |
| 1072 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "channel has NULL ircname"); |
| 1073 | return -1; |
| 1074 | } |
| 1075 | irc_send_rpl_namreply_internalcxx . . $ pvpgn/bnetd/irc_send_rpl_namreply_internal(9a6ccea331d9f4).(c, channel); |
| 1076 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "%.32s :End of NAMES list", ircname); |
| 1077 | } |
| 1078 | else { |
| 1079 | t_elem const * curr; |
| 1080 | LIST_TRAVERSE_CONSTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/list.h:95:9`!(channellist(), curr) |
| 1081 | { |
| 1082 | channel = (t_channelcxx . . $ pvpgn/bnetd/t_channel#*)elem_get_data(curr); |
| 1083 | irc_send_rpl_namreply_internalcxx . . $ pvpgn/bnetd/irc_send_rpl_namreply_internal(9a6ccea331d9f4).(c, channel); |
| 1084 | } |
| 1085 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "* :End of NAMES list"); |
| 1086 | } |
| 1087 | |
| 1088 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(c, RPL_ENDOFNAMEScxx . . $ `src/common/irc_protocol.h:266:9`!, temp); |
| 1089 | return 0; |
| 1090 | } |
| 1091 | |
| 1092 | static int irc_who_connectioncxx . . $ pvpgn/bnetd/irc_who_connection(91f93fcc9edcb042).(t_connection * dest, t_connection * c) |
| 1093 | { |
| 1094 | t_accountcxx . . $ pvpgn/bnetd/t_account# * a; |
| 1095 | char const * tempuser; |
| 1096 | char const * tempowner; |
| 1097 | char const * tempname; |
| 1098 | char const * tempip; |
| 1099 | char const * tempflags = "@"; /* FIXME: that's dumb */ |
| 1100 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1101 | char const * tempchannel; |
| 1102 | |
| 1103 | if (!dest) { |
| 1104 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL destination"); |
| 1105 | return -1; |
| 1106 | } |
| 1107 | if (!c) { |
| 1108 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 1109 | return -1; |
| 1110 | } |
| 1111 | a = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c); |
| 1112 | if (!(tempuser = clienttag_uint_to_str(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c)))) |
| 1113 | { |
| 1114 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL clienttag (tempuser)"); |
| 1115 | return -1; |
| 1116 | } |
| 1117 | if (!(tempowner = account_get_ll_ownercxx . . $ pvpgn/bnetd/account_get_ll_owner(4b37305d4a4563d0).(a))) |
| 1118 | { |
| 1119 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL ll_owner (tempowner)"); |
| 1120 | return -1; |
| 1121 | } |
| 1122 | if (!(tempname = conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c))) |
| 1123 | { |
| 1124 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL username (tempname)"); |
| 1125 | return -1; |
| 1126 | } |
| 1127 | if (!(tempip = addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(c)))) |
| 1128 | { |
| 1129 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL addr (tempip)"); |
| 1130 | return -1; |
| 1131 | } |
| 1132 | if (!(tempchannel = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(c), c))) |
| 1133 | { |
| 1134 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL channel (tempchannel)"); |
| 1135 | return -1; |
| 1136 | } |
| 1137 | if ((stdcxx . . $ std/::strlen(tempchannel) + 1 + stdcxx . . $ std/::strlen(tempuser) + 1 + stdcxx . . $ std/::strlen(tempip) + 1 + stdcxx . . $ std/::strlen(server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()) + 1 + stdcxx . . $ std/::strlen(tempname) + 1 + 1 + stdcxx . . $ std/::strlen(tempflags) + 4 + stdcxx . . $ std/::strlen(tempowner) + 1) > MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) { |
| 1138 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "WHO reply too long - skip"); |
| 1139 | return -1; |
| 1140 | } |
| 1141 | else |
| 1142 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "%s %s %s %s %s %c%s :0 %s", tempchannel, tempuser, tempip, server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).(), tempname, 'H', tempflags, tempowner); |
| 1143 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(dest, RPL_WHOREPLYcxx . . $ `src/common/irc_protocol.h:256:9`!, temp); |
| 1144 | return 0; |
| 1145 | } |
| 1146 | |
| 1147 | extern int irc_whocxx . . $ pvpgn/bnetd/irc_who(2e9022cda97b266d).(t_connection * c, char const * name) |
| 1148 | { |
| 1149 | /* FIXME: support wildcards! */ |
| 1150 | |
| 1151 | if (!c) { |
| 1152 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 1153 | return -1; |
| 1154 | } |
| 1155 | if (!name) { |
| 1156 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL name"); |
| 1157 | return -1; |
| 1158 | } |
| 1159 | if ((name[0] == '#') || (name[0] == '&') || (name[0] == '!')) { |
| 1160 | /* it's a channel */ |
| 1161 | t_connection * info; |
| 1162 | t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel; |
| 1163 | char const * ircname; |
| 1164 | |
| 1165 | ircname = irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(name); |
| 1166 | channel = channellist_find_channel_by_namecxx . . $ pvpgn/bnetd/channellist_find_channel_by_name(7177a8438ab16268).(ircname, 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`!); |
| 1167 | if (!channel) { |
| 1168 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1169 | |
| 1170 | if ((stdcxx . . $ std/::strlen(":No such channel") + 1 + stdcxx . . $ std/::strlen(name) + 1) <= MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) { |
| 1171 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":No such channel %s", name); |
| 1172 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(c, ERR_NOSUCHCHANNELcxx . . $ `src/common/irc_protocol.h:386:9`!, temp); |
| 1173 | } |
| 1174 | else { |
| 1175 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(c, ERR_NOSUCHCHANNELcxx . . $ `src/common/irc_protocol.h:386:9`!, ":No such channel"); |
| 1176 | } |
| 1177 | return 0; |
| 1178 | } |
| 1179 | for (info = channel_get_firstcxx . . $ pvpgn/bnetd/channel_get_first(77c4a1edc1ac6ba1).(channel); info; info = channel_get_nextcxx . . $ pvpgn/bnetd/channel_get_next(181375335219f0cb).()) { |
| 1180 | irc_who_connectioncxx . . $ pvpgn/bnetd/irc_who_connection(91f93fcc9edcb042).(c, info); |
| 1181 | } |
| 1182 | } |
| 1183 | else { |
| 1184 | /* it's just one user */ |
| 1185 | t_connection * info; |
| 1186 | |
| 1187 | if ((info = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(name))) |
| 1188 | return irc_who_connectioncxx . . $ pvpgn/bnetd/irc_who_connection(91f93fcc9edcb042).(c, info); |
| 1189 | } |
| 1190 | return 0; |
| 1191 | } |
| 1192 | |
| 1193 | extern int irc_send_motdcxx . . $ pvpgn/bnetd/irc_send_motd(c4dfbc2386fe4fc3).(t_connection * conn) |
| 1194 | { |
| 1195 | char const * tempname; |
| 1196 | char const * filename; |
| 1197 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# *fp; |
| 1198 | char * line, *formatted_line; |
| 1199 | char send_line[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1200 | char motd_failed = 0; |
| 1201 | bool first = true; |
| 1202 | |
| 1203 | if (!conn) { |
| 1204 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 1205 | return -1; |
| 1206 | } |
| 1207 | |
| 1208 | tempname = conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn); |
| 1209 | |
| 1210 | if ((filename = prefs_get_motdfilecxx . . $ pvpgn/bnetd/prefs_get_motdfile(33a1f659e94feb42).())) { |
| 1211 | if ((fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(filename, "r"))) { |
| 1212 | while ((line = file_get_linecxx . . $ pvpgn/file_get_line(e31226b218f63160).(fp))) { |
| 1213 | if ((formatted_line = message_format_linecxx . . $ pvpgn/bnetd/message_format_line(5f0435c1df2b4fd).(conn, line))) { |
| 1214 | formatted_line[0] = ' '; |
| 1215 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(send_line, ":-%s", formatted_line); |
| 1216 | if (first) { |
| 1217 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_MOTDSTARTcxx . . $ `src/common/irc_protocol.h:275:9`!, send_line); |
| 1218 | first = false; |
| 1219 | } |
| 1220 | else |
| 1221 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_MOTDcxx . . $ `src/common/irc_protocol.h:272:9`!, send_line); |
| 1222 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(formatted_line); |
| 1223 | } |
| 1224 | } |
| 1225 | |
| 1226 | file_get_linecxx . . $ pvpgn/file_get_line(e31226b218f63160).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); // clear file_get_line buffer |
| 1227 | stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp); |
| 1228 | } |
| 1229 | else |
| 1230 | motd_failed = 1; |
| 1231 | } |
| 1232 | else |
| 1233 | motd_failed = 1; |
| 1234 | |
| 1235 | if (motd_failed) { |
| 1236 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_MOTDSTARTcxx . . $ `src/common/irc_protocol.h:275:9`!, ":- Failed to load motd, sending default motd "); |
| 1237 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_MOTDcxx . . $ `src/common/irc_protocol.h:272:9`!, ":- ====================================================== "); |
| 1238 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_MOTDcxx . . $ `src/common/irc_protocol.h:272:9`!, ":- http://www.pvpgn.pro "); |
| 1239 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_MOTDcxx . . $ `src/common/irc_protocol.h:272:9`!, ":- ====================================================== "); |
| 1240 | } |
| 1241 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_ENDOFMOTDcxx . . $ `src/common/irc_protocol.h:276:9`!, ":End of /MOTD command"); |
| 1242 | return 0; |
| 1243 | } |
| 1244 | |
| 1245 | int irc_welcomecxx . . $ pvpgn/bnetd/irc_welcome(c4dfbc2386fe4fc3).(t_connection * conn){ |
| 1246 | if (conn_get_wolcxx . . $ pvpgn/bnetd/conn_get_wol(c4dfbc2386fe4fc3).(conn)) |
| 1247 | handle_wol_welcomecxx . . $ pvpgn/bnetd/handle_wol_welcome(c4dfbc2386fe4fc3).(conn); |
| 1248 | else |
| 1249 | handle_irc_welcomecxx . . $ pvpgn/bnetd/handle_irc_welcome(c4dfbc2386fe4fc3).(conn); |
| 1250 | |
| 1251 | return 0; |
| 1252 | } |
| 1253 | |
| 1254 | extern int _handle_nick_commandcxx . . $ pvpgn/bnetd/_handle_nick_command(93df5f0f7c1da4a4).(t_connection * conn, int numparams, char ** params, char * text) |
| 1255 | { |
| 1256 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1257 | /* FIXME: more strict param checking */ |
| 1258 | |
| 1259 | if ((conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn)) && |
| 1260 | (conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(conn) != conn_state_bot_password && |
| 1261 | conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(conn) != conn_state_bot_username)) { |
| 1262 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_RESTRICTEDcxx . . $ `src/common/irc_protocol.h:473:9`!, ":You can't change your nick after login"); |
| 1263 | } |
| 1264 | else { |
| 1265 | if ((params) && (params[0])) { |
| 1266 | if (conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn)){ |
| 1267 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), ":%s", params[0]); |
| 1268 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_nick, conn, temp); |
| 1269 | } |
| 1270 | conn_set_loggedusercxx . . $ pvpgn/bnetd/conn_set_loggeduser(2e9022cda97b266d).(conn, params[0]); |
| 1271 | } |
| 1272 | else if (text) { |
| 1273 | if (conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn)){ |
| 1274 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), ":%s", text); |
| 1275 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_nick, conn, temp); |
| 1276 | } |
| 1277 | conn_set_loggedusercxx . . $ pvpgn/bnetd/conn_set_loggeduser(2e9022cda97b266d).(conn, text); |
| 1278 | } |
| 1279 | else |
| 1280 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "NICK :Not enough parameters"); |
| 1281 | |
| 1282 | if ((conn_get_usercxx . . $ pvpgn/bnetd/conn_get_user(c99dbccf638f5c6).(conn)) && (conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn))) |
| 1283 | irc_welcomecxx . . $ pvpgn/bnetd/irc_welcome(c4dfbc2386fe4fc3).(conn); /* only send the welcome if we have USER and NICK */ |
| 1284 | } |
| 1285 | return 0; |
| 1286 | } |
| 1287 | |
| 1288 | extern int _handle_ping_commandcxx . . $ pvpgn/bnetd/_handle_ping_command(93df5f0f7c1da4a4).(t_connection * conn, int numparams, char ** params, char * text) |
| 1289 | { |
| 1290 | /* Dizzy: just ignore this because RFC says we should not reply client PINGs |
| 1291 | * NOTE: RFC2812 doesn't seem to be very expressive about this ... */ |
| 1292 | if (numparams) |
| 1293 | irc_send_pongcxx . . $ pvpgn/bnetd/irc_send_pong(2e9022cda97b266d).(conn, params[0]); |
| 1294 | else |
| 1295 | irc_send_pongcxx . . $ pvpgn/bnetd/irc_send_pong(2e9022cda97b266d).(conn, text); |
| 1296 | return 0; |
| 1297 | } |
| 1298 | |
| 1299 | extern int _handle_pong_commandcxx . . $ pvpgn/bnetd/_handle_pong_command(93df5f0f7c1da4a4).(t_connection * conn, int numparams, char ** params, char * text) |
| 1300 | { |
| 1301 | /* NOTE: RFC2812 doesn't seem to be very expressive about this ... */ |
| 1302 | if (conn_get_ircpingcxx . . $ pvpgn/bnetd/conn_get_ircping(8bd2285a65940781).(conn) == 0) { |
| 1303 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "[{}] PONG without PING", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(conn)); |
| 1304 | } |
| 1305 | else { |
| 1306 | unsigned int val = 0; |
| 1307 | char * sname; |
| 1308 | |
| 1309 | if (numparams >= 1) { |
| 1310 | val = stdcxx . . $ std/::strtoul(params[0], NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 10); |
| 1311 | sname = params[0]; |
| 1312 | } |
| 1313 | else if (text) { |
| 1314 | val = stdcxx . . $ std/::strtoul(text, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 10); |
| 1315 | sname = text; |
| 1316 | } |
| 1317 | else { |
| 1318 | val = 0; |
| 1319 | sname = 0; |
| 1320 | } |
| 1321 | |
| 1322 | if (conn_get_ircpingcxx . . $ pvpgn/bnetd/conn_get_ircping(8bd2285a65940781).(conn) != val) { |
| 1323 | if ((!(sname)) || (stdcxx . . $ std/::strcmp(sname, server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()) != 0)) { |
| 1324 | /* Actually the servername should not be always accepted but we aren't that pedantic :) */ |
| 1325 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "[{}] got bad PONG ({}!={} && {}!={})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(conn), val, conn_get_ircpingcxx . . $ pvpgn/bnetd/conn_get_ircping(8bd2285a65940781).(conn), sname, server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()); |
| 1326 | return -1; |
| 1327 | } |
| 1328 | } |
| 1329 | conn_set_latencycxx . . $ pvpgn/bnetd/conn_set_latency(d97ad1b62a895b69).(conn, get_tickscxx . . $ pvpgn/bnetd/get_ticks(db52760e79bf9054).() - conn_get_ircpingcxx . . $ pvpgn/bnetd/conn_get_ircping(8bd2285a65940781).(conn)); |
| 1330 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] latency is now {} ({}-{})", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(conn), get_tickscxx . . $ pvpgn/bnetd/get_ticks(db52760e79bf9054).() - conn_get_ircpingcxx . . $ pvpgn/bnetd/conn_get_ircping(8bd2285a65940781).(conn), get_tickscxx . . $ pvpgn/bnetd/get_ticks(db52760e79bf9054).(), conn_get_ircpingcxx . . $ pvpgn/bnetd/conn_get_ircping(8bd2285a65940781).(conn)); |
| 1331 | conn_set_ircpingcxx . . $ pvpgn/bnetd/conn_set_ircping(c14bb6458e7562a).(conn, 0); |
| 1332 | } |
| 1333 | return 0; |
| 1334 | } |
| 1335 | |
| 1336 | extern int _handle_join_commandcxx . . $ pvpgn/bnetd/_handle_join_command(93df5f0f7c1da4a4).(t_connection * conn, int numparams, char ** params, char * text) |
| 1337 | { |
| 1338 | if (numparams >= 1) { |
| 1339 | char ** e; |
| 1340 | |
| 1341 | /* According to RFC2812 - if channelname is "0" we need to PART all channels */ |
| 1342 | if (stdcxx . . $ std/::strcmp(params[0], "0") == 0) { |
| 1343 | conn_part_channelcxx . . $ pvpgn/bnetd/conn_part_channel(c4dfbc2386fe4fc3).(conn); |
| 1344 | return 0; |
| 1345 | } |
| 1346 | |
| 1347 | e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]); |
| 1348 | if ((e) && (e[0])) { |
| 1349 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1350 | char const * ircname = irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(e[0]); |
| 1351 | t_channelcxx . . $ pvpgn/bnetd/t_channel# * old_channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn); |
| 1352 | t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel; |
| 1353 | t_accountcxx . . $ pvpgn/bnetd/t_account# * acc = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn); |
| 1354 | |
| 1355 | if ((ircname) && (channel = channellist_find_channel_by_namecxx . . $ pvpgn/bnetd/channellist_find_channel_by_name(7177a8438ab16268).(ircname, 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`!))) { |
| 1356 | if (channel_check_banningcxx . . $ pvpgn/bnetd/channel_check_banning(af8c4400d4e536a9).(channel, conn)) { |
| 1357 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :You are banned from that channel.", e[0]); |
| 1358 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_BANNEDFROMCHANcxx . . $ `src/common/irc_protocol.h:456:9`!, temp); |
| 1359 | if (e) |
| 1360 | irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e); |
| 1361 | return 0; |
| 1362 | } |
| 1363 | |
| 1364 | if ((account_get_auth_admincxx . . $ pvpgn/bnetd/account_get_auth_admin(4b12bc5edcfaeac7).(acc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) != 1) && (account_get_auth_admincxx . . $ pvpgn/bnetd/account_get_auth_admin(4b12bc5edcfaeac7).(acc, ircname) != 1) && |
| 1365 | (account_get_auth_operatorcxx . . $ pvpgn/bnetd/account_get_auth_operator(4b12bc5edcfaeac7).(acc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) != 1) && (account_get_auth_operatorcxx . . $ pvpgn/bnetd/account_get_auth_operator(4b12bc5edcfaeac7).(acc, ircname) != 1) && |
| 1366 | (channel_get_maxcxx . . $ pvpgn/bnetd/channel_get_max(28c764f7c20ec9b2).(channel) != -1) && (channel_get_currcxx . . $ pvpgn/bnetd/channel_get_curr(28c764f7c20ec9b2).(channel) >= channel_get_maxcxx . . $ pvpgn/bnetd/channel_get_max(28c764f7c20ec9b2).(channel))) { |
| 1367 | |
| 1368 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :The channel is currently full.", e[0]); |
| 1369 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_CHANNELISFULLcxx . . $ `src/common/irc_protocol.h:453:9`!, temp); |
| 1370 | if (e) |
| 1371 | irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e); |
| 1372 | return 0; |
| 1373 | } |
| 1374 | } |
| 1375 | |
| 1376 | if ((!(ircname)) || (conn_set_channelcxx . . $ pvpgn/bnetd/conn_set_channel(2e9022cda97b266d).(conn, ircname) < 0)) { |
| 1377 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :JOIN failed", e[0]); |
| 1378 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHCHANNELcxx . . $ `src/common/irc_protocol.h:386:9`!, temp); /* Anything is still bad */ |
| 1379 | } |
| 1380 | } |
| 1381 | if (e) |
| 1382 | irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e); |
| 1383 | } |
| 1384 | else |
| 1385 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "JOIN :Not enough parameters"); |
| 1386 | return 0; |
| 1387 | } |
| 1388 | |
| 1389 | extern int irc_send_topiccxx . . $ pvpgn/bnetd/irc_send_topic(9a6ccea331d9f4).(t_connection * c, t_channelcxx . . $ pvpgn/bnetd/t_channel# const * channel) |
| 1390 | { |
| 1391 | class_topiccxx . . $ pvpgn/bnetd/class_topic# Topiccxx . . $ pvpgn/bnetd/class_topic#class_topic(49f6e7a06ebc5aa8).; |
| 1392 | stdcxx . . $ std/::stringcxx . . $ std/string# topicstr = Topic.getcxx . . $ pvpgn/bnetd/class_topic#get(265576c0e07c2ac8).(channel_get_namecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(channel)); |
| 1393 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1394 | |
| 1395 | if (topicstr.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() == false) { |
| 1396 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :%s", irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, c), topicstr.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 1397 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(c, RPL_TOPICcxx . . $ `src/common/irc_protocol.h:238:9`!, temp); |
| 1398 | } |
| 1399 | else { |
| 1400 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :", irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, c)); |
| 1401 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(c, RPL_TOPICcxx . . $ `src/common/irc_protocol.h:238:9`!, temp); |
| 1402 | /* PELISH: This is according to RFC2812 but brakes WOLv1/WOLv2 */ |
| 1403 | //snprintf(temp, sizeof(temp), "%s :No topic is set", irc_convert_channel(channel,c)); |
| 1404 | //irc_send(c, RPL_NOTOPIC, temp); |
| 1405 | } |
| 1406 | return 0; |
| 1407 | } |
| 1408 | |
| 1409 | extern int _handle_topic_commandcxx . . $ pvpgn/bnetd/_handle_topic_command(93df5f0f7c1da4a4).(t_connection * conn, int numparams, char ** params, char * text) |
| 1410 | { |
| 1411 | char ** e = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1412 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1413 | class_topiccxx . . $ pvpgn/bnetd/class_topic# Topiccxx . . $ pvpgn/bnetd/class_topic#class_topic(49f6e7a06ebc5aa8).; |
| 1414 | |
| 1415 | if (params && params[0]) |
| 1416 | { |
| 1417 | if (conn_get_wolcxx . . $ pvpgn/bnetd/conn_get_wol(c4dfbc2386fe4fc3).(conn) == 1) { |
| 1418 | t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn); |
| 1419 | if (channel) |
| 1420 | Topic.setcxx . . $ pvpgn/bnetd/class_topic#set(68710a89f2bd51b).(stdcxx . . $ std/::stringcxx . . $ std/string#(channel_get_namecxx . . $ pvpgn/bnetd/channel_get_name(7800017c14723985).(channel)), stdcxx . . $ std/::stringcxx . . $ std/string#(text), false); |
| 1421 | else { |
| 1422 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :You're not on that channel", params[0]); |
| 1423 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOTONCHANNELcxx . . $ `src/common/irc_protocol.h:425:9`!, temp); |
| 1424 | } |
| 1425 | } |
| 1426 | e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]); |
| 1427 | } |
| 1428 | if ((e) && (e[0])) |
| 1429 | { |
| 1430 | t_channelcxx . . $ pvpgn/bnetd/t_channel# *channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn); |
| 1431 | |
| 1432 | if (channel) { |
| 1433 | char const * ircname = irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(e[0]); |
| 1434 | |
| 1435 | if ((ircname) && (strcasecmp(channel_get_namecxx . . $ pvpgn/bnetd/channel_get_name(7800017c14723985).(channel), ircname) == 0)) { |
| 1436 | irc_send_topiccxx . . $ pvpgn/bnetd/irc_send_topic(9a6ccea331d9f4).(conn, channel); |
| 1437 | } |
| 1438 | else { |
| 1439 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :You're not on that channel", e[0]); |
| 1440 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOTONCHANNELcxx . . $ `src/common/irc_protocol.h:425:9`!, temp); |
| 1441 | } |
| 1442 | } |
| 1443 | else { |
| 1444 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :You're not on that channel", e[0]); |
| 1445 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOTONCHANNELcxx . . $ `src/common/irc_protocol.h:425:9`!, temp); |
| 1446 | } |
| 1447 | } |
| 1448 | else |
| 1449 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "TOPIC :Not enough parameters"); |
| 1450 | |
| 1451 | if (e) |
| 1452 | { |
| 1453 | irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e); |
| 1454 | } |
| 1455 | |
| 1456 | return 0; |
| 1457 | } |
| 1458 | |
| 1459 | extern int _handle_kick_commandcxx . . $ pvpgn/bnetd/_handle_kick_command(93df5f0f7c1da4a4).(t_connection * conn, int numparams, char ** params, char * text) |
| 1460 | { |
| 1461 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1462 | char ** e; |
| 1463 | /** |
| 1464 | * Heres the imput expected |
| 1465 | * KICK [channel] [kicked_user],[kicked_user2] |
| 1466 | * |
| 1467 | * Heres the output expected |
| 1468 | * :user!WWOL@hostname KICK [channel] [kicked_user] :[text] |
| 1469 | * |
| 1470 | * WOL in [text] sends Admin name |
| 1471 | */ |
| 1472 | |
| 1473 | if ((numparams != 2) || !(params[1])) { |
| 1474 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "KICK :Not enough parameters"); |
| 1475 | return 0; |
| 1476 | } |
| 1477 | |
| 1478 | if (e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[1])) |
| 1479 | { |
| 1480 | /* Make standart PvPGN KICK from RFC2812 KICK */ |
| 1481 | if (text) |
| 1482 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "/kick %s %s", e[0], text); |
| 1483 | else |
| 1484 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "/kick %s", e[0]); |
| 1485 | |
| 1486 | handle_commandcxx . . $ pvpgn/bnetd/handle_command(2e9022cda97b266d).(conn, temp); |
| 1487 | |
| 1488 | irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e); |
| 1489 | } |
| 1490 | return 0; |
| 1491 | } |
| 1492 | |
| 1493 | static int irc_send_banlistcxx . . $ pvpgn/bnetd/irc_send_banlist(681c2fcf151532c2).(t_connection * conn, t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel) |
| 1494 | { |
| 1495 | t_elem const * curr; |
| 1496 | char const * banned; |
| 1497 | char const * ircname = server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).(); |
| 1498 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1499 | |
| 1500 | if (!conn) { |
| 1501 | ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("got NULL conn"); |
| 1502 | return -1; |
| 1503 | } |
| 1504 | |
| 1505 | if (!channel) { |
| 1506 | ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("got NULL channel"); |
| 1507 | return -1; |
| 1508 | } |
| 1509 | |
| 1510 | LIST_TRAVERSE_CONSTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/list.h:95:9`!(channel_get_banlist(channel), curr) { |
| 1511 | banned = (char*)elem_get_data(curr); |
| 1512 | |
| 1513 | //FIXME: right now we lie about who have gives ban and also about bantime |
| 1514 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s %s!*@* %s 1208297879", irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, conn), banned, ircname); |
| 1515 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_BANLISTcxx . . $ `src/common/irc_protocol.h:267:9`!, temp); |
| 1516 | } |
| 1517 | return 0; |
| 1518 | } |
| 1519 | |
| 1520 | extern int _handle_mode_commandcxx . . $ pvpgn/bnetd/_handle_mode_command(93df5f0f7c1da4a4).(t_connection * conn, int numparams, char ** params, char * text) |
| 1521 | { |
| 1522 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 1523 | t_accountcxx . . $ pvpgn/bnetd/t_account# * acc = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(conn); |
| 1524 | |
| 1525 | stdcxx . . $ std/::memset(temp, 0, sizeof(temp)); |
| 1526 | |
| 1527 | if (numparams < 1) { |
| 1528 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "MODE :Not enough parameters"); |
| 1529 | return 0; |
| 1530 | } |
| 1531 | |
| 1532 | if (params[0][0] == '#') { |
| 1533 | /* Channel mode */ |
| 1534 | t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel; |
| 1535 | char const * ircname = irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(params[0]); |
| 1536 | |
| 1537 | /* FIXME: Supports more than one channel in MODE command */ |
| 1538 | if (!(channel = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn))) { |
| 1539 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :No such channel", params[0]); |
| 1540 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHCHANNELcxx . . $ `src/common/irc_protocol.h:386:9`!, temp); |
| 1541 | return 0; |
| 1542 | } |
| 1543 | |
| 1544 | if (numparams == 1) { |
| 1545 | /* FIXME: Send real CHANELMODE flags! */ |
| 1546 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s +tns", params[0]); |
| 1547 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_CHANNELMODEIScxx . . $ `src/common/irc_protocol.h:229:9`!, temp); |
| 1548 | return 0; |
| 1549 | } |
| 1550 | |
| 1551 | if (numparams == 2) { |
| 1552 | if (stdcxx . . $ std/::strcmp(params[1], "b") == 0) { |
| 1553 | irc_send_banlistcxx . . $ pvpgn/bnetd/irc_send_banlist(681c2fcf151532c2).(conn, channel); |
| 1554 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :End of channel ban list", params[0]); |
| 1555 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_ENDOFBANLISTcxx . . $ `src/common/irc_protocol.h:268:9`!, temp); |
| 1556 | return 0; |
| 1557 | } |
| 1558 | else { |
| 1559 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), ":%s is unknown mode char to me for %s", params[1], params[0]); |
| 1560 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_UNKNOWNMODEcxx . . $ `src/common/irc_protocol.h:454:9`!, temp); |
| 1561 | return 0; |
| 1562 | } |
| 1563 | } |
| 1564 | |
| 1565 | /* PELISH: Also tmpOP have setting modes alowed because all new channels have only tmpOP */ |
| 1566 | if ((channel_conn_is_tmpOPcxx . . $ pvpgn/bnetd/channel_conn_is_tmpOP(7159c29bb3f93f5f).(channel, conn) != 1) && |
| 1567 | (account_get_auth_admincxx . . $ pvpgn/bnetd/account_get_auth_admin(4b12bc5edcfaeac7).(acc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) != 1) && (account_get_auth_admincxx . . $ pvpgn/bnetd/account_get_auth_admin(4b12bc5edcfaeac7).(acc, ircname) != 1) && |
| 1568 | (account_get_auth_operatorcxx . . $ pvpgn/bnetd/account_get_auth_operator(4b12bc5edcfaeac7).(acc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) != 1) && (account_get_auth_operatorcxx . . $ pvpgn/bnetd/account_get_auth_operator(4b12bc5edcfaeac7).(acc, ircname) != 1)) { |
| 1569 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :You're not channel operator", params[0]); |
| 1570 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_CHANOPRIVSNEEDEDcxx . . $ `src/common/irc_protocol.h:468:9`!, temp); |
| 1571 | return 0; |
| 1572 | } |
| 1573 | |
| 1574 | if (stdcxx . . $ std/::strcmp(params[1], "+b") == 0) { |
| 1575 | channel_ban_usercxx . . $ pvpgn/bnetd/channel_ban_user(2cba118976651e77).(channel, params[2]); |
| 1576 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s %s %s!*@*", params[0], params[1], params[2]); |
| 1577 | channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_mode, conn, temp); |
| 1578 | } |
| 1579 | else if (stdcxx . . $ std/::strcmp(params[1], "-b") == 0) { |
| 1580 | channel_unban_usercxx . . $ pvpgn/bnetd/channel_unban_user(2cba118976651e77).(channel, params[2]); |
| 1581 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s %s %s!*@*", params[0], params[1], params[2]); |
| 1582 | channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_mode, conn, temp); |
| 1583 | } |
| 1584 | else if (stdcxx . . $ std/::strcmp(params[1], "+o") == 0) { |
| 1585 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "/op %s", params[2]); |
| 1586 | handle_commandcxx . . $ pvpgn/bnetd/handle_command(2e9022cda97b266d).(conn, temp); |
| 1587 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s %s %s", params[0], params[1], params[2]); |
| 1588 | channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_mode, conn, temp); |
| 1589 | } |
| 1590 | else if (stdcxx . . $ std/::strcmp(params[1], "-o") == 0) { |
| 1591 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "/deop %s", params[2]); |
| 1592 | handle_commandcxx . . $ pvpgn/bnetd/handle_command(2e9022cda97b266d).(conn, temp); |
| 1593 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s %s %s", params[0], params[1], params[2]); |
| 1594 | channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_mode, conn, temp); |
| 1595 | } |
| 1596 | else if (stdcxx . . $ std/::strcmp(params[1], "+v") == 0) { |
| 1597 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "/voice %s", params[2]); |
| 1598 | handle_commandcxx . . $ pvpgn/bnetd/handle_command(2e9022cda97b266d).(conn, temp); |
| 1599 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s %s %s", params[0], params[1], params[2]); |
| 1600 | channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_mode, conn, temp); |
| 1601 | } |
| 1602 | else if (stdcxx . . $ std/::strcmp(params[1], "-v") == 0) { |
| 1603 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "/devoice %s", params[2]); |
| 1604 | handle_commandcxx . . $ pvpgn/bnetd/handle_command(2e9022cda97b266d).(conn, temp); |
| 1605 | |
| 1606 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s %s %s", params[0], params[1], params[2]); |
| 1607 | channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_mode, conn, temp); |
| 1608 | } |
| 1609 | else if (stdcxx . . $ std/::strcmp(params[1], "+i") == 0) { |
| 1610 | /* FIXME: channel will be only for invited */ |
| 1611 | } |
| 1612 | else if (stdcxx . . $ std/::strcmp(params[1], "+l") == 0) { |
| 1613 | channel_set_maxcxx . . $ pvpgn/bnetd/channel_set_max(48cee1134ea01a3a).(channel, stdcxx . . $ std/::atoi(params[2])); |
| 1614 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s %s %s", params[0], params[1], params[2]); |
| 1615 | channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_mode, conn, temp); |
| 1616 | } |
| 1617 | else if (stdcxx . . $ std/::strcmp(params[1], "-l") == 0) { |
| 1618 | channel_set_maxcxx . . $ pvpgn/bnetd/channel_set_max(48cee1134ea01a3a).(channel, -1); |
| 1619 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s %s", params[0], params[1]); |
| 1620 | channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_mode, conn, temp); |
| 1621 | } |
| 1622 | else { |
| 1623 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), ":%s is unknown mode char to me for %s", params[1], params[0]); |
| 1624 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_UNKNOWNMODEcxx . . $ `src/common/irc_protocol.h:454:9`!, temp); |
| 1625 | } |
| 1626 | } |
| 1627 | else { |
| 1628 | /* User modes */ |
| 1629 | /* FIXME: Support user modes (away, invisible...) */ |
| 1630 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_UMODEUNKNOWNFLAGcxx . . $ `src/common/irc_protocol.h:493:9`!, ":Unknown MODE flag"); |
| 1631 | } |
| 1632 | return 0; |
| 1633 | } |
| 1634 | |
| 1635 | extern int _handle_time_commandcxx . . $ pvpgn/bnetd/_handle_time_command(93df5f0f7c1da4a4).(t_connection * conn, int numparams, char ** params, char * text) |
| 1636 | { |
| 1637 | char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.] = {}; // PELISH: According to RFC2812 |
| 1638 | stdcxx . . $ std/::time_tcxx . . $ std/time_t# now; |
| 1639 | char const * ircname = server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).(); |
| 1640 | |
| 1641 | if ((numparams >= 1) && (params[0])) |
| 1642 | { |
| 1643 | if (stdcxx . . $ std/::strcmp(params[0], ircname) == 0) |
| 1644 | { |
| 1645 | now = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1646 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :%" PRId64cxx . . $ `<external>/15933738808807975373/inttypes.h:57:10`!, ircname, static_cast<stdcxx . . $ std/::int64_tcxx . . $ std/int64_t#>(now)); |
| 1647 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_TIMEcxx . . $ `src/common/irc_protocol.h:294:9`!, temp); |
| 1648 | } |
| 1649 | else { |
| 1650 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :No such server", params[0]); |
| 1651 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHSERVERcxx . . $ `src/common/irc_protocol.h:385:9`!, temp); |
| 1652 | } |
| 1653 | } |
| 1654 | else { |
| 1655 | /* RPL_TIME contains time and name of this server */ |
| 1656 | now = stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1657 | stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof(temp), "%s :%" PRId64cxx . . $ `<external>/15933738808807975373/inttypes.h:57:10`!, ircname, static_cast<stdcxx . . $ std/::int64_tcxx . . $ std/int64_t#>(now)); |
| 1658 | irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_TIMEcxx . . $ `src/common/irc_protocol.h:294:9`!, temp); |
| 1659 | } |
| 1660 | return 0; |
| 1661 | } |
| 1662 | |
| 1663 | } |
| 1664 | |
| 1665 | } |