Your message dated Sat, 30 Jan 2016 18:16:42 +0000
with message-id <[email protected]>
and subject line Bug#811007: Removed package(s) from unstable
has caused the Debian Bug report #495742,
regarding xchat: patch for switch to tab with most recent activity
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
495742: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=495742
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: xchat
Version: 2.8.6-2
Severity: wishlist
Tags: patch

Hello! :-)

I tried to submit this patch to the xchat official forum one month ago
(http://forum.xchat.org/viewtopic.php?t=4268), but since then I have
received no reply. So I'm trying to have this patch applied at least in
the Debian package. :-)

This patch adds a (IMHO useful) feature to the "Change Page" keyboard
shortcut action. It allows the user to switch to the query/channel with
the most recent activity. irssi has a similar feature (triggered by
Alt-A). In decreasing priority, the candidate new session is looked for
in these categories:

- queries with hilight
- queries
- channels with hilight
- channels with messages
- channels with other data

The patch affects both the common/ subtree (adding a priority queue
where sessions are dynamically added when new events occur) and the
fe-gtk/ one (where the data from the priority queue is used to react to
the keyboard shortcut). Detached channels/queries are skipped (the
shortcut does not change the focus to a different window). I kept the
common/ part UI-unaware.

>From the user point of view, it's enough to add a new shortcut with
Change Page and Data 1 set to "auto". The default configuration has this
command assigned to Alt-` (which on US keyboards is just on the left of
the common Alt-[1-9] keys used for tab switching).

I also have a new Italian translation for the Change Page help text, but
I'm not sure which is the best method to submit that change. So I'm just
pasting here the new msgstr:

#: src/fe-gtk/fkeys.c:161
msgid ""
"The ^BChange Page^B command switches between pages in the notebook. Set Data 1 
"
"to the page you want to switch to. If Data 2 is set to anything then the "
"switch will be relative to the current position. Set Data 1 to auto to "
"switch to the page with the most recent and important activity (queries "
"first, then channels with hilight, channels with dialogue, channels with "
"other data)"
msgstr ""
"Il comando ^BChange Page^B cambia pagine. Imposta Data 1 alla pagina a cui 
vuoi "
"cambiare. Se Data 2 è impostata a qualcosa allora il cambio sarà relativo "
"alla posizione corrente. Imposta Data 1 a auto per andare alla pagina con "
"l'attività piú recente e importante (prima i messaggi privati, poi i "
"canali con messaggi evidenziati, poi i canali con messaggi, poi i canali con "
"altri dati)"

Thanks :-)

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.25-ripieno (PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages xchat depends on:
ii  libatk1.0-0            1.22.0-1          The ATK accessibility toolkit
ii  libc6                  2.7-12            GNU C Library: Shared libraries
ii  libcairo2              1.6.4-6           The Cairo 2D vector graphics libra
ii  libdbus-1-3            1.2.1-2           simple interprocess messaging syst
ii  libdbus-glib-1-2       0.76-1            simple interprocess messaging syst
ii  libfontconfig1         2.6.0-1           generic font configuration library
ii  libfreetype6           2.3.7-1           FreeType 2 font engine, shared lib
ii  libglib2.0-0           2.16.4-1          The GLib library of C routines
ii  libgtk2.0-0            2.12.11-1         The GTK+ graphical user interface 
ii  libpango1.0-0          1.20.5-1          Layout and rendering of internatio
ii  libperl5.10            5.10.0-11         Shared Perl library
ii  libpixman-1-0          0.10.0-2          pixel-manipulation library for X a
ii  libpng12-0             1.2.27-1          PNG library - runtime
ii  libsexy2               0.1.11-2          collection of additional GTK+ widg
ii  libssl0.9.8            0.9.8g-11         SSL shared libraries
ii  libx11-6               2:1.1.4-2         X11 client-side library
ii  libxcb-render-util0    0.2+git36-1       utility libraries for X C Binding 
ii  libxcb-render0         1.1-1.1           X C Binding, render extension
ii  libxcb1                1.1-1.1           X C Binding
ii  libxcursor1            1:1.1.9-1         X cursor management library
ii  libxext6               2:1.0.4-1         X11 miscellaneous extension librar
ii  libxfixes3             1:4.0.3-2         X11 miscellaneous 'fixes' extensio
ii  libxi6                 2:1.1.3-1         X11 Input extension library
ii  libxinerama1           2:1.0.3-2         X11 Xinerama extension library
ii  libxml2                2.6.32.dfsg-2     GNOME XML library
ii  libxrandr2             2:1.2.3-1         X11 RandR extension library
ii  libxrender1            1:0.9.4-2         X Rendering Extension client libra
ii  python2.5              2.5.2-7           An interactive high-level object-o
ii  tcl8.4                 8.4.19-2          Tcl (the Tool Command Language) v8
ii  xchat-common           2.8.6-2           Common files for X-Chat
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library - runtime

Versions of packages xchat recommends:
ii  libnotify-bin                 0.4.4-3    sends desktop notifications to a n
ii  libnotify1                    0.4.4-3    sends desktop notifications to a n
ii  xdg-utils                     1.0.2-6    desktop integration utilities from

-- no debconf information

Ludovico
-- 
<[email protected]>        #acheronte (irc.freenode.net) ICQ: 64483080
GPG ID: 07F89BB8          Jabber: [email protected] Yahoo: gardenghelle
-- This is signature nr. 4213
diff -paur xchat2.orig/src/common/inbound.c xchat2/src/common/inbound.c
--- xchat2.orig/src/common/inbound.c	2008-07-20 17:31:44.898468115 +0200
+++ xchat2/src/common/inbound.c	2008-07-19 19:57:09.799906780 +0200
@@ -297,7 +297,10 @@ is_hilight (char *from, char *text, sess
 	{
 		g_free (text);
 		if (sess != current_tab)
+		{
 			sess->nick_said = TRUE;
+			lastact_update(sess);
+		}
 		fe_set_hilight (sess);
 		return 1;
 	}
@@ -344,6 +347,7 @@ inbound_action (session *sess, char *cha
 			sess->msg_said = TRUE;
 			sess->new_data = FALSE;
 		}
+		lastact_update(sess);
 	}
 
 	user = userlist_find (sess, from);
@@ -395,6 +399,7 @@ inbound_chanmsg (server *serv, session *
 	{
 		sess->msg_said = TRUE;
 		sess->new_data = FALSE;
+		lastact_update(sess);
 	}
 
 	user = userlist_find (sess, from);
diff -paur xchat2.orig/src/common/xchat.c xchat2/src/common/xchat.c
--- xchat2.orig/src/common/xchat.c	2008-07-20 17:31:44.900468825 +0200
+++ xchat2/src/common/xchat.c	2008-07-20 17:33:57.089468218 +0200
@@ -71,6 +71,23 @@ GSList *usermenu_list = 0;
 GSList *urlhandler_list = 0;
 GSList *tabmenu_list = 0;
 
+/*
+ * This array contains 5 double linked lists, one for each priority in the
+ * "interesting session" queue ("channel" stands for everything but
+ * SESS_DIALOG):
+ *
+ * [0] queries with hilight
+ * [1] queries
+ * [2] channels with hilight
+ * [3] channels with dialogue
+ * [4] channels with other data
+ *
+ * Each time activity happens the corresponding session is put at the
+ * beginning of one of the lists.  The aim is to be able to switch to the
+ * session with the most important/recent activity.
+ */
+GList *sess_list_by_lastact[5] = {NULL, NULL, NULL, NULL, NULL};
+
 static int in_xchat_exit = FALSE;
 int xchat_is_quitting = FALSE;
 /* command-line args */
@@ -93,6 +110,105 @@ struct xchatprefs prefs;
 SSL_CTX *ctx = NULL;
 #endif
 
+/*
+ * Update the priority queue of the "interesting sessions"
+ * (sess_list_by_lastact).
+ */
+void
+lastact_update(session *sess)
+{
+	int newidx;
+
+	/* Find the priority (for the order see before) */
+	if (sess->type == SESS_DIALOG)
+	{
+		if (sess->nick_said)
+			newidx = LACT_QUERY_HI;
+		else if (sess->msg_said)
+			newidx = LACT_QUERY;
+		else if (sess->new_data)
+			newidx = LACT_QUERY;
+		else
+			newidx = LACT_NONE;
+	}
+	else
+	{
+		if (sess->nick_said)
+			newidx = LACT_CHAN_HI;
+		else if (sess->msg_said)
+			newidx = LACT_CHAN;
+		else if (sess->new_data)
+			newidx = LACT_CHAN_DATA;
+		else
+			newidx = LACT_NONE;
+	}
+
+	/* Check if this update is a no-op */
+	if (sess->lastact_idx == newidx && 
+			((newidx != LACT_NONE && sess->lastact_elem == sess_list_by_lastact[newidx]) ||
+			 (newidx == LACT_NONE)))
+		return;
+
+	/* Remove from the old position (and, if no new position, return */
+	else if (sess->lastact_idx != LACT_NONE && sess->lastact_elem)
+	{
+		sess_list_by_lastact[sess->lastact_idx] = g_list_remove_link(
+				sess_list_by_lastact[sess->lastact_idx],
+				sess->lastact_elem);
+		if (newidx == LACT_NONE)
+		{
+			sess->lastact_idx = newidx;
+			return;
+		}
+	}
+
+	/* No previous position, allocate new */
+	else if (!sess->lastact_elem)
+		sess->lastact_elem = g_list_prepend(sess->lastact_elem, sess);
+
+	sess->lastact_idx = newidx;
+	sess_list_by_lastact[newidx] = g_list_concat(
+			sess->lastact_elem, sess_list_by_lastact[newidx]);
+}
+
+/*
+ * Extract the first session from the priority queue of sessions with recent
+ * activity. Return NULL if no such session can be found.
+ *
+ * If filter is specified, skip a session if filter(session) returns 0. This
+ * can be used for UI-specific needs, e.g. in fe-gtk we want to filter out
+ * detached sessions.
+ */
+session *
+lastact_getfirst(int (*filter) (session *sess))
+{
+	int i;
+	session *sess = NULL;
+	GList *curitem;
+
+	/* 5 is the number of priority classes LACT_ */
+	for (i = 0; i < 5 && !sess; i++)
+	{
+		curitem = sess_list_by_lastact[i];
+		while (curitem && !sess)
+		{
+			sess = g_list_nth_data(curitem, 0);
+			if (!sess || (filter && !filter(sess)))
+			{
+				sess = NULL;
+				curitem = g_list_next(curitem);
+			}
+		}
+
+		if (sess)
+		{
+			sess_list_by_lastact[i] = g_list_remove_link(sess_list_by_lastact[i], curitem);
+			sess->lastact_idx = LACT_NONE;
+		}
+	}
+	
+	return sess;
+}
 
 int
 is_session (session * sess)
@@ -362,6 +478,9 @@ session_new (server *serv, char *from, i
 
 	sess_list = g_slist_prepend (sess_list, sess);
 
+	sess->lastact_elem = NULL;
+	sess->lastact_idx = LACT_NONE;
+
 	fe_new_window (sess, focus);
 
 	return sess;
@@ -533,6 +652,16 @@ session_free (session *killsess)
 			current_sess = sess_list->data;
 	}
 
+	if (killsess->lastact_elem)
+	{
+		if (killsess->lastact_idx != LACT_NONE)
+			sess_list_by_lastact[killsess->lastact_idx] = g_list_delete_link(
+					sess_list_by_lastact[killsess->lastact_idx],
+					killsess->lastact_elem);
+		else
+			g_list_free_1(killsess->lastact_elem);
+	}
+
 	free (killsess);
 
 	if (!sess_list && !in_xchat_exit)
diff -paur xchat2.orig/src/common/xchat.h xchat2/src/common/xchat.h
--- xchat2.orig/src/common/xchat.h	2008-07-20 17:31:44.901467675 +0200
+++ xchat2/src/common/xchat.h	2008-07-20 17:33:28.240467970 +0200
@@ -320,6 +320,15 @@ struct xchatprefs
 #define SET_ON 1
 #define SET_DEFAULT 2 /* use global setting */
 
+/* Priorities in the "interesting sessions" priority queue
+ * (see xchat.c:sess_list_by_lastact) */
+#define LACT_NONE		-1		/* no queues */
+#define LACT_QUERY_HI	0		/* query with hilight */
+#define LACT_QUERY		1		/* query with messages */
+#define LACT_CHAN_HI	2		/* channel with hilight */
+#define LACT_CHAN		3		/* channel with messages */
+#define LACT_CHAN_DATA	4		/* channel with other data */
+
 typedef struct session
 {
 	/* Per-Channel Alerts */
@@ -369,6 +378,10 @@ typedef struct session
 
 	int type;					/* SESS_* */
 
+	GList *lastact_elem;	/* our GList element in sess_list_by_lastact */
+	int lastact_idx;		/* the sess_list_by_lastact[] index of the list we're in.
+							 * For valid values, see defines of LACT_*. */
+
 	int new_data:1;			/* new data avail? (purple tab) */
 	int nick_said:1;		/* your nick mentioned? (blue tab) */
 	int msg_said:1;			/* new msg available? (red tab) */
diff -paur xchat2.orig/src/common/xchatc.h xchat2/src/common/xchatc.h
--- xchat2.orig/src/common/xchatc.h	2008-07-20 17:31:44.901467675 +0200
+++ xchat2/src/common/xchatc.h	2008-07-20 11:43:36.673967630 +0200
@@ -25,10 +25,13 @@ extern GSList *ignore_list;
 extern GSList *usermenu_list;
 extern GSList *urlhandler_list;
 extern GSList *tabmenu_list;
+extern GList *sess_list_by_lastact[];
 
 session * find_channel (server *serv, char *chan);
 session * find_dialog (server *serv, char *nick);
 session * new_ircwindow (server *serv, char *name, int type, int focus);
+void lastact_update (session * sess);
+session * lastact_getfirst (int (*filter) (session *sess));
 int is_session (session * sess);
 void session_free (session *killsess);
 void lag_check (void);
diff -paur xchat2.orig/src/fe-gtk/fe-gtk.c xchat2/src/fe-gtk/fe-gtk.c
--- xchat2.orig/src/fe-gtk/fe-gtk.c	2008-07-20 17:31:44.958466232 +0200
+++ xchat2/src/fe-gtk/fe-gtk.c	2008-07-19 19:58:57.431961788 +0200
@@ -603,6 +603,7 @@ fe_print_text (struct session *sess, cha
 		 sess->gui->is_tab && !sess->nick_said && stamp == 0)
 	{
 		sess->new_data = TRUE;
+		lastact_update(sess);
 		if (sess->msg_said)
 			fe_set_tab_color (sess, 2);
 		else
diff -paur xchat2.orig/src/fe-gtk/fkeys.c xchat2/src/fe-gtk/fkeys.c
--- xchat2.orig/src/fe-gtk/fkeys.c	2008-07-20 17:31:44.960465847 +0200
+++ xchat2/src/fe-gtk/fkeys.c	2008-07-20 12:20:50.186930065 +0200
@@ -158,7 +158,7 @@ static const struct key_action key_actio
 	{key_action_handle_command, "Run Command",
 	 N_("The \002Run Command\002 action runs the data in Data 1 as if it has been typed into the entry box where you pressed the key sequence. Thus it can contain text (which will be sent to the channel/person), commands or user commands. When run all \002\\n\002 characters in Data 1 are used to deliminate seperate commands so it is possible to run more than one command. If you want a \002\\\002 in the actual text run then enter \002\\\\\002")},
 	{key_action_page_switch, "Change Page",
-	 N_("The \002Change Page\002 command switches between pages in the notebook. Set Data 1 to the page you want to switch to. If Data 2 is set to anything then the switch will be relative to the current position")},
+	 N_("The \002Change Page\002 command switches between pages in the notebook. Set Data 1 to the page you want to switch to. If Data 2 is set to anything then the switch will be relative to the current position. Set Data 1 to auto to switch to the page with the most recent and important activity (queries first, then channels with hilight, channels with dialogue, channels with other data)")},
 	{key_action_insert, "Insert in Buffer",
 	 N_("The \002Insert in Buffer\002 command will insert the contents of Data 1 into the entry where the key sequence was pressed at the current cursor position")},
 	{key_action_scroll_page, "Scroll Page",
@@ -402,6 +402,7 @@ key_load_defaults ()
 		"A\n3\nChange Page\nD1:3\nD2!\n\n"\
 		"A\n2\nChange Page\nD1:2\nD2!\n\n"\
 		"A\n1\nChange Page\nD1:1\nD2!\n\n"\
+		"A\ngrave\nChange Page\nD1:auto\nD2!\n\n"\
 		"C\no\nInsert in Buffer\nD1:\nD2!\n\n"\
 		"C\nb\nInsert in Buffer\nD1:\nD2!\n\n"\
 		"C\nk\nInsert in Buffer\nD1:\nD2!\n\n"\
@@ -1196,6 +1197,20 @@ key_action_handle_command (GtkWidget * w
 	return 0;
 }
 
+/*
+ * Check if the given session is inside the main window. This predicate
+ * is passed to lastact_pop as a way to filter out detached sessions.
+ * XXX: Consider moving this in a different file?
+ */
+static int
+session_check_is_tab(session *sess)
+{
+	if (!sess || !sess->gui)
+		return FALSE;
+
+	return (sess->gui->is_tab);
+}
+
 static int
 key_action_page_switch (GtkWidget * wid, GdkEventKey * evt, char *d1,
 								char *d2, struct session *sess)
@@ -1209,6 +1224,30 @@ key_action_page_switch (GtkWidget * wid,
 	if (!len)
 		return 1;
 
+	if (strcasecmp(d1, "auto") == 0)
+	{
+		/* Auto switch makes no sense in detached sessions */
+		if (!sess->gui->is_tab)
+			return 1;
+
+		/* Obtain a session with recent activity */
+		session *newsess = lastact_getfirst(session_check_is_tab);
+
+		if (newsess)
+		{
+			/*
+			 * Only sessions in the current window should be considered (i.e.
+			 * we don't want to move the focus on a different window). This
+			 * call could, in theory, do this, but we checked before that
+			 * newsess->gui->is_tab and sess->gui->is_tab.
+			 */
+			mg_bring_tofront_sess(newsess);
+			return 0;
+		}
+		else
+			return 1;
+	}
+
 	for (i = 0; i < len; i++)
 	{
 		if (d1[i] < '0' || d1[i] > '9')
diff -paur xchat2.orig/src/fe-gtk/maingui.c xchat2/src/fe-gtk/maingui.c
--- xchat2.orig/src/fe-gtk/maingui.c	2008-07-20 17:31:44.964469466 +0200
+++ xchat2/src/fe-gtk/maingui.c	2008-07-19 19:58:58.255909127 +0200
@@ -359,6 +359,7 @@ fe_set_tab_color (struct session *sess, 
 				
 			break;
 		}
+		lastact_update(sess);
 	}
 }
 
@@ -643,6 +644,7 @@ mg_focus (session *sess)
 		sess->nick_said = FALSE;
 		sess->msg_said = FALSE;
 		sess->new_data = FALSE;
+		lastact_update(sess);
 		/* when called via mg_changui_new, is_tab might be true, but
 			sess->res->tab is still NULL. */
 		if (sess->res->tab)

--- End Message ---
--- Begin Message ---
Version: 2.8.8-7.3+rm

Dear submitter,

as the package xchat has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/811007

The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
[email protected].

Debian distribution maintenance software
pp.
Scott Kitterman (the ftpmaster behind the curtain)

--- End Message ---

Reply via email to