Fix CHANGE_NICK_ON_KILL feature

Remove the 'resend_only' flag option to fudge_nickname().  The only caller passing it was the CHANGE_NICK_ON_KILL
feature, and in that case it was the wrong thing too (and stopped that function from working at all).

Some other minor cleanups in fudge_nickname() while we're there.
This commit is contained in:
Kevin Easton
2017-07-15 23:29:14 +10:00
parent b481ed1e6e
commit cd9c358eed
6 changed files with 15 additions and 24 deletions

View File

@@ -503,7 +503,7 @@ char *t = NULL;
if (nick && (t = get_string_var(ALTNICK_VAR)))
{
if (!my_stricmp(t, nick))
fudge_nickname(server, 0);
fudge_nickname(server);
else
change_server_nickname(server, t);
} else
@@ -513,7 +513,7 @@ char *t = NULL;
else
reset_nickname(from_server);
#endif
fudge_nickname(server, 0);
fudge_nickname(server);
}
/*
@@ -1149,7 +1149,6 @@ void numbered_command(char *from, int comm, char **ArgList)
* Sometimes the server doesn't catch the USER line, so
* here we send a simplified version again -lynx
*/
/* fudge_nickname(from_server, 1);*/
register_server(from_server, NULL);
PasteArgs(ArgList, 0);

View File

@@ -1302,7 +1302,7 @@ static void p_kill(char *from, char **ArgList)
ArgList[1] ? ArgList[1] : "(No Reason)"))
put_it("%s", convert_output_format(fget_string_var(FORMAT_KILL_FSET), "%s %s %s", update_clock(GET_TIME), from, ArgList[1]? ArgList[1] : "You have been Killed"));
if (get_int_var(CHANGE_NICK_ON_KILL_VAR))
fudge_nickname(from_server, 1);
fudge_nickname(from_server);
if (get_int_var(AUTO_RECONNECT_VAR))
servercmd (NULL, sc, empty_string, NULL);
logmsg(LOG_KILL, from, 0, "%s", ArgList[1]?ArgList[1]:"(No Reason)");

View File

@@ -2798,8 +2798,8 @@ void change_server_nickname (int ssn_index, char *nick)
reset_nickname(ssn_index);
}
if (server_list[ssn_index].s_nickname)
my_send_to_server(ssn_index, "NICK %s", server_list[ssn_index].s_nickname);
if (s->s_nickname && s->write > -1)
my_send_to_server(ssn_index, "NICK %s", s->s_nickname);
}
void accept_server_nickname (int ssn_index, char *nick)
@@ -2847,15 +2847,11 @@ int is_orignick_pending (int servnum)
* out of guesses, and if it ever gets to that point, it will do the
* manually-ask-you-for-a-new-nickname thing.
*/
void BX_fudge_nickname (int servnum, int resend_only)
void BX_fudge_nickname(int servnum)
{
char l_nickname[BIG_BUFFER_SIZE + 1];
char l_nickname[NICKNAME_LEN];
Server *s = &server_list[from_server];
if (resend_only)
{
change_server_nickname(servnum, NULL);
return;
}
/*
* If we got here because the user did a /NICK command, and
* the nick they chose doesnt exist, then we just dont do anything,
@@ -2867,7 +2863,7 @@ void BX_fudge_nickname (int servnum, int resend_only)
return;
}
if ((s->orignick_pending) && (!s->nickname_pending) && (!resend_only))
if (s->orignick_pending)
{
new_free(&s->s_nickname);
say("orignick feature failed, sorry");
@@ -2914,14 +2910,8 @@ void BX_fudge_nickname (int servnum, int resend_only)
else
{
char tmp = l_nickname[8];
l_nickname[8] = l_nickname[7];
l_nickname[7] = l_nickname[6];
l_nickname[6] = l_nickname[5];
l_nickname[5] = l_nickname[4];
l_nickname[4] = l_nickname[3];
l_nickname[3] = l_nickname[2];
l_nickname[2] = l_nickname[1];
l_nickname[1] = l_nickname[0];
memmove(&l_nickname[1], &l_nickname[0], 8);
l_nickname[0] = tmp;
}
if (!strcmp(l_nickname, "_________"))