mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
minor cleanups
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@814 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
6e27475e98
commit
228c0842fc
@ -35,27 +35,18 @@
|
|||||||
GSList *ignores;
|
GSList *ignores;
|
||||||
|
|
||||||
/* check if `text' contains ignored nick at the start of the line. */
|
/* check if `text' contains ignored nick at the start of the line. */
|
||||||
static int ignore_check_replies(IGNORE_REC *rec, SERVER_REC *server,
|
static int ignore_check_replies(IGNORE_REC *rec, CHANNEL_REC *channel,
|
||||||
const char *channel, const char *text)
|
const char *text)
|
||||||
{
|
{
|
||||||
CHANNEL_REC *chanrec;
|
|
||||||
GSList *nicks, *tmp;
|
GSList *nicks, *tmp;
|
||||||
|
|
||||||
g_return_val_if_fail(rec != NULL, FALSE);
|
nicks = nicklist_find_multiple(channel, rec->mask);
|
||||||
g_return_val_if_fail(server != NULL, FALSE);
|
|
||||||
g_return_val_if_fail(channel != NULL, FALSE);
|
|
||||||
g_return_val_if_fail(text != NULL, FALSE);
|
|
||||||
|
|
||||||
chanrec = channel_find(server, channel);
|
|
||||||
if (chanrec == NULL) return FALSE;
|
|
||||||
|
|
||||||
nicks = nicklist_find_multiple(chanrec, rec->mask);
|
|
||||||
if (nicks == NULL) return FALSE;
|
if (nicks == NULL) return FALSE;
|
||||||
|
|
||||||
for (tmp = nicks; tmp != NULL; tmp = tmp->next) {
|
for (tmp = nicks; tmp != NULL; tmp = tmp->next) {
|
||||||
NICK_REC *nick = tmp->data;
|
NICK_REC *nick = tmp->data;
|
||||||
|
|
||||||
if (nick_match_msg(server, text, nick->nick))
|
if (nick_match_msg(channel->server, text, nick->nick))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
g_slist_free(nicks);
|
g_slist_free(nicks);
|
||||||
@ -66,12 +57,17 @@ static int ignore_check_replies(IGNORE_REC *rec, SERVER_REC *server,
|
|||||||
int ignore_check(SERVER_REC *server, const char *nick, const char *host,
|
int ignore_check(SERVER_REC *server, const char *nick, const char *host,
|
||||||
const char *channel, const char *text, int level)
|
const char *channel, const char *text, int level)
|
||||||
{
|
{
|
||||||
|
CHANNEL_REC *chanrec;
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
int ok, mask_len, patt_len;
|
int ok, mask_len, patt_len;
|
||||||
int best_mask, best_patt, best_ignore;
|
int best_mask, best_patt, best_ignore;
|
||||||
|
|
||||||
g_return_val_if_fail(server != NULL, 0);
|
g_return_val_if_fail(server != NULL, 0);
|
||||||
|
|
||||||
|
chanrec = (channel != NULL && server != NULL &&
|
||||||
|
server->ischannel(*channel)) ?
|
||||||
|
channel_find(server, channel) : NULL;
|
||||||
|
|
||||||
best_mask = 0; best_patt = 0; best_ignore = FALSE;
|
best_mask = 0; best_patt = 0; best_ignore = FALSE;
|
||||||
for (tmp = ignores; tmp != NULL; tmp = tmp->next) {
|
for (tmp = ignores; tmp != NULL; tmp = tmp->next) {
|
||||||
IGNORE_REC *rec = tmp->data;
|
IGNORE_REC *rec = tmp->data;
|
||||||
@ -85,9 +81,8 @@ int ignore_check(SERVER_REC *server, const char *nick, const char *host,
|
|||||||
|
|
||||||
/* channel list */
|
/* channel list */
|
||||||
if (rec->channels != NULL) {
|
if (rec->channels != NULL) {
|
||||||
if (channel == NULL || !server->ischannel(*channel))
|
if (chanrec == NULL ||
|
||||||
continue;
|
strarray_find(rec->channels, channel) == -1)
|
||||||
if (strarray_find(rec->channels, channel) == -1)
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +101,7 @@ int ignore_check(SERVER_REC *server, const char *nick, const char *host,
|
|||||||
if (!ok) {
|
if (!ok) {
|
||||||
/* nick didn't match, but maybe this is a reply to nick? */
|
/* nick didn't match, but maybe this is a reply to nick? */
|
||||||
if (!rec->replies || channel == NULL || text == NULL ||
|
if (!rec->replies || channel == NULL || text == NULL ||
|
||||||
!ignore_check_replies(rec, server, channel, text))
|
!ignore_check_replies(rec, chanrec, text))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user