few WOL bug fixes (server admins are now able to join a game, client parts channel also if sends only QUIT command), big WOL cleanup - using native PvPGN functions instead of WOL hacks (which are no longer needed when WOL games uses t_game structure)

This commit is contained in:
Pelish 2010-02-19 23:36:03 +00:00
parent 786cc29fa9
commit 700ba62993
7 changed files with 54 additions and 267 deletions

View file

@ -224,11 +224,7 @@ extern t_channel * channel_create(char const * fullname, char const * shortname,
channel->log = NULL;
}
channel->gameOwner = NULL;
channel->gameOwnerIP = 0;
channel->gameType = 0;
channel->gameTournament = 0;
channel->gameExtension = NULL;
if (channellist)
@ -274,9 +270,6 @@ extern int channel_destroy(t_channel * channel, t_elem ** curr)
if (channel->gameExtension)
xfree(channel->gameExtension);
if (channel->gameOwner)
xfree(channel->gameOwner);
LIST_TRAVERSE(channel->banlist,ban)
{
char const * banned;
@ -476,15 +469,15 @@ extern int channel_add_connection(t_channel * channel, t_connection * connection
{
message_send_text(connection,message_type_adduser,user,NULL);
/* In WOL gamechannels we send JOINGAME ack explicitely to self */
if (conn_wol_get_ingame(connection)==0)
if (!conn_get_game(connection))
message_send_text(user,message_type_join,connection,NULL);
}
else {
if (conn_wol_get_ingame(connection)==0)
if (!conn_get_game(connection))
message_send_text(connection,message_type_join,connection,NULL);
}
if (conn_is_irc_variant(connection) && (!conn_wol_get_ingame(connection))) {
if (conn_is_irc_variant(connection) && (!conn_get_game(connection))) {
channel_set_userflags(connection);
message_send_text(connection,message_type_topic,connection,NULL);
message_send_text(connection,message_type_namreply,connection,NULL);
@ -1633,63 +1626,6 @@ extern int channel_set_min(t_channel * channel, int minmembers)
return 1;
}
extern char const * channel_wol_get_game_owner(t_channel const * channel)
{
if (!channel)
{
ERROR0("got NULL channel");
return 0;
}
return channel->gameOwner;
}
extern int channel_wol_set_game_owner(t_channel * channel, char const * gameOwner)
{
if (!channel)
{
ERROR0("got NULL channel");
return -1;
}
if (!gameOwner)
{
ERROR0("got NULL gameOwner");
return -1;
}
if (channel->gameOwner)
xfree(channel->gameOwner);
channel->gameOwner = xstrdup(gameOwner);
return 0;
}
extern int channel_wol_get_game_ownerip(t_channel const * channel)
{
if (!channel)
{
ERROR0("got NULL channel");
return -1;
}
return channel->gameOwnerIP;
}
extern int channel_wol_set_game_ownerip(t_channel * channel, int gameOwnerIP)
{
if (!channel)
{
ERROR0("got NULL channel");
return -1;
}
if (gameOwnerIP)
channel->gameOwnerIP = gameOwnerIP;
return 0;
}
extern int channel_wol_get_game_type(t_channel const * channel)
{
if (!channel)
@ -1715,31 +1651,6 @@ extern int channel_wol_set_game_type(t_channel * channel, int gameType)
return 0;
}
extern int channel_wol_get_game_tournament(t_channel const * channel)
{
if (!channel)
{
ERROR0("got NULL channel");
return -1;
}
return channel->gameTournament;
}
extern int channel_wol_set_game_tournament(t_channel * channel, int gameTournament)
{
if (!channel)
{
ERROR0("got NULL channel");
return -1;
}
if (gameTournament)
channel->gameTournament = gameTournament;
return 0;
}
extern char const * channel_wol_get_game_extension(t_channel const * channel)
{
if (!channel)

View file

@ -98,11 +98,8 @@ typedef struct channel
* Westwood Online Extensions
*/
int minmembers;
char * gameOwner;
int gameOwnerIP;
int gameType;
int gameTournament;
char * gameExtension;
}
#endif
@ -181,18 +178,9 @@ extern int channellist_get_length(void);
extern int channel_get_min(t_channel const * channel);
extern int channel_set_min(t_channel * channel, int minmembers);
extern char const * channel_wol_get_game_owner(t_channel const * channel);
extern int channel_wol_set_game_owner(t_channel * channel, char const * gameOwner);
extern int channel_wol_get_game_ownerip(t_channel const * channel);
extern int channel_wol_set_game_ownerip(t_channel * channel, int gameOwnerIP);
extern int channel_wol_get_game_type(t_channel const * channel);
extern int channel_wol_set_game_type(t_channel * channel, int gameType);
extern int channel_wol_get_game_tournament(t_channel const * channel);
extern int channel_wol_set_game_tournament(t_channel * channel, int tournament);
extern char const * channel_wol_get_game_extension(t_channel const * channel);
extern int channel_wol_set_game_extension(t_channel * channel, char const * gameExtension);

View file

@ -469,8 +469,8 @@ extern t_connection * conn_create(int tsock, int usock, unsigned int real_local_
temp->protocol.wol.ingame = 0;
temp->protocol.wol.codepage = 0;
temp->protocol.wol.pageme = 33;
temp->protocol.wol.findme = 17;
temp->protocol.wol.pageme = true;
temp->protocol.wol.findme = true;
temp->protocol.wol.apgar = NULL;
temp->protocol.wol.anongame_player = NULL;
@ -4003,28 +4003,6 @@ extern int conn_get_wol(t_connection * c)
return 0;
}
extern void conn_wol_set_ingame(t_connection * c, int ingame)
{
if (!c)
{
eventlog(eventlog_level_error,__FUNCTION__,"get NULL conn");
return;
}
c->protocol.wol.ingame = ingame;
}
extern int conn_wol_get_ingame(t_connection * c)
{
if (!c)
{
eventlog(eventlog_level_error,__FUNCTION__,"get NULL conn");
return -1;
}
return c->protocol.wol.ingame;
}
extern void conn_wol_set_apgar(t_connection * c, char const * apgar)
{
if (!c)
@ -4076,7 +4054,7 @@ extern int conn_wol_get_codepage(t_connection * c)
return c->protocol.wol.codepage;
}
extern void conn_wol_set_findme(t_connection * c, int findme)
extern void conn_wol_set_findme(t_connection * c, bool findme)
{
if (!c)
{
@ -4087,18 +4065,18 @@ extern void conn_wol_set_findme(t_connection * c, int findme)
c->protocol.wol.findme = findme;
}
extern int conn_wol_get_findme(t_connection * c)
extern bool conn_wol_get_findme(t_connection * c)
{
if (!c)
{
eventlog(eventlog_level_error,__FUNCTION__,"got NULL conn");
return 0;
return false;
}
return c->protocol.wol.findme;
}
extern void conn_wol_set_pageme(t_connection * c, int pageme)
extern void conn_wol_set_pageme(t_connection * c, bool pageme)
{
if (!c)
{
@ -4109,12 +4087,12 @@ extern void conn_wol_set_pageme(t_connection * c, int pageme)
c->protocol.wol.pageme = pageme;
}
extern int conn_wol_get_pageme(t_connection * c)
extern bool conn_wol_get_pageme(t_connection * c)
{
if (!c)
{
eventlog(eventlog_level_error,__FUNCTION__,"got NULL conn");
return 0;
return false;
}
return c->protocol.wol.pageme;

View file

@ -454,16 +454,14 @@ extern int conn_is_irc_variant(t_connection * c);
/* Westwood Online Extensions */
extern int conn_get_wol(t_connection * c);
extern void conn_wol_set_ingame(t_connection * c, int wol_ingame);
extern int conn_wol_get_ingame(t_connection * c);
extern void conn_wol_set_apgar(t_connection * c, char const * apgar);
extern char const * conn_wol_get_apgar(t_connection * c);
extern void conn_wol_set_codepage(t_connection * c, int codepage);
extern int conn_wol_get_codepage(t_connection * c);
extern void conn_wol_set_findme(t_connection * c, int findme);
extern int conn_wol_get_findme(t_connection * c);
extern void conn_wol_set_pageme(t_connection * c, int pageme);
extern int conn_wol_get_pageme(t_connection * c);
extern void conn_wol_set_findme(t_connection * c, bool findme);
extern bool conn_wol_get_findme(t_connection * c);
extern void conn_wol_set_pageme(t_connection * c, bool pageme);
extern bool conn_wol_get_pageme(t_connection * c);
extern void conn_wol_set_anongame_player(t_connection * c, t_anongame_wol_player * anongame_player);
extern t_anongame_wol_player * conn_wol_get_anongame_player(t_connection * c);

View file

@ -97,7 +97,7 @@ static int handle_irc_common_set_class(t_connection * conn, char const * command
return -1;
}
else {
if (std::strcmp(command, "verchk") == 0) {
if (strcasecmp(command, "VERCHK") == 0) {
DEBUG0("Got WSERV packet");
if (std::strcmp(prefs_get_wolv2_addrs(),"") != 0)
conn_set_class(conn,conn_class_wserv);
@ -105,7 +105,7 @@ static int handle_irc_common_set_class(t_connection * conn, char const * command
conn_set_state(conn,conn_state_destroy);
return 0;
}
else if ((std::strcmp(command, "CVERS") == 0) || (std::strcmp(command, "cvers") == 0)) {
else if (strcasecmp(command, "CVERS") == 0) {
DEBUG0("Got WOL packet");
/* FIXME: We can check it not by address but check if client is supported by tag_check_in_list() */
if ((std::strcmp(prefs_get_wolv1_addrs(),"") != 0) || (std::strcmp(prefs_get_wolv2_addrs(),"") != 0))
@ -114,9 +114,9 @@ static int handle_irc_common_set_class(t_connection * conn, char const * command
conn_set_state(conn,conn_state_destroy);
return 0;
}
else if ((std::strcmp(command, "LISTSEARCH") == 0) ||
(std::strcmp(command, "RUNGSEARCH") == 0) ||
(std::strcmp(command, "HIGHSCORE") == 0)) {
else if ((strcasecmp(command, "LISTSEARCH") == 0) ||
(strcasecmp(command, "RUNGSEARCH") == 0) ||
(strcasecmp(command, "HIGHSCORE") == 0)) {
DEBUG0("Got WOL Ladder packet");
if (std::strcmp(prefs_get_wolv2_addrs(),"") != 0)
conn_set_class(conn,conn_class_wladder); /* is handled in handle_wol.* now */
@ -124,8 +124,8 @@ static int handle_irc_common_set_class(t_connection * conn, char const * command
conn_set_state(conn,conn_state_destroy);
return 0;
}
else if ((std::strcmp(command, "CRYPT") == 0) ||
(std::strcmp(command, "LOGIN") == 0)) {
else if ((strcasecmp(command, "CRYPT") == 0) ||
(strcasecmp(command, "LOGIN") == 0)) {
DEBUG0("Got GameSpy packet");
if (std::strcmp(prefs_get_irc_addrs(),"") != 0)
conn_set_class(conn,conn_class_irc);

View file

@ -454,7 +454,6 @@ static int _handle_privmsg_command(t_connection * conn, int numparams, char ** p
struct gamelist_data {
unsigned tcount, counter;
unsigned wol_ver; /* Version of WOL protocol (1,2) */
t_connection *conn;
};
@ -529,9 +528,9 @@ static int append_game_info(t_game* game, void* vdata)
snprintf(temp_a, sizeof(temp_a), "%u ", channel_wol_get_game_type(gamechannel)); /* game type */
std::strcat(temp,temp_a);
snprintf(temp_a, sizeof(temp_a), "%u ", channel_wol_get_game_tournament(gamechannel)); /* tournament */
std::strcat(temp,temp_a);
snprintf(temp_a, sizeof(temp_a), "%u ", (game_get_type(game) == game_type_ladder) ? 1 : 0); /* tournament */
std::strcat(temp,temp_a);
snprintf(temp_a, sizeof(temp_a), "%s ", channel_wol_get_game_extension(gamechannel)); /* game extension */
std::strcat(temp,temp_a);
@ -549,11 +548,6 @@ static int append_game_info(t_game* game, void* vdata)
snprintf(temp_a, sizeof(temp_a), "%s", topic); /* topic */
std::strcat(temp,temp_a);
}
// snprintf(temp, sizeof(temp), "%s %u 2 1 0 0 %u 128::",gamename,game_get_ref(game),conn_get_addr(game_get_owner(game)));
// snprintf(temp, sizeof(temp), "%s %u 0 %u %u %s %u 128::",gamename,
// channel_get_length(channel),channel_wol_get_game_type(channel),channel_wol_get_game_tournament(channel),
// channel_wol_get_game_extension(channel),channel_wol_get_game_ownerip(channel));
data->counter++;
irc_send(data->conn,RPL_GAME_CHANNEL,temp);
@ -568,7 +562,7 @@ static int _handle_list_command(t_connection * conn, int numparams, char ** para
irc_send(conn,RPL_LISTSTART,"Channel :Users Names"); /* backward compatibility */
if ((numparams == 0) || ((params[0]) && (params[1]) && (std::strcmp(params[0], params[1]) != 0))) {
if ((numparams == 0) || ((numparams == 2) && (params[0]) && (params[1]) && (std::strcmp(params[0], params[1]) != 0))) {
/**
* LIST all chat channels
* Emperor sends as params[0] == -1 if want QuickMatch channels too, 0 if not.
@ -597,7 +591,7 @@ static int _handle_list_command(t_connection * conn, int numparams, char ** para
std::strcat(temp,"0"); /* User channel */
if (tag_check_wolv1(conn_get_clienttag(conn)))
std::strcat(temp,":"); /* WOLv1 ends by ":" */
std::strcat(temp,":"); /* WOLv1 ends by ":" FIXME: Should be an TOPIC after ":"*/
else
std::strcat(temp," 388"); /* WOLv2 ends by "388" */
@ -615,64 +609,15 @@ static int _handle_list_command(t_connection * conn, int numparams, char ** para
* 21 = Red Alert 1 v 3.03 channels, 31 = Emperor: Battle for Dune, 33 = Red Alert 2,
* 37 = Nox Quest channels, 38,39,40 = Quickgame channels, 41 = Yuri's Revenge
*/
if ((numparams == 0) || ((params[0]) && (params[1]) && (std::strcmp(params[0], params[1]) == 0))) {
if ((numparams == 0) || ((numparams == 2) && (params[0]) && (params[1]) && (std::strcmp(params[0], params[1]) == 0))) {
eventlog(eventlog_level_debug,__FUNCTION__,"[** WOL **] LIST [Game]");
/* list games */
struct gamelist_data data;
data.tcount = 0;
data.counter = 0;
data.wol_ver = 1;
data.conn = conn;
gamelist_traverse(&append_game_info, &data);
DEBUG3("[%d] LIST sent %u of %u games", conn_get_socket(conn), data.counter, data.tcount);
/* LIST_TRAVERSE_CONST(channellist(),curr)
{
t_channel const * channel = (const t_channel*)elem_get_data(curr);
t_connection * m;
char const * tempname;
char * topic = channel_get_topic(channel_get_name(channel));
tempname = irc_convert_channel(channel,conn);
if((channel_wol_get_game_type(channel) != 0)) {
m = channel_get_first(channel);
if((tag_channeltype_to_uint(channel_wol_get_game_type(channel)) == conn_get_clienttag(conn)) || ((numparams == 0))) {
eventlog(eventlog_level_debug,__FUNCTION__,"[** WOL **] List [Channel: \"_game\"] %s %u 0 %u %u %s %u 128::",tempname,
channel_get_length(channel),channel_wol_get_game_type(channel),channel_wol_get_game_tournament(channel),
channel_wol_get_game_extension(channel),channel_wol_get_game_ownerip(channel));
if (topic) {
eventlog(eventlog_level_debug,__FUNCTION__,"[** WOL **] List [Channel: \"_game\"] %s %u 0 %u %u %s %u 128::%s",tempname,
channel_get_length(channel),channel_wol_get_game_type(channel),channel_wol_get_game_tournament(channel),
channel_wol_get_game_extension(channel),channel_wol_get_game_ownerip(channel),topic);
/**
* The layout of the game list entry is something like this:
*
* #game_channel_name users isofficial gameType gameIsTournment gameExtension longIP locked::topic
* by isofficial is used always 0 (its backward compatibility with chat channels)
* locked can be 128==unlocked or 384==locked
* gameExtension is used for game_sorting, i.e. in RedAlert1v3 or TSUN/TSXP for spliting
* extension pack, also is used for spliting Clan_game or quick_match from normal game
*
if (std::strlen(tempname)+1+20+1+1+std::strlen(topic)<MAX_IRC_MESSAGE_LEN)
snprintf(temp, sizeof(temp), "%s %u 0 %u %u %s %u 128::%s",tempname,
channel_get_length(channel),channel_wol_get_game_type(channel),channel_wol_get_game_tournament(channel),
channel_wol_get_game_extension(channel),channel_wol_get_game_ownerip(channel),topic);
else
eventlog(eventlog_level_warn,__FUNCTION__,"LISTREPLY length exceeded");
}
else {
if (std::strlen(tempname)+1+20+1+1<MAX_IRC_MESSAGE_LEN)
snprintf(temp, sizeof(temp), "%s %u 0 %u %u %s %u 128::",tempname,channel_get_length(channel),channel_wol_get_game_type(channel),
channel_wol_get_game_tournament(channel),channel_wol_get_game_extension(channel),channel_wol_get_game_ownerip(channel));
else
eventlog(eventlog_level_warn,__FUNCTION__,"LISTREPLY length exceeded");
}
}
irc_send(conn,RPL_GAME_CHANNEL,temp);
}
}*/
}
irc_send(conn,RPL_LISTEND,":End of LIST command");
return 0;
@ -680,9 +625,11 @@ static int _handle_list_command(t_connection * conn, int numparams, char ** para
static int _handle_quit_command(t_connection * conn, int numparams, char ** params, char * text)
{
irc_send(conn,RPL_QUIT,":goodbye");
if (conn_get_channel(conn))
conn_quit_channel(conn, text);
irc_send(conn,RPL_QUIT,":goodbye");
conn_set_state(conn, conn_state_destroy);
return 0;
@ -723,10 +670,6 @@ static int _handle_part_command(t_connection * conn, int numparams, char ** para
{
t_game * game;
if ((conn_wol_get_ingame(conn) == 1)) {
conn_wol_set_ingame(conn,0);
}
conn_part_channel(conn);
if ((game = conn_get_game(conn)) && (game_get_status(game) == game_status_open))
@ -748,7 +691,7 @@ static int _handle_cvers_command(t_connection * conn, int numparams, char ** par
* Heres the imput expected:
* CVERS [oldvernum] [SKU]
*
* SKU is specific number for any WOL game (Tiberian sun, RedAlert 2 etc.)
* SKU is specific number for any WOL client (Tiberian sun, RedAlert 2 etc.)
* This is the best way to set clienttag, because CVERS is the first command which
* client send to server.
*/
@ -865,8 +808,8 @@ static int _handle_setopt_command(t_connection * conn, int numparams, char ** pa
elems = irc_get_listelems(params[0]);
if ((elems)&&(elems[0])&&(elems[1])) {
conn_wol_set_findme(conn,std::atoi(elems[0]));
conn_wol_set_pageme(conn,std::atoi(elems[1]));
conn_wol_set_findme(conn, ((std::strcmp(elems[0], "17") == 0) ? true : false));
conn_wol_set_pageme(conn, ((std::strcmp(elems[1], "33") == 0) ? true : false));
}
if (elems)
irc_unget_listelems(elems);
@ -906,8 +849,6 @@ static int _handle_getcodepage_command(t_connection * conn, int numparams, char
if (user = connlist_find_connection_by_accountname(params[i]))
codepage = conn_wol_get_codepage(user);
if (!codepage)
codepage = 0;
snprintf(_temp, sizeof(_temp), "%s`%u", params[i], codepage);
std::strcat(temp,_temp);
@ -953,8 +894,7 @@ static int _handle_getlocale_command(t_connection * conn, int numparams, char **
if (account = accountlist_find_account(params[i]))
locale = account_get_locale(account);
if (!locale)
locale = 0;
snprintf(_temp, sizeof(_temp), "%s`%u", params[i], locale);
std::strcat(temp,_temp);
if (i < numparams-1)
@ -1075,12 +1015,10 @@ static int _handle_joingame_command(t_connection * conn, int numparams, char **
}
}
conn_wol_set_ingame(conn,1);
gametype = game_get_type(game);
if ((conn_set_game(conn, gamename, gamepass, "", gametype, 0))<0) {
irc_send(conn,ERR_NOSUCHCHANNEL,":JOINGAME failed");
conn_wol_set_ingame(conn,0);
}
else {
/*conn_set_channel()*/
@ -1093,7 +1031,7 @@ static int _handle_joingame_command(t_connection * conn, int numparams, char **
if (tag_check_wolv1(conn_get_clienttag(conn))) {
/* WOLv1 JOINGAME message */
std::sprintf(_temp,"%u %u %u 1 1 %u :%s", channel_get_min(channel), game_get_maxplayers(game), channel_wol_get_game_type(channel),
channel_wol_get_game_tournament(channel), irc_convert_channel(channel,conn));
((game_get_type(game) == game_type_ladder) ? 1 : 0), irc_convert_channel(channel,conn));
}
else {
/* WOLv2 JOINGAME message with BATTLECLAN support */
@ -1104,10 +1042,9 @@ static int _handle_joingame_command(t_connection * conn, int numparams, char **
clanid = clan_get_clanid(clan);
std::sprintf(_temp,"%u %u %u 1 %u %u %u :%s", channel_get_min(channel), game_get_maxplayers(game), channel_wol_get_game_type(channel),
clanid, conn_get_addr(conn), channel_wol_get_game_tournament(channel), irc_convert_channel(channel,conn));
clanid, conn_get_addr(conn), ((game_get_type(game) == game_type_ladder) ? 1 : 0), irc_convert_channel(channel,conn));
}
eventlog(eventlog_level_debug,__FUNCTION__,"[** WOL **] JOINGAME [Game Options] (%s) [Game Owner] (%s)",_temp,channel_wol_get_game_owner(channel));
channel_set_userflags(conn);
/* we have to send the JOINGAME acknowledgement */
channel_message_send(channel,message_wol_joingame,conn,_temp);
@ -1146,8 +1083,6 @@ static int _handle_joingame_command(t_connection * conn, int numparams, char **
}
eventlog(eventlog_level_debug,__FUNCTION__,"[** WOL **] JOINGAME [Game Options] (%s)",_temp);
conn_wol_set_ingame(conn,1);
e = irc_get_listelems(params[0]);
if ((e)&&(e[0])) {
char const * gamename = irc_convert_ircname(e[0]);
@ -1179,12 +1114,9 @@ static int _handle_joingame_command(t_connection * conn, int numparams, char **
game_set_maxplayers(game,std::atoi(params[2]));
conn_wol_set_ingame(conn,1);
channel_set_min(channel,std::atoi(params[1]));
// HACK: Currently, this is the best way to set the channel game type...
channel_wol_set_game_type(channel,std::atoi(params[3]));
channel_wol_set_game_tournament(channel,std::atoi(params[6])); /* FIXME: we no longer need that if we setting game_type_ladder */
if (params[7])
channel_wol_set_game_extension(channel,params[7]);
@ -1196,37 +1128,6 @@ static int _handle_joingame_command(t_connection * conn, int numparams, char **
irc_send_topic(conn, channel);
irc_send_rpl_namreply(conn, channel);
}
/*
if ((!(wolname)) || ((conn_set_channel(conn, wolname))<0)) {
irc_send(conn,ERR_NOSUCHCHANNEL,":JOINGAME failed");
}
else {
t_channel * channel;
channel = conn_get_channel(conn);
if (channel!=old_channel) {
channel_set_userflags(conn);
channel_wol_set_game_owner(channel,conn_get_chatname(conn));
channel_wol_set_game_ownerip(channel,conn_get_addr(conn));
channel_set_min(channel,std::atoi(params[1]));
channel_set_max(channel,std::atoi(params[2]));
// HACK: Currently, this is the best way to set the channel game type...
channel_wol_set_game_type(channel,std::atoi(params[3]));
channel_wol_set_game_tournament(channel,std::atoi(params[6]));
if (params[7])
channel_wol_set_game_extension(channel,params[7]);
else
channel_wol_set_game_extension(channel,"0");
message_send_text(conn,message_wol_joingame,conn,_temp); // we have to send the JOINGAME acknowledgement
irc_send_topic(conn, channel);
irc_send_rpl_namreply(conn,channel);
}
}*/
}
if (e)
irc_unget_listelems(e);
@ -1300,7 +1201,7 @@ static int _handle_finduser_command(t_connection * conn, int numparams, char **
if ((numparams>=1)&&(params[0])) {
t_connection * user;
if((user = connlist_find_connection_by_accountname(params[0]))&&(conn_wol_get_findme(user) == 17)) {
if((user = connlist_find_connection_by_accountname(params[0])) && (conn_wol_get_findme(user))) {
wolname = irc_convert_channel(conn_get_channel(user),conn);
snprintf(_temp, sizeof(_temp), "0 :%s", wolname); /* User found in channel wolname */
}
@ -1324,7 +1225,7 @@ static int _handle_finduserex_command(t_connection * conn, int numparams, char *
if ((numparams>=1)&&(params[0])) {
t_connection * user;
if((user = connlist_find_connection_by_accountname(params[0]))&&(conn_wol_get_findme(user) == 17)) {
if((user = connlist_find_connection_by_accountname(params[0])) && (conn_wol_get_findme(user))) {
wolname = irc_convert_channel(conn_get_channel(user),conn);
snprintf(_temp, sizeof(_temp), "0 :%s,0", wolname); /* User found in channel wolname */
}
@ -1353,7 +1254,7 @@ static int _handle_page_command(t_connection * conn, int numparams, char ** para
if ((clan) && (clan_send_message_to_online_members(clan,message_type_page,conn,text) >= 1))
paged = true;
}
else if((user = connlist_find_connection_by_accountname(params[0]))&&(conn_wol_get_pageme(user) == 33)) {
else if ((user = connlist_find_connection_by_accountname(params[0])) && (conn_wol_get_pageme(user))) {
message_send_text(user,message_type_page,conn,text);
paged = true;
}

View file

@ -42,6 +42,7 @@
#include "message.h"
#include "channel.h"
#include "game.h"
#include "connection.h"
#include "server.h"
#include "account.h"
@ -842,6 +843,13 @@ extern int irc_message_format(t_packet * packet, t_message_type type, t_connecti
from.user = ctag;
msg = irc_message_preformat(&from,"QUIT","\r",temp);
}
else {
from.nick = conn_get_chatname(me);
from.user = ctag;
from.host = addr_num_to_ip_str(conn_get_addr(me));
msg = irc_message_preformat(&from,"PART","\r",irc_convert_channel(conn_get_channel(me),dst));
conn_unget_chatname(me,from.nick);
}
break;
/**
@ -985,6 +993,7 @@ int irc_send_rpl_namreply_internal(t_connection * c, t_channel const * channel){
if (!first) std::strcat(temp," ");
if (conn_get_wol(c) == 1) {
char _temp[MAX_IRC_MESSAGE_LEN];
t_game * game = conn_get_game(m);
if ((first) && ((std::strcmp(ircname, "#Lob_38_0") == 0) ||
(std::strcmp(ircname, "#Lob_39_0") == 0) ||
(std::strcmp(ircname, "#Lob_40_0") == 0))) {
@ -995,9 +1004,11 @@ int irc_send_rpl_namreply_internal(t_connection * c, t_channel const * channel){
}
if ((channel_wol_get_game_owner(channel) != NULL) && (std::strcmp(channel_wol_get_game_owner(channel),name) == 0)) {
/* PELISH: Only game owners will have OP flag (this prevent official OP to be normal player) */
std::strcat(temp,"@");
if ((game) && (game_get_channel(game) == channel)) {
if (game_get_owner(game) == m) {
/* PELISH: Only game owners will have OP flag (this prevent official OP to be normal player) */
std::strcat(temp,"@");
}
}
else {
if ((flags & MF_BNET) || (flags & MF_GAVEL))