Fix messages with server-time not showing as new activity

Added a parameter to fe_print_text() to say that the message does not represent
new activity. This is used when a log from an old session is loaded. This used
to be implicit whenever the timestamp was non-zero, but with server-time this no
longer makes sense.

Fixes issue #746.
This commit is contained in:
Diogo Sousa 2013-10-08 23:59:36 +01:00 committed by TingPing
parent 111a58f1ef
commit 5ad9552365
4 changed files with 15 additions and 11 deletions

View File

@ -86,7 +86,8 @@ void fe_text_clear (struct session *sess, int lines);
void fe_close_window (struct session *sess); void fe_close_window (struct session *sess);
void fe_progressbar_start (struct session *sess); void fe_progressbar_start (struct session *sess);
void fe_progressbar_end (struct server *serv); void fe_progressbar_end (struct server *serv);
void fe_print_text (struct session *sess, char *text, time_t stamp); void fe_print_text (struct session *sess, char *text, time_t stamp,
gboolean no_activity);
void fe_userlist_insert (struct session *sess, struct User *newuser, int row, int sel); void fe_userlist_insert (struct session *sess, struct User *newuser, int row, int sel);
int fe_userlist_remove (struct session *sess, struct User *user); int fe_userlist_remove (struct session *sess, struct User *user);
void fe_userlist_rehash (struct session *sess, struct User *user); void fe_userlist_rehash (struct session *sess, struct User *user);

View File

@ -314,7 +314,7 @@ scrollback_load (session *sess)
text = strip_color (text + 1, -1, STRIP_COLOR); text = strip_color (text + 1, -1, STRIP_COLOR);
} }
fe_print_text (sess, text, stamp); fe_print_text (sess, text, stamp, TRUE);
if (prefs.hex_text_stripcolor_replay) if (prefs.hex_text_stripcolor_replay)
{ {
@ -340,7 +340,7 @@ scrollback_load (session *sess)
text = ctime (&stamp); text = ctime (&stamp);
text[24] = 0; /* get rid of the \n */ text[24] = 0; /* get rid of the \n */
buf = g_strdup_printf ("\n*\t%s %s\n\n", _("Loaded log from"), text); buf = g_strdup_printf ("\n*\t%s %s\n\n", _("Loaded log from"), text);
fe_print_text (sess, buf, 0); fe_print_text (sess, buf, 0, TRUE);
g_free (buf); g_free (buf);
/*EMIT_SIGNAL (XP_TE_GENMSG, sess, "*", buf, NULL, NULL, NULL, 0);*/ /*EMIT_SIGNAL (XP_TE_GENMSG, sess, "*", buf, NULL, NULL, NULL, 0);*/
} }
@ -895,7 +895,7 @@ PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
log_write (sess, text); log_write (sess, text);
scrollback_save (sess, text); scrollback_save (sess, text);
fe_print_text (sess, text, timestamp); fe_print_text (sess, text, timestamp, FALSE);
if (conv) if (conv)
g_free (conv); g_free (conv);

View File

@ -607,12 +607,13 @@ fe_progressbar_end (server *serv)
} }
void void
fe_print_text (struct session *sess, char *text, time_t stamp) fe_print_text (struct session *sess, char *text, time_t stamp,
gboolean no_activity)
{ {
PrintTextRaw (sess->res->buffer, (unsigned char *)text, prefs.hex_text_indent, stamp); PrintTextRaw (sess->res->buffer, (unsigned char *)text, prefs.hex_text_indent, stamp);
if (!sess->new_data && sess != current_tab && if (!no_activity && !sess->new_data && sess != current_tab &&
sess->gui->is_tab && !sess->nick_said && stamp == 0) sess->gui->is_tab && !sess->nick_said)
{ {
sess->new_data = TRUE; sess->new_data = TRUE;
lastact_update (sess); lastact_update (sess);

View File

@ -99,7 +99,7 @@ fe_new_window (struct session *sess, int focus)
" \017This binary compiled \00310"__DATE__"\017\n", " \017This binary compiled \00310"__DATE__"\017\n",
get_sys_str (1), get_sys_str (1),
glib_major_version, glib_minor_version, glib_micro_version); glib_major_version, glib_minor_version, glib_micro_version);
fe_print_text (sess, buf, 0); fe_print_text (sess, buf, 0, FALSE);
fe_print_text (sess, "\n\nCompiled in Features\0032:\017 " fe_print_text (sess, "\n\nCompiled in Features\0032:\017 "
#ifdef USE_PLUGIN #ifdef USE_PLUGIN
@ -114,7 +114,7 @@ fe_new_window (struct session *sess, int focus)
#ifdef USE_IPV6 #ifdef USE_IPV6
"IPv6" "IPv6"
#endif #endif
"\n\n", 0); "\n\n", 0, FALSE);
fflush (stdout); fflush (stdout);
} }
@ -144,7 +144,8 @@ timecat (char *buf, time_t stamp)
static const short colconv[] = { 0, 7, 4, 2, 1, 3, 5, 11, 13, 12, 6, 16, 14, 15, 10, 7 }; static const short colconv[] = { 0, 7, 4, 2, 1, 3, 5, 11, 13, 12, 6, 16, 14, 15, 10, 7 };
void void
fe_print_text (struct session *sess, char *text, time_t stamp) fe_print_text (struct session *sess, char *text, time_t stamp,
gboolean no_activity)
{ {
int dotime = FALSE; int dotime = FALSE;
char num[8]; char num[8];
@ -312,7 +313,8 @@ fe_print_text (struct session *sess, char *text, time_t stamp)
#else #else
/* The win32 version for cmd.exe */ /* The win32 version for cmd.exe */
void void
fe_print_text (struct session *sess, char *text, time_t stamp) fe_print_text (struct session *sess, char *text, time_t stamp,
gboolean no_activity)
{ {
int dotime = FALSE; int dotime = FALSE;
int comma, k, i = 0, j = 0, len = strlen (text); int comma, k, i = 0, j = 0, len = strlen (text);