mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 12:23:37 +02:00
completion_msgtoyou() -> irc_nick_match()
Implemented -replies option to /ignore. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@287 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
1a541c149d
commit
8562737548
9 changed files with 80 additions and 41 deletions
|
|
@ -177,7 +177,7 @@ static void event_privmsg(gchar *data, IRC_SERVER_REC *server, gchar *nick)
|
|||
return;
|
||||
}
|
||||
|
||||
list = completion_msgtoyou((SERVER_REC *) server, msg) ?
|
||||
list = irc_nick_match(server->nick, msg) ?
|
||||
&channel->lastownmsgs :
|
||||
&channel->lastmsgs;
|
||||
nick_completion_create(list, time(NULL), nick);
|
||||
|
|
@ -207,31 +207,6 @@ static void cmd_msg(gchar *data, IRC_SERVER_REC *server)
|
|||
g_free(params);
|
||||
}
|
||||
|
||||
int completion_msgtoyou(SERVER_REC *server, const char *msg)
|
||||
{
|
||||
gchar *stripped, *nick;
|
||||
gboolean ret;
|
||||
gint len;
|
||||
|
||||
g_return_val_if_fail(msg != NULL, FALSE);
|
||||
|
||||
if (g_strncasecmp(msg, server->nick, strlen(server->nick)) == 0 &&
|
||||
!isalnum((gint) msg[strlen(server->nick)])) return TRUE;
|
||||
|
||||
stripped = nick_strip(server->nick);
|
||||
nick = nick_strip(msg);
|
||||
|
||||
len = strlen(stripped);
|
||||
ret = *stripped != '\0' &&
|
||||
g_strncasecmp(nick, stripped, len) == 0 &&
|
||||
!isalnum((gint) nick[len]) &&
|
||||
(guchar) nick[len] < 128;
|
||||
|
||||
g_free(nick);
|
||||
g_free(stripped);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void complete_list(GList **outlist, GSList *list, gchar *nick)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "window-items.h"
|
||||
|
||||
int completion_msgtoyou(SERVER_REC *server, const char *msg);
|
||||
char *completion_line(WINDOW_REC *window, const char *line, int *pos);
|
||||
char *auto_completion(const char *line, int *pos);
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ static void event_privmsg(gchar *data, IRC_SERVER_REC *server, gchar *nick, gcha
|
|||
gchar *color;
|
||||
|
||||
chanrec = channel_find(server, target);
|
||||
toyou = completion_msgtoyou((SERVER_REC *) server, msg);
|
||||
toyou = irc_nick_match(server->nick, msg);
|
||||
color = irc_hilight_find_nick(target, nick, addr);
|
||||
|
||||
nickrec = chanrec == NULL ? NULL : nicklist_find(chanrec, nick);
|
||||
|
|
|
|||
|
|
@ -112,8 +112,9 @@ static void ignore_print(int index, IGNORE_REC *rec)
|
|||
IRCTXT_IGNORE_LINE, index,
|
||||
key != NULL ? key : "",
|
||||
levels != NULL ? levels : "",
|
||||
rec->regexp ? " -regexp" : "",
|
||||
rec->fullword ? " -word" : "",
|
||||
rec->regexp ? " -regexp" : "");
|
||||
rec->replies ? " -replies" : "");
|
||||
g_free(key);
|
||||
g_free(levels);
|
||||
}
|
||||
|
|
@ -183,8 +184,9 @@ static void cmd_ignore(const char *data)
|
|||
}
|
||||
|
||||
rec->pattern = *patternarg == '\0' ? NULL : g_strdup(patternarg);
|
||||
rec->fullword = stristr(args, "-word") != NULL;
|
||||
rec->regexp = stristr(args, "-regexp") != NULL;
|
||||
rec->fullword = stristr(args, "-word") != NULL;
|
||||
rec->replies = stristr(args, "-replies") != NULL;
|
||||
|
||||
if (rec->level == 0 && rec->except_level == 0) {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_UNIGNORED,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "irc.h"
|
||||
#include "ignore.h"
|
||||
#include "irc-server.h"
|
||||
#include "nicklist.h"
|
||||
|
||||
#include "completion.h"
|
||||
#include "windows.h"
|
||||
|
|
@ -59,7 +60,7 @@ static void event_privmsg(const char *data, IRC_SERVER_REC *server, const char *
|
|||
if (window != active_win && !ignore_check(server, nick, addr, target, msg, level)) {
|
||||
/* hilight */
|
||||
level = !ischannel(*target) ||
|
||||
completion_msgtoyou((SERVER_REC *) server, msg) ?
|
||||
irc_nick_match(server->nick, msg) ?
|
||||
NEWDATA_MSG_FORYOU : NEWDATA_MSG;
|
||||
if (item != NULL && item->new_data < level) {
|
||||
item->new_data = level;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue