Added ability to ignore joins, parts and quits of an ignored user.

Mentioned in #500
This commit is contained in:
Arnavion 2016-06-11 15:46:32 -07:00
parent cadff706e7
commit 77d73c6351
7 changed files with 42 additions and 26 deletions

View File

@ -151,6 +151,10 @@ ignore_showlist (session *sess)
strcat (tbuf, _("YES "));
else
strcat (tbuf, _("NO "));
if (ig->type & IG_JOINS_PARTS)
strcat (tbuf, _("YES "));
else
strcat (tbuf, _("NO "));
strcat (tbuf, "\n");
PrintText (sess, tbuf);
/*EMIT_SIGNAL (XP_TE_IGNORELIST, sess, ig->mask, 0, 0, 0, 0); */

View File

@ -36,6 +36,7 @@ extern int ignored_invi;
#define IG_UNIG 32
#define IG_NOSAVE 64
#define IG_DCC 128
#define IG_JOINS_PARTS 256
struct ignore
{

View File

@ -770,14 +770,15 @@ inbound_topicnew (server *serv, char *nick, char *chan, char *topic,
}
void
inbound_join (server *serv, char *chan, char *user, char *ip, char *account,
inbound_join (server *serv, char *chan, char *host, char *user, char *ip, char *account,
char *realname, const message_tags_data *tags_data)
{
session *sess = find_channel (serv, chan);
if (sess)
{
EMIT_SIGNAL_TIMESTAMP (XP_TE_JOIN, sess, user, chan, ip, account, 0,
tags_data->timestamp);
if (!ignore_check(host, IG_JOINS_PARTS))
EMIT_SIGNAL_TIMESTAMP (XP_TE_JOIN, sess, user, chan, ip, account, 0,
tags_data->timestamp);
userlist_add (sess, user, ip, account, realname, tags_data);
}
}
@ -796,18 +797,19 @@ inbound_kick (server *serv, char *chan, char *user, char *kicker, char *reason,
}
void
inbound_part (server *serv, char *chan, char *user, char *ip, char *reason,
inbound_part (server *serv, char *chan, char *host, char *user, char *ip, char *reason,
const message_tags_data *tags_data)
{
session *sess = find_channel (serv, chan);
if (sess)
{
if (*reason)
EMIT_SIGNAL_TIMESTAMP (XP_TE_PARTREASON, sess, user, ip, chan, reason,
0, tags_data->timestamp);
else
EMIT_SIGNAL_TIMESTAMP (XP_TE_PART, sess, user, ip, chan, NULL, 0,
tags_data->timestamp);
if (!ignore_check(host, IG_JOINS_PARTS))
if (*reason)
EMIT_SIGNAL_TIMESTAMP (XP_TE_PARTREASON, sess, user, ip, chan, reason,
0, tags_data->timestamp);
else
EMIT_SIGNAL_TIMESTAMP (XP_TE_PART, sess, user, ip, chan, NULL, 0,
tags_data->timestamp);
userlist_remove (sess, user);
}
}
@ -828,7 +830,7 @@ inbound_topictime (server *serv, char *chan, char *nick, time_t stamp,
}
void
inbound_quit (server *serv, char *nick, char *ip, char *reason,
inbound_quit (server *serv, char *host, char *nick, char *ip, char *reason,
const message_tags_data *tags_data)
{
GSList *list = sess_list;
@ -845,8 +847,9 @@ inbound_quit (server *serv, char *nick, char *ip, char *reason,
was_on_front_session = TRUE;
if ((user = userlist_find (sess, nick)))
{
EMIT_SIGNAL_TIMESTAMP (XP_TE_QUIT, sess, nick, reason, ip, NULL, 0,
tags_data->timestamp);
if (!ignore_check(host, IG_JOINS_PARTS))
EMIT_SIGNAL_TIMESTAMP (XP_TE_QUIT, sess, nick, reason, ip, NULL, 0,
tags_data->timestamp);
userlist_remove_user (sess, user);
} else if (sess->type == SESS_DIALOG && !serv->p_cmp (sess->channel, nick))
{

View File

@ -28,7 +28,7 @@ void inbound_uback (server *serv, const message_tags_data *tags_data);
void inbound_uaway (server *serv, const message_tags_data *tags_data);
void inbound_account (server *serv, char *nick, char *account,
const message_tags_data *tags_data);
void inbound_part (server *serv, char *chan, char *user, char *ip, char *reason,
void inbound_part (server *serv, char *chan, char *host, char *user, char *ip, char *reason,
const message_tags_data *tags_data);
void inbound_upart (server *serv, char *chan, char *ip, char *reason,
const message_tags_data *tags_data);
@ -38,11 +38,11 @@ void inbound_kick (server *serv, char *chan, char *user, char *kicker,
char *reason, const message_tags_data *tags_data);
void inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip,
int id, const message_tags_data *tags_data);
void inbound_quit (server *serv, char *nick, char *ip, char *reason,
void inbound_quit (server *serv, char *host, char *nick, char *ip, char *reason,
const message_tags_data *tags_data);
void inbound_topicnew (server *serv, char *nick, char *chan, char *topic,
const message_tags_data *tags_data);
void inbound_join (server *serv, char *chan, char *user, char *ip,
void inbound_join (server *serv, char *chan, char *host, char *user, char *ip,
char *account, char *realname,
const message_tags_data *tags_data);
void inbound_ujoin (server *serv, char *chan, char *nick, char *ip,

View File

@ -1046,8 +1046,8 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
if (!serv->p_cmp (nick, serv->nick))
inbound_ujoin (serv, chan, nick, ip, tags_data);
else
inbound_join (serv, chan, nick, ip, account, realname,
tags_data);
inbound_join (serv, chan, word[1], nick, ip, account, realname,
tags_data);
}
return;
@ -1100,7 +1100,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
if (!strcmp (nick, serv->nick))
inbound_upart (serv, chan, ip, reason, tags_data);
else
inbound_part (serv, chan, nick, ip, reason, tags_data);
inbound_part (serv, chan, word[1], nick, ip, reason, tags_data);
}
return;
@ -1115,9 +1115,9 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
return;
case WORDL('Q','U','I','T'):
inbound_quit (serv, nick, ip,
(word_eol[3][0] == ':') ? word_eol[3] + 1 : word_eol[3],
tags_data);
inbound_quit (serv, word[1], nick, ip,
(word_eol[3][0] == ':') ? word_eol[3] + 1 : word_eol[3],
tags_data);
return;
case WORDL('A','W','A','Y'):

View File

@ -469,7 +469,7 @@ pevt_generic_none_help
Ignore Header
XP_TE_IGNOREHEADER
pevt_generic_none_help
%C16,17 Hostmask PRIV NOTI CHAN CTCP DCC INVI UNIG
%C16,17 Hostmask PRIV NOTI CHAN CTCP DCC INVI UNIG JOINS_PARTS
0
Ignore Remove

View File

@ -40,6 +40,7 @@ enum
CTCP_COLUMN,
DCC_COLUMN,
INVITE_COLUMN,
JOINS_PARTS_COLUMN,
UNIGNORE_COLUMN,
N_COLUMNS
};
@ -61,7 +62,7 @@ get_store (void)
static unsigned int
ignore_get_flags (GtkTreeModel *model, GtkTreeIter *iter)
{
gboolean chan, priv, noti, ctcp, dcc, invi, unig;
gboolean chan, priv, noti, ctcp, dcc, invi, joins_parts, unig;
unsigned int flags = 0;
gtk_tree_model_get (
@ -72,6 +73,7 @@ ignore_get_flags (GtkTreeModel *model, GtkTreeIter *iter)
CTCP_COLUMN, &ctcp,
DCC_COLUMN, &dcc,
INVITE_COLUMN, &invi,
JOINS_PARTS_COLUMN, &joins_parts,
UNIGNORE_COLUMN, &unig,
-1);
if (chan)
@ -86,6 +88,8 @@ ignore_get_flags (GtkTreeModel *model, GtkTreeIter *iter)
flags |= IG_DCC;
if (invi)
flags |= IG_INVI;
if (joins_parts)
flags |= IG_JOINS_PARTS;
if (unig)
flags |= IG_UNIG;
return flags;
@ -169,6 +173,7 @@ ignore_treeview_new (GtkWidget *box)
CTCP_COLUMN, _("CTCP"),
DCC_COLUMN, _("DCC"),
INVITE_COLUMN, _("Invite"),
JOINS_PARTS_COLUMN, _("Joins & Parts"),
UNIGNORE_COLUMN, _("Unignore"),
-1);
@ -240,7 +245,7 @@ ignore_store_new (int cancel, char *mask, gpointer data)
GtkListStore *store = GTK_LIST_STORE (get_store ());
GtkTreeIter iter;
GtkTreePath *path;
unsigned int flags = IG_CHAN | IG_PRIV | IG_NOTI | IG_CTCP | IG_DCC | IG_INVI;
unsigned int flags = IG_CHAN | IG_PRIV | IG_NOTI | IG_CTCP | IG_DCC | IG_INVI | IG_JOINS_PARTS;
if (cancel)
return;
@ -264,6 +269,7 @@ ignore_store_new (int cancel, char *mask, gpointer data)
CTCP_COLUMN, TRUE,
DCC_COLUMN, TRUE,
INVITE_COLUMN, TRUE,
JOINS_PARTS_COLUMN, TRUE,
UNIGNORE_COLUMN, FALSE,
-1);
/* make sure the new row is visible and selected */
@ -354,7 +360,7 @@ ignore_gui_open ()
GtkTreeIter iter;
GSList *temp = ignore_list;
char *mask;
gboolean private, chan, notice, ctcp, dcc, invite, unignore;
gboolean private, chan, notice, ctcp, dcc, invite, joins_parts, unignore;
if (ignorewin)
{
@ -413,6 +419,7 @@ ignore_gui_open ()
ctcp = (ignore->type & IG_CTCP);
dcc = (ignore->type & IG_DCC);
invite = (ignore->type & IG_INVI);
joins_parts = (ignore->type & IG_JOINS_PARTS);
unignore = (ignore->type & IG_UNIG);
gtk_list_store_append (store, &iter);
@ -424,6 +431,7 @@ ignore_gui_open ()
CTCP_COLUMN, ctcp,
DCC_COLUMN, dcc,
INVITE_COLUMN, invite,
JOINS_PARTS_COLUMN, joins_parts,
UNIGNORE_COLUMN, unignore,
-1);