mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Merge pull request #357 from LemonBoy/fix-99+1
Correctly alias 'channel' to '#channel'
This commit is contained in:
commit
99193e9971
@ -174,6 +174,13 @@ static CHANNEL_REC *irc_channel_find_server(SERVER_REC *server,
|
|||||||
const char *channel)
|
const char *channel)
|
||||||
{
|
{
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
|
char *fmt_channel;
|
||||||
|
|
||||||
|
/* if 'channel' has no leading # this lookup is going to fail, add a
|
||||||
|
* octothorpe in front of it to handle this case. */
|
||||||
|
fmt_channel = server_ischannel(SERVER(server), channel) ?
|
||||||
|
g_strdup(channel) :
|
||||||
|
g_strdup_printf("#%s", channel);
|
||||||
|
|
||||||
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
||||||
CHANNEL_REC *rec = tmp->data;
|
CHANNEL_REC *rec = tmp->data;
|
||||||
@ -182,13 +189,19 @@ static CHANNEL_REC *irc_channel_find_server(SERVER_REC *server,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* check both !ABCDEchannel and !channel */
|
/* check both !ABCDEchannel and !channel */
|
||||||
if (IRC_SERVER(server)->nick_comp_func(channel, rec->name) == 0)
|
if (IRC_SERVER(server)->nick_comp_func(fmt_channel, rec->name) == 0) {
|
||||||
|
g_free(fmt_channel);
|
||||||
return rec;
|
return rec;
|
||||||
|
}
|
||||||
|
|
||||||
if (IRC_SERVER(server)->nick_comp_func(channel, rec->visible_name) == 0)
|
if (IRC_SERVER(server)->nick_comp_func(fmt_channel, rec->visible_name) == 0) {
|
||||||
|
g_free(fmt_channel);
|
||||||
return rec;
|
return rec;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free(fmt_channel);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,30 +55,6 @@ NICK_REC *irc_nicklist_insert(IRC_CHANNEL_REC *channel, const char *nick,
|
|||||||
return rec;
|
return rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define isnickchar(a) \
|
|
||||||
(i_isalnum(a) || (a) == '`' || (a) == '-' || (a) == '_' || \
|
|
||||||
(a) == '[' || (a) == ']' || (a) == '{' || (a) == '}' || \
|
|
||||||
(a) == '|' || (a) == '\\' || (a) == '^')
|
|
||||||
|
|
||||||
/* Remove all "extra" characters from `nick'. Like _nick_ -> nick */
|
|
||||||
char *irc_nick_strip(const char *nick)
|
|
||||||
{
|
|
||||||
char *stripped, *spos;
|
|
||||||
|
|
||||||
g_return_val_if_fail(nick != NULL, NULL);
|
|
||||||
|
|
||||||
spos = stripped = g_strdup(nick);
|
|
||||||
while (isnickchar(*nick)) {
|
|
||||||
if (i_isalnum(*nick))
|
|
||||||
*spos++ = *nick;
|
|
||||||
nick++;
|
|
||||||
}
|
|
||||||
if ((unsigned char) *nick >= 128)
|
|
||||||
*spos++ = *nick; /* just add it so that nicks won't match.. */
|
|
||||||
*spos = '\0';
|
|
||||||
return stripped;
|
|
||||||
}
|
|
||||||
|
|
||||||
int irc_nickcmp_rfc1459(const char *m, const char *n)
|
int irc_nickcmp_rfc1459(const char *m, const char *n)
|
||||||
{
|
{
|
||||||
while (*m != '\0' && *n != '\0') {
|
while (*m != '\0' && *n != '\0') {
|
||||||
|
@ -8,9 +8,6 @@ NICK_REC *irc_nicklist_insert(IRC_CHANNEL_REC *channel, const char *nick,
|
|||||||
int op, int halfop, int voice, int send_massjoin,
|
int op, int halfop, int voice, int send_massjoin,
|
||||||
const char *prefixes);
|
const char *prefixes);
|
||||||
|
|
||||||
/* Remove all "extra" characters from `nick'. Like _nick_ -> nick */
|
|
||||||
char *irc_nick_strip(const char *nick);
|
|
||||||
|
|
||||||
int irc_nickcmp_rfc1459(const char *, const char *);
|
int irc_nickcmp_rfc1459(const char *, const char *);
|
||||||
int irc_nickcmp_ascii(const char *, const char *);
|
int irc_nickcmp_ascii(const char *, const char *);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user