make sending of topic on irc type connections automagic, too
This commit is contained in:
parent
10511d9926
commit
656394b9d4
7 changed files with 38 additions and 42 deletions
|
@ -492,11 +492,11 @@ extern int channel_add_connection(t_channel * channel, t_connection * connection
|
|||
message_send_text(connection,message_type_join,connection,NULL);
|
||||
}
|
||||
|
||||
if (conn_is_irc_variant(connection)) {
|
||||
if (conn_wol_get_ingame(connection)==0)
|
||||
if (conn_is_irc_variant(connection) && (!conn_wol_get_ingame(connection))) {
|
||||
message_send_text(connection,message_type_topic,connection,NULL);
|
||||
message_send_text(connection,message_type_namreply,connection,NULL);
|
||||
}
|
||||
conn_wol_set_ingame(connection,0);
|
||||
|
||||
/* please don't remove this notice */
|
||||
if (channel->log)
|
||||
message_send_text(connection,message_type_info,connection,prefs_get_log_notice());
|
||||
|
|
|
@ -775,28 +775,11 @@ static int _handle_join_command(t_connection * conn, int numparams, char ** para
|
|||
channel = conn_get_channel(conn);
|
||||
|
||||
if (channel!=old_channel) {
|
||||
char * topic;
|
||||
|
||||
channel_set_userflags(conn);
|
||||
ircname=irc_convert_channel(channel);
|
||||
|
||||
if ((topic = channel_get_topic(channel_get_name(channel)))) {
|
||||
if ((std::strlen(ircname)+1+1+std::strlen(topic)+1)<MAX_IRC_MESSAGE_LEN) {
|
||||
snprintf(temp, sizeof(temp), "%s :%s", ircname, topic);
|
||||
irc_send(conn,RPL_TOPIC,temp);
|
||||
}
|
||||
|
||||
if ((std::strlen(ircname)+1+std::strlen("FIXME 0")+1)<MAX_IRC_MESSAGE_LEN) {
|
||||
snprintf(temp, sizeof(temp), "%s FIXME 0",ircname);
|
||||
irc_send(conn,RPL_TOPICWHOTIME,temp); /* FIXME: this in an undernet extension but other servers support it too */
|
||||
}
|
||||
channel_set_userflags(conn);
|
||||
}
|
||||
else
|
||||
irc_send(conn,RPL_NOTOPIC,":No topic is set");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e)
|
||||
irc_unget_listelems(e);
|
||||
}
|
||||
|
|
|
@ -1276,22 +1276,13 @@ static int _handle_joingame_command(t_connection * conn, int numparams, char **
|
|||
eventlog(eventlog_level_debug,__FUNCTION__,"[** WOL **] JOINGAME [Game Options] (%s) [Game Owner] (%s)",gameOptions,channel_wol_get_game_owner(channel));
|
||||
|
||||
if (channel!=old_channel) {
|
||||
char temp[MAX_IRC_MESSAGE_LEN];
|
||||
|
||||
channel_set_userflags(conn);
|
||||
// message_send_text(conn,message_wol_joingame,conn,gameOptions); /* we have to send the JOINGAME acknowledgement */
|
||||
channel_message_send(channel,message_wol_joingame,conn,gameOptions);
|
||||
wolname=irc_convert_channel(channel);
|
||||
|
||||
if ((topic = channel_get_topic(channel_get_name(channel)))) {
|
||||
if ((std::strlen(wolname)+1+1+std::strlen(topic)+1)<MAX_IRC_MESSAGE_LEN) {
|
||||
snprintf(temp, sizeof(temp), "%s :%s", wolname, topic);
|
||||
irc_send(conn,RPL_TOPIC,temp);
|
||||
}
|
||||
}
|
||||
irc_send_topic(conn, channel);
|
||||
|
||||
irc_send_rpl_namreply(conn,channel);
|
||||
|
||||
}
|
||||
else {
|
||||
irc_send(conn,ERR_NOSUCHCHANNEL,":JOINGAME failed");
|
||||
|
|
|
@ -797,12 +797,23 @@ extern int irc_message_format(t_packet * packet, t_message_type type, t_connecti
|
|||
}
|
||||
break;
|
||||
case message_type_namreply:
|
||||
t_channel * channel;
|
||||
{
|
||||
t_channel * channel;
|
||||
|
||||
channel = conn_get_channel(me);
|
||||
channel = conn_get_channel(me);
|
||||
|
||||
irc_send_rpl_namreply(dst,channel);
|
||||
irc_send_rpl_namreply(dst,channel);
|
||||
}
|
||||
break;
|
||||
case message_type_topic:
|
||||
{
|
||||
t_channel * channel;
|
||||
|
||||
channel = conn_get_channel(me);
|
||||
|
||||
irc_send_topic(dst,channel);
|
||||
}
|
||||
break;
|
||||
|
||||
/**
|
||||
* Westwood Online Extensions
|
||||
|
@ -1191,6 +1202,20 @@ extern int _handle_nick_command(t_connection * conn, int numparams, char ** para
|
|||
return 0;
|
||||
}
|
||||
|
||||
int irc_send_topic(t_connection * c, t_channel const * channel){
|
||||
char * topic;
|
||||
char temp[MAX_IRC_MESSAGE_LEN];
|
||||
|
||||
if ((topic = channel_get_topic(channel_get_name(channel)))) {
|
||||
snprintf(temp, sizeof(temp), "%s :%s", irc_convert_channel(channel), topic);
|
||||
irc_send(c, RPL_TOPIC, temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_send(c, RPL_NOTOPIC, ":No topic is set");
|
||||
}
|
||||
}
|
||||
|
||||
extern int _handle_topic_command(t_connection * conn, int numparams, char ** params, char * text)
|
||||
{
|
||||
char ** e = NULL;
|
||||
|
@ -1206,17 +1231,10 @@ extern int _handle_topic_command(t_connection * conn, int numparams, char ** par
|
|||
t_channel *channel = conn_get_channel(conn);
|
||||
|
||||
if (channel) {
|
||||
char * topic;
|
||||
char temp[MAX_IRC_MESSAGE_LEN];
|
||||
char const * ircname = irc_convert_ircname(e[0]);
|
||||
|
||||
if ((ircname) && (strcasecmp(channel_get_name(channel),ircname)==0)) {
|
||||
if ((topic = channel_get_topic(channel_get_name(channel)))) {
|
||||
snprintf(temp, sizeof(temp), "%s :%s", irc_convert_channel(channel), topic);
|
||||
irc_send(conn,RPL_TOPIC,temp);
|
||||
}
|
||||
else
|
||||
irc_send(conn,RPL_NOTOPIC,":No topic is set");
|
||||
irc_send_topic(conn, channel);
|
||||
}
|
||||
else
|
||||
irc_send(conn,ERR_NOTONCHANNEL,":You are not on that channel");
|
||||
|
|
|
@ -51,6 +51,7 @@ extern int irc_send_rpl_namreply(t_connection * c, t_channel const * channel);
|
|||
extern int irc_who(t_connection * c, char const * name);
|
||||
extern int irc_send_motd(t_connection * conn);
|
||||
extern int _handle_nick_command(t_connection * conn, int numparams, char ** params, char * text);
|
||||
extern int irc_send_topic(t_connection * c, t_channel const * channel);
|
||||
extern int _handle_topic_command(t_connection * conn, int numparams, char ** params, char * text);
|
||||
extern int _handle_names_command(t_connection * conn, int numparams, char ** params, char * text);
|
||||
}
|
||||
|
|
|
@ -101,6 +101,8 @@ static char const * message_type_get_str(t_message_type type)
|
|||
return "nick";
|
||||
case message_type_namreply:
|
||||
return "namreply";
|
||||
case message_type_topic:
|
||||
return "topic";
|
||||
case message_type_mode:
|
||||
return "mode";
|
||||
case message_type_host:
|
||||
|
|
|
@ -65,6 +65,7 @@ typedef enum
|
|||
message_type_nick,
|
||||
message_type_notice,
|
||||
message_type_namreply,
|
||||
message_type_topic,
|
||||
|
||||
/**
|
||||
* Westwood Online Extensions
|
||||
|
|
Loading…
Add table
Reference in a new issue