1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

nicklist_find() now finds only full nicks, nicklist_find_mask() finds

nick masks. This fixes *a* and similiar emphasis where irssi tried to
find nick mask *a* instead of nick *a*.

Also, emphasis with highascii didn't work unless emphasis_multiword was
set ON.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1143 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-01-28 01:45:31 +00:00 committed by cras
parent db03c25952
commit 4cbabe2a83
5 changed files with 39 additions and 20 deletions

View File

@ -188,16 +188,15 @@ void channel_send_autocommands(CHANNEL_REC *channel)
for (bot = bots; *bot != NULL; bot++) {
const char *botnick = *bot;
nick = nicklist_find(channel,
channel->server->isnickflag(*botnick) ?
botnick+1 : botnick);
if (nick == NULL ||
!match_nick_flags(channel->server, nick, *botnick))
continue;
/* got one! */
eval_special_string(rec->autosendcmd, nick->nick, channel->server, channel);
break;
nick = nicklist_find_mask(channel,
channel->server->isnickflag(*botnick) ?
botnick+1 : botnick);
if (nick != NULL &&
match_nick_flags(channel->server, nick, *botnick)) {
eval_special_string(rec->autosendcmd, nick->nick,
channel->server, channel);
break;
}
}
g_strfreev(bots);
}

View File

@ -156,8 +156,17 @@ GSList *nicklist_find_multiple(CHANNEL_REC *channel, const char *mask)
return nicks;
}
/* Find nick record from list */
NICK_REC *nicklist_find(CHANNEL_REC *channel, const char *mask)
/* Find nick */
NICK_REC *nicklist_find(CHANNEL_REC *channel, const char *nick)
{
g_return_val_if_fail(IS_CHANNEL(channel), NULL);
g_return_val_if_fail(nick != NULL, NULL);
return g_hash_table_lookup(channel->nicks, nick);
}
/* Find nick mask, wildcards allowed */
NICK_REC *nicklist_find_mask(CHANNEL_REC *channel, const char *mask)
{
NICK_REC *nickrec;
char *nick, *host;

View File

@ -23,8 +23,10 @@ void nicklist_remove(CHANNEL_REC *channel, NICK_REC *nick);
void nicklist_rename(SERVER_REC *server, const char *old_nick,
const char *new_nick);
/* Find nick record from list */
NICK_REC *nicklist_find(CHANNEL_REC *channel, const char *mask);
/* Find nick */
NICK_REC *nicklist_find(CHANNEL_REC *channel, const char *nick);
/* Find nick mask, wildcards allowed */
NICK_REC *nicklist_find_mask(CHANNEL_REC *channel, const char *mask);
/* Get list of nicks that match the mask */
GSList *nicklist_find_multiple(CHANNEL_REC *channel, const char *mask);
/* Get list of nicks */

View File

@ -63,12 +63,12 @@ char *expand_emphasis(WI_ITEM_REC *item, const char *text)
/* check that the beginning marker starts a word, and
* that the matching end marker ends a word */
if ((pos > 0 && isalnum(bgn[-1])) || !ishighalnum(bgn[1]))
if ((pos > 0 && ishighalnum(bgn[-1])) || !ishighalnum(bgn[1]))
continue;
if ((end = strchr(bgn+1, *bgn)) == NULL)
continue;
if (!ishighalnum(end[-1]) ||
isalnum(end[1]) || end[1] == type)
ishighalnum(end[1]) || end[1] == type)
continue;
if (IS_CHANNEL(item)) {
@ -88,7 +88,7 @@ char *expand_emphasis(WI_ITEM_REC *item, const char *text)
if (!settings_get_bool("emphasis_multiword")) {
char *c;
for (c = bgn+1; c != end; c++) {
if (!isalnum(*c))
if (!ishighalnum(*c))
break;
}
if (c != end) continue;

View File

@ -103,11 +103,20 @@ CODE:
nicklist_remove(channel, nick);
Irssi::Nick
nick_find(channel, mask)
nick_find(channel, nick)
Irssi::Channel channel
char *nick
CODE:
RETVAL = nicklist_find(channel, nick);
OUTPUT:
RETVAL
Irssi::Nick
nick_find_mask(channel, mask)
Irssi::Channel channel
char *mask
CODE:
RETVAL = nicklist_find(channel, mask);
RETVAL = nicklist_find_mask(channel, mask);
OUTPUT:
RETVAL