Compare commits

..

9 Commits

Author SHA1 Message Date
77d73c6351 Added ability to ignore joins, parts and quits of an ignored user.
Mentioned in #500
2016-06-11 15:46:32 -07:00
cadff706e7 Use unsigned int consistently for ignore type, and use IG_* constants instead of numeric literals. 2016-06-11 15:46:32 -07:00
a031a24cfd Bump version to 2.12.1-2 2016-06-05 11:22:24 +02:00
c698e13c0d Couple of minor const correctness fixes 2016-05-28 16:52:26 +10:00
10e429b85d Remove two un-needed type casts 2016-05-28 16:35:45 +10:00
6554a8d63c servlistgui: Show invalid nick/user on open
It is possible to have an invalid config from a previous upgrade

Fixes #1715
2016-05-16 08:51:18 -04:00
d32aa65bc7 Ignore VS2015 crap. 2016-05-12 22:21:26 -07:00
3c329727c7 servlist: Default to UTF-8 on PTNet
Fixes #1697
2016-05-03 20:16:49 -04:00
e223840fa6 Bump version to 2.12.1 2016-05-01 20:52:05 +02:00
15 changed files with 88 additions and 49 deletions

2
.gitignore vendored
View File

@ -85,3 +85,5 @@ osx/.HexChat.app
po/.intltool-merge-cache po/.intltool-merge-cache
*.zip *.zip
*.dmg *.dmg
*.VC.db
*.VC.opendb

View File

@ -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;

View File

@ -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);

View File

@ -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))
{ {

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_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,

View File

@ -162,8 +162,8 @@ process_data_init (char *buf, char *cmd, char *word[],
word[0] = "\000\000"; word[0] = "\000\000";
word_eol[0] = "\000\000"; word_eol[0] = "\000\000";
word[1] = (char *)buf; word[1] = buf;
word_eol[1] = (char *)cmd; word_eol[1] = cmd;
while (1) while (1)
{ {

View File

@ -426,14 +426,14 @@ plugin_auto_load_cb (char *filename)
} }
} }
static char * static const char *
plugin_get_libdir (void) plugin_get_libdir (void)
{ {
const char *libdir; const char *libdir;
libdir = g_getenv ("HEXCHAT_LIBDIR"); libdir = g_getenv ("HEXCHAT_LIBDIR");
if (libdir && *libdir) if (libdir && *libdir)
return (char*)libdir; return libdir;
else else
return HEXCHATLIBDIR; return HEXCHATLIBDIR;
} }
@ -441,7 +441,7 @@ plugin_get_libdir (void)
void void
plugin_auto_load (session *sess) plugin_auto_load (session *sess)
{ {
char *lib_dir; const char *lib_dir;
char *sub_dir; char *sub_dir;
ps = sess; ps = sess;

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)) 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'):

View File

@ -272,7 +272,8 @@ static const struct defaultserver def[] =
{"PonyChat", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {"PonyChat", 0, 0, 0, LOGIN_SASL, 0, TRUE},
{0, "irc.ponychat.net"}, {0, "irc.ponychat.net"},
{"PTNet.org", 0, 0, "ISO-8859-1"}, {"PTNet.org", 0},
/* Note that the network suggests ISO-8859-1 but most users ignore this */
{0, "uevora.ptnet.org"}, {0, "uevora.ptnet.org"},
{0, "vianetworks.ptnet.org"}, {0, "vianetworks.ptnet.org"},

View File

@ -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

View File

@ -634,7 +634,7 @@ break_while:
} }
void void
for_files (char *dirname, char *mask, void callback (char *file)) for_files (const char *dirname, const char *mask, void callback (char *file))
{ {
GDir *dir; GDir *dir;
const gchar *entry_name; const gchar *entry_name;

View File

@ -41,7 +41,7 @@ char *expand_homedir (char *file);
void path_part (char *file, char *path, int pathlen); void path_part (char *file, char *path, int pathlen);
int match (const char *mask, const char *string); int match (const char *mask, const char *string);
char *file_part (char *file); char *file_part (char *file);
void for_files (char *dirname, char *mask, void callback (char *file)); void for_files (const char *dirname, const char *mask, void callback (char *file));
int rfc_casecmp (const char *, const char *); int rfc_casecmp (const char *, const char *);
int rfc_ncasecmp (char *, char *, int); int rfc_ncasecmp (char *, char *, int);
int buf_get_line (char *, char **, int *, int len); int buf_get_line (char *, char **, int *, int len);

View File

@ -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, &noti, gtk_tree_model_get (
4, &ctcp, 5, &dcc, 6, &invi, 7, &unig, -1); model, iter,
CHAN_COLUMN, &chan,
PRIV_COLUMN, &priv,
NOTICE_COLUMN, &noti,
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);

View File

@ -2198,6 +2198,10 @@ servlist_open_networks (void)
g_signal_connect (G_OBJECT (entry_nick2), "changed", g_signal_connect (G_OBJECT (entry_nick2), "changed",
G_CALLBACK(servlist_nick_changed_cb), button_connect); G_CALLBACK(servlist_nick_changed_cb), button_connect);
/* Run validity checks now */
servlist_nick_changed_cb (GTK_ENTRY(entry_nick2), button_connect);
servlist_username_changed_cb (GTK_ENTRY(entry_guser), button_connect);
gtk_label_set_mnemonic_widget (GTK_LABEL (label3), entry1); gtk_label_set_mnemonic_widget (GTK_LABEL (label3), entry1);
gtk_label_set_mnemonic_widget (GTK_LABEL (label6), entry4); gtk_label_set_mnemonic_widget (GTK_LABEL (label6), entry4);
/* gtk_label_set_mnemonic_widget (GTK_LABEL (label7), entry5); */ /* gtk_label_set_mnemonic_widget (GTK_LABEL (label7), entry5); */

View File

@ -1 +1 @@
2.12.0 2.12.1-2