| 1 |
/* |
| 2 |
* Copyright (C) 2001 Marco Ziech ([email protected]) |
| 3 |
* Copyright (C) 2005 Bryan Biedenkapp ([email protected]) |
| 4 |
* Copyright (C) 2006,2007 Pelish ([email protected]) |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU General Public License |
| 8 |
* as published by the Free Software Foundation; either version 2 |
| 9 |
* of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 |
*/ |
| 20 |
|
| 21 |
#include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/ |
| 22 |
#include "handle_irc.h"cxx . . $ `<file>/src/bnetd/handle_irc.h`/ |
| 23 |
|
| 24 |
#include <cstring> |
| 25 |
#include <cctype> |
| 26 |
#include <cstdlib> |
| 27 |
|
| 28 |
#include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/ |
| 29 |
#include "common/irc_protocol.h"cxx . . $ `<file>/src/common/irc_protocol.h`/ |
| 30 |
#include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 31 |
#include "common/bnethash.h"cxx . . $ `<file>/src/common/bnethash.h`/ |
| 32 |
#include "common/tag.h"cxx . . $ `<file>/src/common/tag.h`/ |
| 33 |
#include "common/util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 34 |
#include "common/list.h"cxx . . $ `<file>/src/common/list.h`/ |
| 35 |
#include "common/addr.h"cxx . . $ `<file>/src/common/addr.h`/ |
| 36 |
#include "common/xstring.h"cxx . . $ `<file>/src/common/xstring.h`/ |
| 37 |
|
| 38 |
#include "prefs.h"cxx . . $ `<file>/src/bnetd/prefs.h`/ |
| 39 |
#include "command.h"cxx . . $ `<file>/src/bnetd/command.h`/ |
| 40 |
#include "irc.h"cxx . . $ `<file>/src/bnetd/irc.h`/ |
| 41 |
#include "account.h"cxx . . $ `<file>/src/bnetd/account.h`/ |
| 42 |
#include "account_wrap.h"cxx . . $ `<file>/src/bnetd/account_wrap.h`/ |
| 43 |
#include "command_groups.h"cxx . . $ `<file>/src/bnetd/command_groups.h`/ |
| 44 |
#include "channel.h"cxx . . $ `<file>/src/bnetd/channel.h`/ |
| 45 |
#include "message.h"cxx . . $ `<file>/src/bnetd/message.h`/ |
| 46 |
#include "tick.h"cxx . . $ `<file>/src/bnetd/tick.h`/ |
| 47 |
#include "topic.h"cxx . . $ `<file>/src/bnetd/topic.h`/ |
| 48 |
#include "server.h"cxx . . $ `<file>/src/bnetd/server.h`/ |
| 49 |
#include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| •50 |
#include "common/trans.h"cxx . . $ `<file>/src/common/trans.h`/ |
| 51 |
|
| 52 |
namespace pvpgncxx . . $ pvpgn/ |
| 53 |
{ |
| 54 |
|
| 55 |
namespace bnetdcxx . . $ pvpgn/bnetd/ |
| 56 |
{ |
| 57 |
|
| 58 |
typedef int(*t_irc_commandcxx . . $ pvpgn/bnetd/t_irc_command#)(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 59 |
|
| 60 |
typedef structcxx . . $ pvpgn/bnetd/$anonymous_type_2716c1fe7f940b1c_0# { |
| 61 |
const char * irc_command_stringcxx . . $ pvpgn/bnetd/$anonymous_type_2716c1fe7f940b1c_0#irc_command_string.; |
| 62 |
t_irc_commandcxx . . $ pvpgn/bnetd/t_irc_command# irc_command_handlercxx . . $ pvpgn/bnetd/$anonymous_type_2716c1fe7f940b1c_0#irc_command_handler.; |
| 63 |
} t_irc_command_table_rowcxx . . $ pvpgn/bnetd/t_irc_command_table_row#; |
| 64 |
|
| 65 |
static int _handle_user_commandcxx . . $ pvpgn/bnetd/_handle_user_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 66 |
static int _handle_pass_commandcxx . . $ pvpgn/bnetd/_handle_pass_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 67 |
static int _handle_privmsg_commandcxx . . $ pvpgn/bnetd/_handle_privmsg_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 68 |
static int _handle_notice_commandcxx . . $ pvpgn/bnetd/_handle_notice_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 69 |
static int _handle_quit_commandcxx . . $ pvpgn/bnetd/_handle_quit_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 70 |
|
| 71 |
static int _handle_who_commandcxx . . $ pvpgn/bnetd/_handle_who_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 72 |
static int _handle_list_commandcxx . . $ pvpgn/bnetd/_handle_list_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 73 |
static int _handle_names_commandcxx . . $ pvpgn/bnetd/_handle_names_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 74 |
static int _handle_userhost_commandcxx . . $ pvpgn/bnetd/_handle_userhost_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 75 |
static int _handle_ison_commandcxx . . $ pvpgn/bnetd/_handle_ison_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 76 |
static int _handle_whois_commandcxx . . $ pvpgn/bnetd/_handle_whois_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 77 |
static int _handle_part_commandcxx . . $ pvpgn/bnetd/_handle_part_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text); |
| 78 |
|
| 79 |
|
| 80 |
/* state "connected" handlers */ |
| 81 |
static const t_irc_command_table_rowcxx . . $ pvpgn/bnetd/t_irc_command_table_row# irc_con_command_tablecxx . . $ pvpgn/bnetd/irc_con_command_table.[] = |
| 82 |
{ |
| 83 |
{ "NICK", _handle_nick_commandcxx . . $ pvpgn/bnetd/_handle_nick_command(93df5f0f7c1da4a4). }, |
| 84 |
{ "USER", _handle_user_commandcxx . . $ pvpgn/bnetd/_handle_user_command(93df5f0f7c1da4a4). }, |
| 85 |
{ "PING", _handle_ping_commandcxx . . $ pvpgn/bnetd/_handle_ping_command(93df5f0f7c1da4a4). }, |
| 86 |
{ "PONG", _handle_pong_commandcxx . . $ pvpgn/bnetd/_handle_pong_command(93df5f0f7c1da4a4). }, |
| 87 |
{ "PASS", _handle_pass_commandcxx . . $ pvpgn/bnetd/_handle_pass_command(93df5f0f7c1da4a4). }, |
| 88 |
{ "PRIVMSG", _handle_privmsg_commandcxx . . $ pvpgn/bnetd/_handle_privmsg_command(93df5f0f7c1da4a4). }, |
| 89 |
{ "NOTICE", _handle_notice_commandcxx . . $ pvpgn/bnetd/_handle_notice_command(93df5f0f7c1da4a4). }, |
| 90 |
{ "QUIT", _handle_quit_commandcxx . . $ pvpgn/bnetd/_handle_quit_command(93df5f0f7c1da4a4). }, |
| 91 |
|
| 92 |
{ 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`! } |
| 93 |
}; |
| 94 |
|
| 95 |
/* state "logged in" handlers */ |
| 96 |
static const t_irc_command_table_rowcxx . . $ pvpgn/bnetd/t_irc_command_table_row# irc_log_command_tablecxx . . $ pvpgn/bnetd/irc_log_command_table.[] = |
| 97 |
{ |
| 98 |
{ "WHO", _handle_who_commandcxx . . $ pvpgn/bnetd/_handle_who_command(93df5f0f7c1da4a4). }, |
| 99 |
{ "LIST", _handle_list_commandcxx . . $ pvpgn/bnetd/_handle_list_command(93df5f0f7c1da4a4). }, |
| 100 |
{ "TOPIC", _handle_topic_commandcxx . . $ pvpgn/bnetd/_handle_topic_command(93df5f0f7c1da4a4). }, |
| 101 |
{ "JOIN", _handle_join_commandcxx . . $ pvpgn/bnetd/_handle_join_command(93df5f0f7c1da4a4). }, |
| 102 |
{ "NAMES", _handle_names_commandcxx . . $ pvpgn/bnetd/_handle_names_command(93df5f0f7c1da4a4). }, |
| 103 |
{ "MODE", _handle_mode_commandcxx . . $ pvpgn/bnetd/_handle_mode_command(93df5f0f7c1da4a4). }, |
| 104 |
{ "USERHOST", _handle_userhost_commandcxx . . $ pvpgn/bnetd/_handle_userhost_command(93df5f0f7c1da4a4). }, |
| 105 |
{ "ISON", _handle_ison_commandcxx . . $ pvpgn/bnetd/_handle_ison_command(93df5f0f7c1da4a4). }, |
| 106 |
{ "WHOIS", _handle_whois_commandcxx . . $ pvpgn/bnetd/_handle_whois_command(93df5f0f7c1da4a4). }, |
| 107 |
{ "PART", _handle_part_commandcxx . . $ pvpgn/bnetd/_handle_part_command(93df5f0f7c1da4a4). }, |
| 108 |
{ "KICK", _handle_kick_commandcxx . . $ pvpgn/bnetd/_handle_kick_command(93df5f0f7c1da4a4). }, |
| 109 |
{ "TIME", _handle_time_commandcxx . . $ pvpgn/bnetd/_handle_time_command(93df5f0f7c1da4a4). }, |
| 110 |
|
| 111 |
{ 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`! } |
| 112 |
}; |
| 113 |
|
| 114 |
|
| 115 |
extern int handle_irc_con_commandcxx . . $ pvpgn/bnetd/handle_irc_con_command(893e223956009815).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, char const * command, int numparams, char ** params, char * text) |
| 116 |
{ |
| 117 |
t_irc_command_table_rowcxx . . $ pvpgn/bnetd/t_irc_command_table_row# const *p; |
| 118 |
|
| 119 |
for (p = irc_con_command_tablecxx . . $ pvpgn/bnetd/irc_con_command_table.; p->irc_command_stringcxx . . $ pvpgn/bnetd/$anonymous_type_2716c1fe7f940b1c_0#irc_command_string. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; p++) { |
| 120 |
if (strcasecmp(command, p->irc_command_stringcxx . . $ pvpgn/bnetd/$anonymous_type_2716c1fe7f940b1c_0#irc_command_string.) == 0) { |
| 121 |
if (p->irc_command_handlercxx . . $ pvpgn/bnetd/$anonymous_type_2716c1fe7f940b1c_0#irc_command_handler. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 122 |
return ((p->irc_command_handlercxx . . $ pvpgn/bnetd/$anonymous_type_2716c1fe7f940b1c_0#irc_command_handler.)(conn, numparams, params, text)); |
| 123 |
} |
| 124 |
} |
| 125 |
return -1; |
| 126 |
} |
| 127 |
|
| 128 |
extern int handle_irc_log_commandcxx . . $ pvpgn/bnetd/handle_irc_log_command(893e223956009815).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, char const * command, int numparams, char ** params, char * text) |
| 129 |
{ |
| 130 |
t_irc_command_table_rowcxx . . $ pvpgn/bnetd/t_irc_command_table_row# const *p; |
| 131 |
|
| 132 |
for (p = irc_log_command_tablecxx . . $ pvpgn/bnetd/irc_log_command_table.; p->irc_command_stringcxx . . $ pvpgn/bnetd/$anonymous_type_2716c1fe7f940b1c_0#irc_command_string. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; p++) { |
| 133 |
if (strcasecmp(command, p->irc_command_stringcxx . . $ pvpgn/bnetd/$anonymous_type_2716c1fe7f940b1c_0#irc_command_string.) == 0) { |
| 134 |
if (p->irc_command_handlercxx . . $ pvpgn/bnetd/$anonymous_type_2716c1fe7f940b1c_0#irc_command_handler. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 135 |
return ((p->irc_command_handlercxx . . $ pvpgn/bnetd/$anonymous_type_2716c1fe7f940b1c_0#irc_command_handler.)(conn, numparams, params, text)); |
| 136 |
} |
| 137 |
} |
| 138 |
return -1; |
| 139 |
} |
| 140 |
|
| 141 |
extern int handle_irc_welcomecxx . . $ pvpgn/bnetd/handle_irc_welcome(c4dfbc2386fe4fc3).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn) |
| 142 |
{ |
| 143 |
char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 144 |
stdcxx . . $ std/::time_tcxx . . $ std/time_t# temptime; |
| 145 |
char const * tempname; |
| 146 |
char const * temptimestr; |
| 147 |
|
| 148 |
if (!conn) { |
| 149 |
eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 150 |
return -1; |
| 151 |
} |
| 152 |
|
| 153 |
tempname = conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn); |
| 154 |
|
| 155 |
if ((34 + stdcxx . . $ std/::strlen(tempname) + 1) <= MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) |
| 156 |
stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":Welcome to the %s IRC Network %s", prefs_get_irc_network_namecxx . . $ pvpgn/bnetd/prefs_get_irc_network_name(33a1f659e94feb42).(), tempname); |
| 157 |
else |
| 158 |
stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":Maximum length exceeded"); |
| 159 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_WELCOMEcxx . . $ `src/common/irc_protocol.h:45:9`!, temp); |
| 160 |
|
| 161 |
if ((14 + stdcxx . . $ std/::strlen(server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()) + 10 + stdcxx . . $ std/::strlen(PVPGN_SOFTWAREcxx . . $ `src/common/version.h:28:9`! " " PVPGN_VERSIONcxx . . $ `src/common/version.h:23:9`!) + 1) <= MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) |
| 162 |
stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":Your host is %s, running " PVPGN_SOFTWAREcxx . . $ `src/common/version.h:28:9`! " " PVPGN_VERSIONcxx . . $ `src/common/version.h:23:9`!, server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()); |
| 163 |
else |
| 164 |
stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":Maximum length exceeded"); |
| 165 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_YOURHOSTcxx . . $ `src/common/irc_protocol.h:46:9`!, temp); |
| 166 |
|
| 167 |
temptime = server_get_starttimecxx . . $ pvpgn/bnetd/server_get_starttime(db52760e79bf9054).(); /* FIXME: This should be build time */ |
| 168 |
temptimestr = stdcxx . . $ std/::ctimecxx . . $ std/ctime(7921606ce3c9bb9f).(&temptime); |
| 169 |
if ((25 + stdcxx . . $ std/::strlen(temptimestr) + 1) <= MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) |
| 170 |
stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":This server was created %s", temptimestr); /* FIXME: is ctime() portable? */ |
| 171 |
else |
| 172 |
stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":Maximum length exceeded"); |
| 173 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_CREATEDcxx . . $ `src/common/irc_protocol.h:47:9`!, temp); |
| 174 |
|
| 175 |
/* we don't give mode information on MYINFO we give it on ISUPPORT */ |
| 176 |
if ((stdcxx . . $ std/::strlen(server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()) + 7 + stdcxx . . $ std/::strlen(PVPGN_SOFTWAREcxx . . $ `src/common/version.h:28:9`! " " PVPGN_VERSIONcxx . . $ `src/common/version.h:23:9`!) + 9 + 1) <= MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) |
| 177 |
stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "%s " PVPGN_SOFTWAREcxx . . $ `src/common/version.h:28:9`! " " PVPGN_VERSIONcxx . . $ `src/common/version.h:23:9`! " - -", server_get_hostnamecxx . . $ pvpgn/bnetd/server_get_hostname(33a1f659e94feb42).()); |
| 178 |
else |
| 179 |
stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":Maximum length exceeded"); |
| 180 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_MYINFOcxx . . $ `src/common/irc_protocol.h:48:9`!, temp); |
| 181 |
|
| 182 |
stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "NICKLEN=%d TOPICLEN=%d CHANNELLEN=%d PREFIX=%s CHANTYPES=" CHANNEL_TYPEcxx . . $ `src/common/irc_protocol.h:37:9`! " NETWORK=%s IRCD=" PVPGN_SOFTWAREcxx . . $ `src/common/version.h:28:9`!, |
| 183 |
MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN., MAX_TOPIC_LENcxx . . $ MAX_TOPIC_LEN., MAX_CHANNELNAME_LENcxx . . $ MAX_CHANNELNAME_LEN., CHANNEL_PREFIXcxx . . $ `src/common/irc_protocol.h:36:9`!, prefs_get_irc_network_namecxx . . $ pvpgn/bnetd/prefs_get_irc_network_name(33a1f659e94feb42).()); |
| 184 |
|
| 185 |
if ((stdcxx . . $ std/::strlen(temp)) <= MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) |
| 186 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_ISUPPORTcxx . . $ `src/common/irc_protocol.h:49:9`!, temp); |
| 187 |
else { |
| 188 |
stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, ":Maximum length exceeded"); |
| 189 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_ISUPPORTcxx . . $ `src/common/irc_protocol.h:49:9`!, temp); |
| 190 |
} |
| 191 |
|
| 192 |
irc_send_motdcxx . . $ pvpgn/bnetd/irc_send_motd(c4dfbc2386fe4fc3).(conn); |
| 193 |
|
| 194 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_noticecxx . . $ pvpgn/bnetd/message_type_notice., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "This is an experimental service"); |
| 195 |
|
| 196 |
conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(conn, conn_state_bot_passwordcxx . . $ pvpgn/bnetd/conn_state_bot_password.); |
| 197 |
|
| 198 |
if (conn_get_ircpasscxx . . $ pvpgn/bnetd/conn_get_ircpass(c99dbccf638f5c6).(conn)) { |
| 199 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_noticecxx . . $ pvpgn/bnetd/message_type_notice., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "Trying to authenticate with PASS ..."); |
| 200 |
irc_authenticatecxx . . $ pvpgn/bnetd/irc_authenticate(2e9022cda97b266d).(conn, conn_get_ircpasscxx . . $ pvpgn/bnetd/conn_get_ircpass(c99dbccf638f5c6).(conn)); |
| 201 |
} |
| 202 |
else { |
| 203 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_noticecxx . . $ pvpgn/bnetd/message_type_notice., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "No PASS command received. Please identify yourself by /msg NICKSERV identify <password>."); |
| 204 |
} |
| 205 |
return 0; |
| 206 |
} |
| 207 |
|
| 208 |
static int _handle_user_commandcxx . . $ pvpgn/bnetd/_handle_user_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 209 |
{ |
| 210 |
/* RFC 2812 says: */ |
| 211 |
/* <user> <mode> <unused> :<realname>*/ |
| 212 |
/* ircII and X-Chat say: */ |
| 213 |
/* mz SHODAN localhost :Marco Ziech */ |
| 214 |
/* BitchX says: */ |
| 215 |
/* mz +iws mz :Marco Ziech */ |
| 216 |
/* Don't bother with, params 1 and 2 anymore they don't contain what they should. */ |
| 217 |
char * user = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 218 |
char * realname = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 219 |
|
| 220 |
if ((numparams >= 3) && (params[0]) && (text)) { |
| 221 |
user = params[0]; |
| 222 |
realname = text; |
| 223 |
|
| 224 |
if (conn_get_usercxx . . $ pvpgn/bnetd/conn_get_user(c99dbccf638f5c6).(conn)) { |
| 225 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_ALREADYREGISTREDcxx . . $ `src/common/irc_protocol.h:442:9`!, ":You are already registred"); |
| 226 |
} |
| 227 |
else { |
| 228 |
eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] got USER: user=\"{}\" realname=\"{}\"", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(conn), user, realname); |
| 229 |
conn_set_usercxx . . $ pvpgn/bnetd/conn_set_user(c8fb97a9af134824).(conn, user); |
| 230 |
conn_set_ownercxx . . $ pvpgn/bnetd/conn_set_owner(c8fb97a9af134824).(conn, realname); |
| 231 |
if (conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn)) |
| 232 |
handle_irc_welcomecxx . . $ pvpgn/bnetd/handle_irc_welcome(c4dfbc2386fe4fc3).(conn); /* only send the welcome if we have USER and NICK */ |
| 233 |
} |
| 234 |
} |
| 235 |
else { |
| 236 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "USER :Not enough parameters"); |
| 237 |
} |
| 238 |
return 0; |
| 239 |
} |
| 240 |
|
| 241 |
static int _handle_pass_commandcxx . . $ pvpgn/bnetd/_handle_pass_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 242 |
{ |
| 243 |
if ((!conn_get_ircpasscxx . . $ pvpgn/bnetd/conn_get_ircpass(c99dbccf638f5c6).(conn)) && (conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(conn) == conn_state_bot_usernamecxx . . $ pvpgn/bnetd/conn_state_bot_username.)) { |
| 244 |
t_hashcxx . . $ pvpgn/t_hash# h; |
| 245 |
|
| 246 |
if (numparams >= 1) { |
| 247 |
bnet_hashcxx . . $ pvpgn/bnet_hash(2a8392f275be648).(&h, stdcxx . . $ std/::strlen(params[0]), params[0]); |
| 248 |
conn_set_ircpasscxx . . $ pvpgn/bnetd/conn_set_ircpass(2e9022cda97b266d).(conn, hash_get_strcxx . . $ pvpgn/hash_get_str(d917ea147d03f908).(h)); |
| 249 |
} |
| 250 |
else |
| 251 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "PASS :Not enough parameters"); |
| 252 |
} |
| 253 |
else { |
| 254 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_ALREADYREGISTREDcxx . . $ `src/common/irc_protocol.h:442:9`!, ":Unauthorized command (already registered)"); |
| 255 |
} |
| 256 |
return 0; |
| 257 |
} |
| 258 |
|
| 259 |
static int _handle_privmsg_commandcxx . . $ pvpgn/bnetd/_handle_privmsg_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 260 |
{ |
| 261 |
if ((numparams >= 1) && (text)) |
| 262 |
{ |
| 263 |
int i; |
| 264 |
char ** e; |
| 265 |
|
| 266 |
e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]); |
| 267 |
/* FIXME: support wildcards! */ |
| 268 |
|
| 269 |
/* start amadeo: code was sent by some unkown fellow of pvpgn (maybe u wanna give us your name |
| 270 |
for any credits), it adds nick-registration, i changed some things here and there... */ |
| 271 |
for (i = 0; ((e) && (e[i])); i++) { |
| 272 |
if (strcasecmp(e[i], "NICKSERV") == 0) { |
| 273 |
char * pass; |
| 274 |
|
| 275 |
pass = stdcxx . . $ std/::strchr(text, ' '); |
| 276 |
if (pass) |
| 277 |
*pass++ = '\0'; |
| 278 |
|
| 279 |
if (strcasecmp(text, "identify") == 0) { |
| 280 |
switch (conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(conn)) { |
| 281 |
case conn_state_bot_passwordcxx . . $ pvpgn/bnetd/conn_state_bot_password.: |
| 282 |
{ |
| 283 |
if (pass) { |
| 284 |
t_hashcxx . . $ pvpgn/t_hash# h; |
| 285 |
|
| 286 |
strtolowercxx . . $ pvpgn/strtolower(7a9722d75b371431).(pass); |
| 287 |
bnet_hashcxx . . $ pvpgn/bnet_hash(2a8392f275be648).(&h, stdcxx . . $ std/::strlen(pass), pass); |
| 288 |
irc_authenticatecxx . . $ pvpgn/bnetd/irc_authenticate(2e9022cda97b266d).(conn, hash_get_strcxx . . $ pvpgn/hash_get_str(d917ea147d03f908).(h)); |
| 289 |
} |
| 290 |
else { |
| 291 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_noticecxx . . $ pvpgn/bnetd/message_type_notice., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "Syntax: IDENTIFY <password> (max 16 characters)"); |
| 292 |
} |
| 293 |
break; |
| 294 |
} |
| 295 |
case conn_state_loggedincxx . . $ pvpgn/bnetd/conn_state_loggedin.: |
| 296 |
{ |
| 297 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_noticecxx . . $ pvpgn/bnetd/message_type_notice., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, "You don't need to IDENTIFY"); |
| 298 |
break; |
| 299 |
} |
| 300 |
default:; |
| 301 |
eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_tracecxx . . $ pvpgn/eventlog_level_trace., __FUNCTION__, "got /msg in unexpected connection state ({})", conn_state_get_strcxx . . $ pvpgn/bnetd/conn_state_get_str(8beab9044c5fcbfa).(conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(conn))); |
| 302 |
} |
| 303 |
} |
| 304 |
else if (strcasecmp(text, "register") == 0) { |
| 305 |
t_hashcxx . . $ pvpgn/t_hash# passhash; |
| 306 |
t_accountcxx . . $ pvpgn/bnetd/t_account# * temp; |
| 307 |
char * username = (char *)conn_get_loggedusercxx . . $ pvpgn/bnetd/conn_get_loggeduser(c99dbccf638f5c6).(conn); |
| 308 |
|
| 309 |
if (account_check_namecxx . . $ pvpgn/bnetd/account_check_name(5c4306d8553b3696).(username)<0) { |
| 310 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., conn, "Account name contains invalid symbol!"); |
| 311 |
break; |
| 312 |
} |
| 313 |
|
| 314 |
if (!prefs_get_allow_new_accountscxx . . $ pvpgn/bnetd/prefs_get_allow_new_accounts(db52760e79bf9054).()){ |
| 315 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., conn, "Account creation is not allowed"); |
| 316 |
break; |
| 317 |
} |
| 318 |
|
| 319 |
if (!pass || pass[0] == '\0' || (stdcxx . . $ std/::strlen(pass)>16)) { |
| 320 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., conn, "Syntax: REGISTER <password> (max 16 characters)"); |
| 321 |
break; |
| 322 |
} |
| 323 |
|
| 324 |
strtolowercxx . . $ pvpgn/strtolower(7a9722d75b371431).(pass); |
| 325 |
|
| 326 |
bnet_hashcxx . . $ pvpgn/bnet_hash(2a8392f275be648).(&passhash, stdcxx . . $ std/::strlen(pass), pass); |
| 327 |
|
| 328 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., conn, stdcxx . . $ std/::stringcxx . . $ std/string#("Trying to create account \"" +cxx . . $ std/operator+(39ed2c165380f78e). stdcxx . . $ std/::stringcxx . . $ std/string#(username) +cxx . . $ std/operator+(900ec9581c410ad9). "\" with password \"" +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::stringcxx . . $ std/string#(pass) +cxx . . $ std/operator+(900ec9581c410ad9). "\"").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 329 |
|
| 330 |
temp = accountlist_create_accountcxx . . $ pvpgn/bnetd/accountlist_create_account(fdad4c38d937b650).(username, hash_get_strcxx . . $ pvpgn/hash_get_str(d917ea147d03f908).(passhash)); |
| 331 |
if (!temp) { |
| 332 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., conn, "Failed to create account!"); |
| 333 |
eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account \"{}\" not created (failed)", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(conn), username); |
| 334 |
conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(conn, username); |
| 335 |
break; |
| 336 |
} |
| 337 |
|
| 338 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(conn, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., conn, stdcxx . . $ std/::stringcxx . . $ std/string#("Account #" +cxx . . $ std/operator+(39ed2c165380f78e). stdcxx . . $ std/::to_stringcxx . . $ std/__cxx11/to_string(8c2ead51e4ae4fc6).(account_get_uidcxx . . $ `src/bnetd/account.h:91:9`!(temp)) +cxx . . $ std/operator+(900ec9581c410ad9). " created.")); |
| 339 |
eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "[{}] account \"{}\" created", conn_get_socketcxx . . $ pvpgn/bnetd/conn_get_socket(b5160de3e9803af4).(conn), username); |
| 340 |
conn_unget_chatnamecxx . . $ pvpgn/bnetd/conn_unget_chatname(6b2655da947c846f).(conn, username); |
| 341 |
} |
| 342 |
else { |
| 343 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_noticecxx . . $ pvpgn/bnetd/message_type_notice., nullptr, "Invalid arguments for NICKSERV"); |
| 344 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(conn, message_type_noticecxx . . $ pvpgn/bnetd/message_type_notice., nullptr, stdcxx . . $ std/::stringcxx . . $ std/string#(":Unrecognized command \"" +cxx . . $ std/operator+(39ed2c165380f78e). stdcxx . . $ std/::stringcxx . . $ std/string#(text) +cxx . . $ std/operator+(900ec9581c410ad9). "\"").c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 345 |
} |
| 346 |
} |
| 347 |
else if (conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(conn) == conn_state_loggedincxx . . $ pvpgn/bnetd/conn_state_loggedin.) { |
| 348 |
if (e[i][0] == '#') { |
| 349 |
/* channel message */ |
| 350 |
t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel; |
| 351 |
|
| 352 |
if ((channel = channellist_find_channel_by_namecxx . . $ pvpgn/bnetd/channellist_find_channel_by_name(7177a8438ab16268).(irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(e[i]), 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`!))) { |
| 353 |
if ((stdcxx . . $ std/::strlen(text) >= 9) && (stdcxx . . $ std/::strncmp(text, "\001ACTION ", 8) == 0) && (text[stdcxx . . $ std/::strlen(text) - 1] == '\001')) { |
| 354 |
/* at least "\001ACTION \001" */ |
| 355 |
/* it's a CTCP ACTION message */ |
| 356 |
text = text + 8; |
| 357 |
text[stdcxx . . $ std/::strlen(text) - 1] = '\0'; |
| 358 |
channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_emotecxx . . $ pvpgn/bnetd/message_type_emote., conn, text); |
| 359 |
} |
| 360 |
else { |
| 361 |
channel_message_logcxx . . $ pvpgn/bnetd/channel_message_log(3119144774c93d10).(channel, conn, 1, text); |
| 362 |
channel_message_sendcxx . . $ pvpgn/bnetd/channel_message_send(3c4bd88e6f433f89).(channel, message_type_talkcxx . . $ pvpgn/bnetd/message_type_talk., conn, text); |
| 363 |
} |
| 364 |
} |
| 365 |
else { |
| 366 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHCHANNELcxx . . $ `src/common/irc_protocol.h:386:9`!, ":No such channel"); |
| 367 |
} |
| 368 |
} |
| 369 |
else { |
| 370 |
/* whisper */ |
| 371 |
t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user; |
| 372 |
|
| 373 |
if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(e[i]))) |
| 374 |
{ |
| 375 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(user, message_type_whispercxx . . $ pvpgn/bnetd/message_type_whisper., conn, text); |
| 376 |
} |
| 377 |
else |
| 378 |
{ |
| 379 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHNICKcxx . . $ `src/common/irc_protocol.h:384:9`!, ":No such user"); |
| 380 |
} |
| 381 |
} |
| 382 |
} |
| 383 |
} |
| 384 |
if (e) |
| 385 |
irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e); |
| 386 |
} |
| 387 |
else |
| 388 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "PRIVMSG :Not enough parameters"); |
| 389 |
return 0; |
| 390 |
} |
| 391 |
|
| 392 |
static int _handle_notice_commandcxx . . $ pvpgn/bnetd/_handle_notice_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 393 |
{ |
| 394 |
if ((numparams >= 1) && (text)) { |
| 395 |
int i; |
| 396 |
char ** e; |
| 397 |
|
| 398 |
e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]); |
| 399 |
/* FIXME: support wildcards! */ |
| 400 |
|
| 401 |
for (i = 0; ((e) && (e[i])); i++) { |
| 402 |
if (conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(conn) == conn_state_loggedincxx . . $ pvpgn/bnetd/conn_state_loggedin.) { |
| 403 |
t_connectioncxx . . $ pvpgn/bnetd/t_connection# * user; |
| 404 |
|
| 405 |
if ((user = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(e[i]))) { |
| 406 |
message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(user, message_type_noticecxx . . $ pvpgn/bnetd/message_type_notice., conn, text); |
| 407 |
} |
| 408 |
else { |
| 409 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHNICKcxx . . $ `src/common/irc_protocol.h:384:9`!, ":No such user"); |
| 410 |
} |
| 411 |
} |
| 412 |
} |
| 413 |
if (e) |
| 414 |
irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e); |
| 415 |
} |
| 416 |
else |
| 417 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "NOTICE :Not enough parameters"); |
| 418 |
return 0; |
| 419 |
} |
| 420 |
|
| 421 |
static int _handle_who_commandcxx . . $ pvpgn/bnetd/_handle_who_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 422 |
{ |
| 423 |
if (numparams >= 1) { |
| 424 |
int i; |
| 425 |
char ** e; |
| 426 |
|
| 427 |
e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]); |
| 428 |
for (i = 0; ((e) && (e[i])); i++) { |
| 429 |
irc_whocxx . . $ pvpgn/bnetd/irc_who(2e9022cda97b266d).(conn, e[i]); |
| 430 |
} |
| 431 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_ENDOFWHOcxx . . $ `src/common/irc_protocol.h:218:9`!, ":End of WHO list"); /* RFC2812 only requires this to be sent if a list of names was given. Undernet seems to always send it, so do we :) */ |
| 432 |
if (e) |
| 433 |
irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e); |
| 434 |
} |
| 435 |
else |
| 436 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "WHO :Not enough parameters"); |
| 437 |
return 0; |
| 438 |
} |
| 439 |
|
| 440 |
static int _handle_list_commandcxx . . $ pvpgn/bnetd/_handle_list_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 441 |
{ |
| 442 |
stdcxx . . $ std/::stringcxx . . $ std/string# tmpcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).; |
| 443 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_LISTSTARTcxx . . $ `src/common/irc_protocol.h:226:9`!, "Channel :Users Names"); /* backward compatibility */ |
| 444 |
|
| 445 |
if (numparams == 0) |
| 446 |
{ |
| 447 |
t_elem const * curr; |
| 448 |
class_topiccxx . . $ pvpgn/bnetd/class_topic# Topiccxx . . $ pvpgn/bnetd/class_topic#class_topic(49f6e7a06ebc5aa8).; |
| 449 |
LIST_TRAVERSE_CONSTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/list.h:95:9`!(channellist(), curr) |
| 450 |
{ |
| 451 |
t_channelcxx . . $ pvpgn/bnetd/t_channel# const * channel = (const t_channelcxx . . $ pvpgn/bnetd/t_channel#*)elem_get_data(curr); |
| 452 |
char const * tempname = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, conn); |
| 453 |
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)); |
| 454 |
|
| 455 |
/* FIXME: AARON: only list channels like in /channels command */ |
| 456 |
tmp =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). stdcxx . . $ std/::stringcxx . . $ std/string#(tempname) +cxx . . $ std/operator+(900ec9581c410ad9). " " +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::to_stringcxx . . $ std/__cxx11/to_string(3d81e17e7a87eecc).(channel_get_lengthcxx . . $ pvpgn/bnetd/channel_get_length(28c764f7c20ec9b2).(channel)) +cxx . . $ std/operator+(900ec9581c410ad9). " :" +cxx . . $ std/operator+(db5dc2ea912c6495). topicstr; |
| 457 |
|
| 458 |
if (tmp.lengthcxx . . $ std/__cxx11/basic_string#length(6f8bd5c0ea8fb29a).() > MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) |
| 459 |
eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "LISTREPLY length exceeded"); |
| 460 |
|
| 461 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_LISTcxx . . $ `src/common/irc_protocol.h:227:9`!, tmp.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 462 |
} |
| 463 |
} |
| 464 |
else if (numparams >= 1) |
| 465 |
{ |
| 466 |
int i; |
| 467 |
char ** e; |
| 468 |
class_topiccxx . . $ pvpgn/bnetd/class_topic# Topiccxx . . $ pvpgn/bnetd/class_topic#class_topic(49f6e7a06ebc5aa8).; |
| 469 |
|
| 470 |
e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]); |
| 471 |
/* FIXME: support wildcards! */ |
| 472 |
|
| 473 |
for (i = 0; ((e) && (e[i])); i++) |
| 474 |
{ |
| 475 |
char const * verytemp = irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(e[i]); |
| 476 |
if (!verytemp) |
| 477 |
continue; /* something is wrong with the name ... */ |
| 478 |
|
| 479 |
t_channelcxx . . $ pvpgn/bnetd/t_channel# const * channel = channellist_find_channel_by_namecxx . . $ pvpgn/bnetd/channellist_find_channel_by_name(7177a8438ab16268).(verytemp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 480 |
if (!channel) |
| 481 |
continue; /* channel doesn't exist */ |
| 482 |
|
| 483 |
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)); |
| 484 |
char const * tempname = irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(channel, conn); |
| 485 |
|
| 486 |
tmp =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). stdcxx . . $ std/::stringcxx . . $ std/string#(tempname) +cxx . . $ std/operator+(900ec9581c410ad9). " " +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::to_stringcxx . . $ std/__cxx11/to_string(3d81e17e7a87eecc).(channel_get_lengthcxx . . $ pvpgn/bnetd/channel_get_length(28c764f7c20ec9b2).(channel)) +cxx . . $ std/operator+(900ec9581c410ad9). " :" +cxx . . $ std/operator+(db5dc2ea912c6495). topicstr; |
| 487 |
|
| 488 |
if (tmp.lengthcxx . . $ std/__cxx11/basic_string#length(6f8bd5c0ea8fb29a).() > MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.) |
| 489 |
eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "LISTREPLY length exceeded"); |
| 490 |
|
| 491 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_LISTcxx . . $ `src/common/irc_protocol.h:227:9`!, tmp.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 492 |
} |
| 493 |
|
| 494 |
if (e) |
| 495 |
irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e); |
| 496 |
} |
| 497 |
|
| 498 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_LISTENDcxx . . $ `src/common/irc_protocol.h:228:9`!, ":End of LIST command"); |
| 499 |
|
| 500 |
return 0; |
| 501 |
} |
| 502 |
|
| 503 |
static int _handle_names_commandcxx . . $ pvpgn/bnetd/_handle_names_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 504 |
{ |
| 505 |
t_channelcxx . . $ pvpgn/bnetd/t_channel# * channel; |
| 506 |
|
| 507 |
if (numparams >= 1) { |
| 508 |
char ** e; |
| 509 |
char const * verytemp; |
| 510 |
int i; |
| 511 |
|
| 512 |
e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]); |
| 513 |
for (i = 0; ((e) && (e[i])); i++) { |
| 514 |
verytemp = irc_convert_ircnamecxx . . $ pvpgn/bnetd/irc_convert_ircname(fb58d2e09a2a1ce6).(e[i]); |
| 515 |
|
| 516 |
if (!verytemp) |
| 517 |
continue; /* something is wrong with the name ... */ |
| 518 |
channel = channellist_find_channel_by_namecxx . . $ pvpgn/bnetd/channellist_find_channel_by_name(7177a8438ab16268).(verytemp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 519 |
if (!channel) |
| 520 |
continue; /* channel doesn't exist */ |
| 521 |
irc_send_rpl_namreplycxx . . $ pvpgn/bnetd/irc_send_rpl_namreply(9a6ccea331d9f4).(conn, channel); |
| 522 |
} |
| 523 |
if (e) |
| 524 |
irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e); |
| 525 |
} |
| 526 |
else if (numparams == 0) { |
| 527 |
irc_send_rpl_namreplycxx . . $ pvpgn/bnetd/irc_send_rpl_namreply(9a6ccea331d9f4).(conn, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 528 |
} |
| 529 |
return 0; |
| 530 |
} |
| 531 |
|
| 532 |
static int _handle_userhost_commandcxx . . $ pvpgn/bnetd/_handle_userhost_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 533 |
{ |
| 534 |
/* FIXME: Send RPL_USERHOST */ |
| 535 |
return 0; |
| 536 |
} |
| 537 |
|
| 538 |
static int _handle_quit_commandcxx . . $ pvpgn/bnetd/_handle_quit_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 539 |
{ |
| 540 |
conn_quit_channelcxx . . $ pvpgn/bnetd/conn_quit_channel(2e9022cda97b266d).(conn, text); |
| 541 |
conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(conn, conn_state_destroycxx . . $ pvpgn/bnetd/conn_state_destroy.); |
| 542 |
return 0; |
| 543 |
} |
| 544 |
|
| 545 |
static int _handle_ison_commandcxx . . $ pvpgn/bnetd/_handle_ison_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 546 |
{ |
| 547 |
char temp[MAX_IRC_MESSAGE_LENcxx . . $ MAX_IRC_MESSAGE_LEN.]; |
| 548 |
char first = 1; |
| 549 |
|
| 550 |
if (numparams >= 1) |
| 551 |
{ |
| 552 |
int i; |
| 553 |
|
| 554 |
temp[0] = '\0'; |
| 555 |
for (i = 0; (i < numparams && (params) && (params[i])); i++) |
| 556 |
{ |
| 557 |
if (connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(params[i])) |
| 558 |
{ |
| 559 |
stdcxx . . $ std/::snprintfcxx . . $ std/snprintf(416d90c494a2998e).(temp, sizeof temp, "%s%s", first ? ":" : " ", params[i]); |
| 560 |
first = 0; |
| 561 |
} |
| 562 |
} |
| 563 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_ISONcxx . . $ `src/common/irc_protocol.h:196:9`!, temp); |
| 564 |
} |
| 565 |
else |
| 566 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "ISON :Not enough parameters"); |
| 567 |
return 0; |
| 568 |
} |
| 569 |
|
| 570 |
static int _handle_whois_commandcxx . . $ pvpgn/bnetd/_handle_whois_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 571 |
{ |
| 572 |
stdcxx . . $ std/::stringcxx . . $ std/string# tmpcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).; |
| 573 |
|
| 574 |
if (numparams >= 1) |
| 575 |
{ |
| 576 |
int i; |
| 577 |
char ** e = irc_get_listelemscxx . . $ pvpgn/bnetd/irc_get_listelems(c5fc499caf24bdd3).(params[0]); |
| 578 |
t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c; |
| 579 |
t_channelcxx . . $ pvpgn/bnetd/t_channel# * chan; |
| 580 |
|
| 581 |
for (i = 0; ((e) && (e[i])); i++) |
| 582 |
{ |
| 583 |
if ((c = connlist_find_connection_by_accountnamecxx . . $ pvpgn/bnetd/connlist_find_connection_by_accountname(2f6d5fbe0174f787).(e[i]))) |
| 584 |
{ |
| 585 |
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).(conn)) & command_get_groupcxx . . $ pvpgn/bnetd/command_get_group(c61c63047ce273de).("/admin-addr"))) |
| 586 |
tmp =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). stdcxx . . $ std/::stringcxx . . $ std/string#(e[i]) +cxx . . $ std/operator+(900ec9581c410ad9). " " +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::stringcxx . . $ std/string#(clienttag_uint_to_str(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c))) +cxx . . $ std/operator+(900ec9581c410ad9). " hidden * :PvPGN user"; |
| 587 |
else |
| 588 |
tmp =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). stdcxx . . $ std/::stringcxx . . $ std/string#(e[i]) +cxx . . $ std/operator+(900ec9581c410ad9). " " +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::stringcxx . . $ std/string#(clienttag_uint_to_str(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(c))) +cxx . . $ std/operator+(900ec9581c410ad9). " " +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::stringcxx . . $ std/string#(addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(c))) +cxx . . $ std/operator+(900ec9581c410ad9). " * :PvPGN user"; |
| 589 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_WHOISUSERcxx . . $ `src/common/irc_protocol.h:214:9`!, tmp.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 590 |
|
| 591 |
if ((chan = conn_get_channelcxx . . $ pvpgn/bnetd/conn_get_channel(17dd609cd0747384).(conn))) |
| 592 |
{ |
| 593 |
stdcxx . . $ std/::stringcxx . . $ std/string# flgcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).; |
| 594 |
auto flags = conn_get_flagscxx . . $ pvpgn/bnetd/conn_get_flags(8bd2285a65940781).(c); |
| 595 |
|
| 596 |
if (flags & MF_BLIZZARDcxx . . $ `src/common/bnet_protocol.h:2570:9`!) |
| 597 |
flg =cxx . . $ std/__cxx11/basic_string#`operator=`(63cc1ae870623930). '@'; |
| 598 |
else if ((flags & MF_BNETcxx . . $ `src/common/bnet_protocol.h:2576:9`!) || (flags & MF_GAVELcxx . . $ `src/common/bnet_protocol.h:2572:9`!)) |
| 599 |
flg =cxx . . $ std/__cxx11/basic_string#`operator=`(63cc1ae870623930). '%'; |
| 600 |
else if (flags & MF_VOICEcxx . . $ `src/common/bnet_protocol.h:2574:9`!) |
| 601 |
flg =cxx . . $ std/__cxx11/basic_string#`operator=`(63cc1ae870623930). '+'; |
| 602 |
else |
| 603 |
flg =cxx . . $ std/__cxx11/basic_string#`operator=`(63cc1ae870623930). ' '; |
| 604 |
|
| 605 |
tmp =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). stdcxx . . $ std/::stringcxx . . $ std/string#(e[i]) +cxx . . $ std/operator+(900ec9581c410ad9). " :" +cxx . . $ std/operator+(db5dc2ea912c6495). flg +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::stringcxx . . $ std/string#(irc_convert_channelcxx . . $ pvpgn/bnetd/irc_convert_channel(55b6d6ef75821cab).(chan, conn)); |
| 606 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_WHOISCHANNELScxx . . $ `src/common/irc_protocol.h:223:9`!, tmp.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 607 |
} |
| 608 |
|
| 609 |
} |
| 610 |
else |
| 611 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NOSUCHNICKcxx . . $ `src/common/irc_protocol.h:384:9`!, ":No such nick/channel"); |
| 612 |
|
| 613 |
} |
| 614 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, RPL_ENDOFWHOIScxx . . $ `src/common/irc_protocol.h:221:9`!, ":End of /WHOIS list"); |
| 615 |
if (e) |
| 616 |
irc_unget_listelemscxx . . $ pvpgn/bnetd/irc_unget_listelems(b90f8021b121110e).(e); |
| 617 |
} |
| 618 |
else |
| 619 |
irc_sendcxx . . $ pvpgn/bnetd/irc_send(2e21047ccae6acf).(conn, ERR_NEEDMOREPARAMScxx . . $ `src/common/irc_protocol.h:441:9`!, "WHOIS :Not enough parameters"); |
| 620 |
return 0; |
| 621 |
} |
| 622 |
|
| 623 |
static int _handle_part_commandcxx . . $ pvpgn/bnetd/_handle_part_command(93df5f0f7c1da4a4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * conn, int numparams, char ** params, char * text) |
| 624 |
{ |
| 625 |
conn_part_channelcxx . . $ pvpgn/bnetd/conn_part_channel(c4dfbc2386fe4fc3).(conn); |
| 626 |
return 0; |
| 627 |
} |
| 628 |
|
| 629 |
} |
| 630 |
|
| 631 |
} |