Compare commits
2 Commits
master
...
ignore-joi
Author | SHA1 | Date | |
---|---|---|---|
|
77d73c6351 | ||
|
cadff706e7 |
@ -77,7 +77,7 @@ ignore_exists (char *mask)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
ignore_add (char *mask, int type, gboolean overwrite)
|
ignore_add (char *mask, unsigned int type, gboolean overwrite)
|
||||||
{
|
{
|
||||||
struct ignore *ig = NULL;
|
struct ignore *ig = NULL;
|
||||||
int change_only = FALSE;
|
int change_only = FALSE;
|
||||||
@ -151,6 +151,10 @@ ignore_showlist (session *sess)
|
|||||||
strcat (tbuf, _("YES "));
|
strcat (tbuf, _("YES "));
|
||||||
else
|
else
|
||||||
strcat (tbuf, _("NO "));
|
strcat (tbuf, _("NO "));
|
||||||
|
if (ig->type & IG_JOINS_PARTS)
|
||||||
|
strcat (tbuf, _("YES "));
|
||||||
|
else
|
||||||
|
strcat (tbuf, _("NO "));
|
||||||
strcat (tbuf, "\n");
|
strcat (tbuf, "\n");
|
||||||
PrintText (sess, tbuf);
|
PrintText (sess, tbuf);
|
||||||
/*EMIT_SIGNAL (XP_TE_IGNORELIST, sess, ig->mask, 0, 0, 0, 0); */
|
/*EMIT_SIGNAL (XP_TE_IGNORELIST, sess, ig->mask, 0, 0, 0, 0); */
|
||||||
@ -200,7 +204,7 @@ ignore_del (char *mask, struct ignore *ig)
|
|||||||
/* check if a msg should be ignored by browsing our ignore list */
|
/* check if a msg should be ignored by browsing our ignore list */
|
||||||
|
|
||||||
int
|
int
|
||||||
ignore_check (char *host, int type)
|
ignore_check (char *host, unsigned int type)
|
||||||
{
|
{
|
||||||
struct ignore *ig;
|
struct ignore *ig;
|
||||||
GSList *list = ignore_list;
|
GSList *list = ignore_list;
|
||||||
|
@ -36,6 +36,7 @@ extern int ignored_invi;
|
|||||||
#define IG_UNIG 32
|
#define IG_UNIG 32
|
||||||
#define IG_NOSAVE 64
|
#define IG_NOSAVE 64
|
||||||
#define IG_DCC 128
|
#define IG_DCC 128
|
||||||
|
#define IG_JOINS_PARTS 256
|
||||||
|
|
||||||
struct ignore
|
struct ignore
|
||||||
{
|
{
|
||||||
@ -44,10 +45,10 @@ struct ignore
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ignore *ignore_exists (char *mask);
|
struct ignore *ignore_exists (char *mask);
|
||||||
int ignore_add (char *mask, int type, gboolean overwrite);
|
int ignore_add (char *mask, unsigned int type, gboolean overwrite);
|
||||||
void ignore_showlist (session *sess);
|
void ignore_showlist (session *sess);
|
||||||
int ignore_del (char *mask, struct ignore *ig);
|
int ignore_del (char *mask, struct ignore *ig);
|
||||||
int ignore_check (char *mask, int type);
|
int ignore_check (char *mask, unsigned int type);
|
||||||
void ignore_load (void);
|
void ignore_load (void);
|
||||||
void ignore_save (void);
|
void ignore_save (void);
|
||||||
void ignore_gui_open (void);
|
void ignore_gui_open (void);
|
||||||
|
@ -770,14 +770,15 @@ inbound_topicnew (server *serv, char *nick, char *chan, char *topic,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
char *realname, const message_tags_data *tags_data)
|
||||||
{
|
{
|
||||||
session *sess = find_channel (serv, chan);
|
session *sess = find_channel (serv, chan);
|
||||||
if (sess)
|
if (sess)
|
||||||
{
|
{
|
||||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_JOIN, sess, user, chan, ip, account, 0,
|
if (!ignore_check(host, IG_JOINS_PARTS))
|
||||||
tags_data->timestamp);
|
EMIT_SIGNAL_TIMESTAMP (XP_TE_JOIN, sess, user, chan, ip, account, 0,
|
||||||
|
tags_data->timestamp);
|
||||||
userlist_add (sess, user, ip, account, realname, tags_data);
|
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
|
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)
|
const message_tags_data *tags_data)
|
||||||
{
|
{
|
||||||
session *sess = find_channel (serv, chan);
|
session *sess = find_channel (serv, chan);
|
||||||
if (sess)
|
if (sess)
|
||||||
{
|
{
|
||||||
if (*reason)
|
if (!ignore_check(host, IG_JOINS_PARTS))
|
||||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_PARTREASON, sess, user, ip, chan, reason,
|
if (*reason)
|
||||||
0, tags_data->timestamp);
|
EMIT_SIGNAL_TIMESTAMP (XP_TE_PARTREASON, sess, user, ip, chan, reason,
|
||||||
else
|
0, tags_data->timestamp);
|
||||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_PART, sess, user, ip, chan, NULL, 0,
|
else
|
||||||
tags_data->timestamp);
|
EMIT_SIGNAL_TIMESTAMP (XP_TE_PART, sess, user, ip, chan, NULL, 0,
|
||||||
|
tags_data->timestamp);
|
||||||
userlist_remove (sess, user);
|
userlist_remove (sess, user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -828,7 +830,7 @@ inbound_topictime (server *serv, char *chan, char *nick, time_t stamp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
const message_tags_data *tags_data)
|
||||||
{
|
{
|
||||||
GSList *list = sess_list;
|
GSList *list = sess_list;
|
||||||
@ -845,8 +847,9 @@ inbound_quit (server *serv, char *nick, char *ip, char *reason,
|
|||||||
was_on_front_session = TRUE;
|
was_on_front_session = TRUE;
|
||||||
if ((user = userlist_find (sess, nick)))
|
if ((user = userlist_find (sess, nick)))
|
||||||
{
|
{
|
||||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_QUIT, sess, nick, reason, ip, NULL, 0,
|
if (!ignore_check(host, IG_JOINS_PARTS))
|
||||||
tags_data->timestamp);
|
EMIT_SIGNAL_TIMESTAMP (XP_TE_QUIT, sess, nick, reason, ip, NULL, 0,
|
||||||
|
tags_data->timestamp);
|
||||||
userlist_remove_user (sess, user);
|
userlist_remove_user (sess, user);
|
||||||
} else if (sess->type == SESS_DIALOG && !serv->p_cmp (sess->channel, nick))
|
} else if (sess->type == SESS_DIALOG && !serv->p_cmp (sess->channel, nick))
|
||||||
{
|
{
|
||||||
|
@ -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_uaway (server *serv, const message_tags_data *tags_data);
|
||||||
void inbound_account (server *serv, char *nick, char *account,
|
void inbound_account (server *serv, char *nick, char *account,
|
||||||
const message_tags_data *tags_data);
|
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);
|
const message_tags_data *tags_data);
|
||||||
void inbound_upart (server *serv, char *chan, char *ip, char *reason,
|
void inbound_upart (server *serv, char *chan, char *ip, char *reason,
|
||||||
const message_tags_data *tags_data);
|
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);
|
char *reason, const message_tags_data *tags_data);
|
||||||
void inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip,
|
void inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip,
|
||||||
int id, const message_tags_data *tags_data);
|
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);
|
const message_tags_data *tags_data);
|
||||||
void inbound_topicnew (server *serv, char *nick, char *chan, char *topic,
|
void inbound_topicnew (server *serv, char *nick, char *chan, char *topic,
|
||||||
const message_tags_data *tags_data);
|
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,
|
char *account, char *realname,
|
||||||
const message_tags_data *tags_data);
|
const message_tags_data *tags_data);
|
||||||
void inbound_ujoin (server *serv, char *chan, char *nick, char *ip,
|
void inbound_ujoin (server *serv, char *chan, char *nick, char *ip,
|
||||||
|
@ -1046,8 +1046,8 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
|
|||||||
if (!serv->p_cmp (nick, serv->nick))
|
if (!serv->p_cmp (nick, serv->nick))
|
||||||
inbound_ujoin (serv, chan, nick, ip, tags_data);
|
inbound_ujoin (serv, chan, nick, ip, tags_data);
|
||||||
else
|
else
|
||||||
inbound_join (serv, chan, nick, ip, account, realname,
|
inbound_join (serv, chan, word[1], nick, ip, account, realname,
|
||||||
tags_data);
|
tags_data);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1100,7 +1100,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
|
|||||||
if (!strcmp (nick, serv->nick))
|
if (!strcmp (nick, serv->nick))
|
||||||
inbound_upart (serv, chan, ip, reason, tags_data);
|
inbound_upart (serv, chan, ip, reason, tags_data);
|
||||||
else
|
else
|
||||||
inbound_part (serv, chan, nick, ip, reason, tags_data);
|
inbound_part (serv, chan, word[1], nick, ip, reason, tags_data);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1115,9 +1115,9 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case WORDL('Q','U','I','T'):
|
case WORDL('Q','U','I','T'):
|
||||||
inbound_quit (serv, nick, ip,
|
inbound_quit (serv, word[1], nick, ip,
|
||||||
(word_eol[3][0] == ':') ? word_eol[3] + 1 : word_eol[3],
|
(word_eol[3][0] == ':') ? word_eol[3] + 1 : word_eol[3],
|
||||||
tags_data);
|
tags_data);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case WORDL('A','W','A','Y'):
|
case WORDL('A','W','A','Y'):
|
||||||
|
@ -469,7 +469,7 @@ pevt_generic_none_help
|
|||||||
Ignore Header
|
Ignore Header
|
||||||
XP_TE_IGNOREHEADER
|
XP_TE_IGNOREHEADER
|
||||||
pevt_generic_none_help
|
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
|
0
|
||||||
|
|
||||||
Ignore Remove
|
Ignore Remove
|
||||||
|
@ -40,6 +40,7 @@ enum
|
|||||||
CTCP_COLUMN,
|
CTCP_COLUMN,
|
||||||
DCC_COLUMN,
|
DCC_COLUMN,
|
||||||
INVITE_COLUMN,
|
INVITE_COLUMN,
|
||||||
|
JOINS_PARTS_COLUMN,
|
||||||
UNIGNORE_COLUMN,
|
UNIGNORE_COLUMN,
|
||||||
N_COLUMNS
|
N_COLUMNS
|
||||||
};
|
};
|
||||||
@ -58,14 +59,23 @@ get_store (void)
|
|||||||
return gtk_tree_view_get_model (g_object_get_data (G_OBJECT (ignorewin), "view"));
|
return gtk_tree_view_get_model (g_object_get_data (G_OBJECT (ignorewin), "view"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static unsigned int
|
||||||
ignore_get_flags (GtkTreeModel *model, GtkTreeIter *iter)
|
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;
|
||||||
int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
gtk_tree_model_get (model, iter, 1, &chan, 2, &priv, 3, ¬i,
|
gtk_tree_model_get (
|
||||||
4, &ctcp, 5, &dcc, 6, &invi, 7, &unig, -1);
|
model, iter,
|
||||||
|
CHAN_COLUMN, &chan,
|
||||||
|
PRIV_COLUMN, &priv,
|
||||||
|
NOTICE_COLUMN, ¬i,
|
||||||
|
CTCP_COLUMN, &ctcp,
|
||||||
|
DCC_COLUMN, &dcc,
|
||||||
|
INVITE_COLUMN, &invi,
|
||||||
|
JOINS_PARTS_COLUMN, &joins_parts,
|
||||||
|
UNIGNORE_COLUMN, &unig,
|
||||||
|
-1);
|
||||||
if (chan)
|
if (chan)
|
||||||
flags |= IG_CHAN;
|
flags |= IG_CHAN;
|
||||||
if (priv)
|
if (priv)
|
||||||
@ -78,6 +88,8 @@ ignore_get_flags (GtkTreeModel *model, GtkTreeIter *iter)
|
|||||||
flags |= IG_DCC;
|
flags |= IG_DCC;
|
||||||
if (invi)
|
if (invi)
|
||||||
flags |= IG_INVI;
|
flags |= IG_INVI;
|
||||||
|
if (joins_parts)
|
||||||
|
flags |= IG_JOINS_PARTS;
|
||||||
if (unig)
|
if (unig)
|
||||||
flags |= IG_UNIG;
|
flags |= IG_UNIG;
|
||||||
return flags;
|
return flags;
|
||||||
@ -89,11 +101,11 @@ mask_edited (GtkCellRendererText *render, gchar *path, gchar *new, gpointer dat)
|
|||||||
GtkListStore *store = GTK_LIST_STORE (get_store ());
|
GtkListStore *store = GTK_LIST_STORE (get_store ());
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
char *old;
|
char *old;
|
||||||
int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
gtkutil_treemodel_string_to_iter (GTK_TREE_MODEL (store), path, &iter);
|
gtkutil_treemodel_string_to_iter (GTK_TREE_MODEL (store), path, &iter);
|
||||||
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &old, -1);
|
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &old, -1);
|
||||||
|
|
||||||
if (!strcmp (old, new)) /* no change */
|
if (!strcmp (old, new)) /* no change */
|
||||||
;
|
;
|
||||||
else if (ignore_exists (new)) /* duplicate, ignore */
|
else if (ignore_exists (new)) /* duplicate, ignore */
|
||||||
@ -109,7 +121,6 @@ mask_edited (GtkCellRendererText *render, gchar *path, gchar *new, gpointer dat)
|
|||||||
gtk_list_store_set (store, &iter, MASK_COLUMN, new, -1);
|
gtk_list_store_set (store, &iter, MASK_COLUMN, new, -1);
|
||||||
}
|
}
|
||||||
g_free (old);
|
g_free (old);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -120,7 +131,7 @@ option_toggled (GtkCellRendererToggle *render, gchar *path, gpointer data)
|
|||||||
int col_id = GPOINTER_TO_INT (data);
|
int col_id = GPOINTER_TO_INT (data);
|
||||||
gboolean active;
|
gboolean active;
|
||||||
char *mask;
|
char *mask;
|
||||||
int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
gtkutil_treemodel_string_to_iter (GTK_TREE_MODEL (store), path, &iter);
|
gtkutil_treemodel_string_to_iter (GTK_TREE_MODEL (store), path, &iter);
|
||||||
|
|
||||||
@ -162,6 +173,7 @@ ignore_treeview_new (GtkWidget *box)
|
|||||||
CTCP_COLUMN, _("CTCP"),
|
CTCP_COLUMN, _("CTCP"),
|
||||||
DCC_COLUMN, _("DCC"),
|
DCC_COLUMN, _("DCC"),
|
||||||
INVITE_COLUMN, _("Invite"),
|
INVITE_COLUMN, _("Invite"),
|
||||||
|
JOINS_PARTS_COLUMN, _("Joins & Parts"),
|
||||||
UNIGNORE_COLUMN, _("Unignore"),
|
UNIGNORE_COLUMN, _("Unignore"),
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
@ -233,7 +245,7 @@ ignore_store_new (int cancel, char *mask, gpointer data)
|
|||||||
GtkListStore *store = GTK_LIST_STORE (get_store ());
|
GtkListStore *store = GTK_LIST_STORE (get_store ());
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
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)
|
if (cancel)
|
||||||
return;
|
return;
|
||||||
@ -248,8 +260,18 @@ ignore_store_new (int cancel, char *mask, gpointer data)
|
|||||||
|
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
/* ignore everything by default */
|
/* ignore everything by default */
|
||||||
gtk_list_store_set (store, &iter, 0, mask, 1, TRUE, 2, TRUE, 3, TRUE,
|
gtk_list_store_set (
|
||||||
4, TRUE, 5, TRUE, 6, TRUE, 7, FALSE, -1);
|
store, &iter,
|
||||||
|
MASK_COLUMN, mask,
|
||||||
|
CHAN_COLUMN, TRUE,
|
||||||
|
PRIV_COLUMN, TRUE,
|
||||||
|
NOTICE_COLUMN, TRUE,
|
||||||
|
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 */
|
/* make sure the new row is visible and selected */
|
||||||
path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
|
path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
|
||||||
gtk_tree_view_scroll_to_cell (view, path, NULL, TRUE, 1.0, 0.0);
|
gtk_tree_view_scroll_to_cell (view, path, NULL, TRUE, 1.0, 0.0);
|
||||||
@ -338,7 +360,7 @@ ignore_gui_open ()
|
|||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GSList *temp = ignore_list;
|
GSList *temp = ignore_list;
|
||||||
char *mask;
|
char *mask;
|
||||||
gboolean private, chan, notice, ctcp, dcc, invite, unignore;
|
gboolean private, chan, notice, ctcp, dcc, invite, joins_parts, unignore;
|
||||||
|
|
||||||
if (ignorewin)
|
if (ignorewin)
|
||||||
{
|
{
|
||||||
@ -397,6 +419,7 @@ ignore_gui_open ()
|
|||||||
ctcp = (ignore->type & IG_CTCP);
|
ctcp = (ignore->type & IG_CTCP);
|
||||||
dcc = (ignore->type & IG_DCC);
|
dcc = (ignore->type & IG_DCC);
|
||||||
invite = (ignore->type & IG_INVI);
|
invite = (ignore->type & IG_INVI);
|
||||||
|
joins_parts = (ignore->type & IG_JOINS_PARTS);
|
||||||
unignore = (ignore->type & IG_UNIG);
|
unignore = (ignore->type & IG_UNIG);
|
||||||
|
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
@ -408,6 +431,7 @@ ignore_gui_open ()
|
|||||||
CTCP_COLUMN, ctcp,
|
CTCP_COLUMN, ctcp,
|
||||||
DCC_COLUMN, dcc,
|
DCC_COLUMN, dcc,
|
||||||
INVITE_COLUMN, invite,
|
INVITE_COLUMN, invite,
|
||||||
|
JOINS_PARTS_COLUMN, joins_parts,
|
||||||
UNIGNORE_COLUMN, unignore,
|
UNIGNORE_COLUMN, unignore,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user