[ekg2-commit] r4103 - in trunk: ekg plugins/irc plugins/ncurses: trunk/ekg/protocol.c trunk/ekg/protocol.h trunk/ekg/themes.c trunk/ekg/windows.c trunk/ekg/windows.h trunk/plugins/irc/misc.c trunk/plugins/ncurses/old.c
SVN commit
svn w toxygen.net
Pon, 14 Lip 2008, 11:03:07 CEST
Author: wiechu
Date: 2008-07-14 11:03:06 +0200 (Mon, 14 Jul 2008)
New Revision: 4103
Modified:
trunk/ekg/protocol.c
trunk/ekg/protocol.h
trunk/ekg/themes.c
trunk/ekg/windows.c
trunk/ekg/windows.h
trunk/plugins/irc/misc.c
trunk/plugins/ncurses/old.c
Log:
Change window->act meaning.
Activity "not to us" in status bar.
Modified: trunk/ekg/protocol.c
===================================================================
--- trunk/ekg/protocol.c 2008-07-12 18:20:44 UTC (rev 4102)
+++ trunk/ekg/protocol.c 2008-07-14 09:03:06 UTC (rev 4103)
@@ -499,8 +499,13 @@
time_t now;
session_t *s = session_find(session);
struct conference *c = NULL;
- int empty_theme = 0, is_me = 0;
+ int empty_theme = 0, is_me = 0, to_me = 1, separate = 0;
+ if (class & EKG_MSGCLASS_NOT2US) {
+ to_me = 0;
+ class &= ~EKG_MSGCLASS_NOT2US;
+ }
+
if (class & EKG_NO_THEMEBIT) {
empty_theme = 1;
class &= ~EKG_NO_THEMEBIT;
@@ -688,19 +693,19 @@
if (secure)
securestr = format_string(format_find("secure"));
- print_window(target, s,
- ((class == EKG_MSGCLASS_LOG || class == EKG_MSGCLASS_SENT_LOG) ? 2
- : (class == EKG_MSGCLASS_CHAT || class == EKG_MSGCLASS_SENT_CHAT)
- || (!(config_make_window & 4) && (class == EKG_MSGCLASS_MESSAGE || class == EKG_MSGCLASS_SENT))),
- class_str,
- user,
- timestamp,
+ if (class == EKG_MSGCLASS_LOG || class == EKG_MSGCLASS_SENT_LOG)
+ separate = 2;
+ else if ( (class == EKG_MSGCLASS_CHAT || class == EKG_MSGCLASS_SENT_CHAT) ||
+ (!(config_make_window & 4) && (class == EKG_MSGCLASS_MESSAGE || class == EKG_MSGCLASS_SENT)) )
+ separate = to_me ? 4 : 1;
+
+ print_window(target, s, separate, class_str, user, timestamp,
(is_me ? text+4 : text),
/* XXX, get_uid() get_nickname() */
(class >= EKG_MSGCLASS_SENT ?
(is_me && config_me_nick ? config_me_nick : session_alias_uid(s))
: get_nickname(s, sender)),
- (class >= EKG_MSGCLASS_SENT ? s->uid : get_uid(s, sender)),
+ (class >= EKG_MSGCLASS_SENT ? s->uid : get_uid(s, sender)),
(secure ? securestr : ""));
xfree(text);
Modified: trunk/ekg/protocol.h
===================================================================
--- trunk/ekg/protocol.h 2008-07-12 18:20:44 UTC (rev 4102)
+++ trunk/ekg/protocol.h 2008-07-14 09:03:06 UTC (rev 4103)
@@ -69,6 +69,9 @@
EKG_MSGCLASS_CHAT, /* chat message */
EKG_MSGCLASS_SYSTEM, /* system message */
EKG_MSGCLASS_LOG, /* old logged message (used by logsqlite 'last_print_on_open') */
+
+ EKG_MSGCLASS_NOT2US = 16, /* message is not to us */
+
/* sent */
EKG_MSGCLASS_SENT = 32, /* single sent message */
EKG_MSGCLASS_SENT_CHAT, /* chat sent message */
Modified: trunk/ekg/themes.c
===================================================================
--- trunk/ekg/themes.c 2008-07-12 18:20:44 UTC (rev 4102)
+++ trunk/ekg/themes.c 2008-07-14 09:03:06 UTC (rev 4103)
@@ -699,6 +699,12 @@
* Common stuff for: print_window() and print_window_w()<br>
* Change w->act if needed, format theme, make fstring() and send everything to window_print()
*
+ * @param separate:
+ * 1 - EKG_MSGCLASS_MESSAGE || EKG_MSGCLASS_SENT
+ * 2 - EKG_MSGCLASS_LOG || EKG_MSGCLASS_SENT_LOG
+ * 4 - EKG_MSGCLASS_NOT2US
+ * 0 - other
+ *
* @note We only check if @a w == NULL, if you send here wrong window_t ptr, everything can happen. don't do it.
* Yeah, we can do here window_find_ptr() but it'll slow down code a lot.
*/
@@ -716,8 +722,8 @@
if (w != window_current && !w->floating && !(separate & 2)) {
int oldact = w->act;
if (separate)
- w->act = 2;
- else if (w->act != 2)
+ w->act |= (separate & 4) ? 3 : 2;
+ else if (!w->act)
w->act = 1;
if (oldact != w->act) /* emit UI_WINDOW_ACT_CHANGED only when w->act changed */
@@ -1164,10 +1170,12 @@
format_add("ncurses_prompt_query", "[%1] ", 1);
format_add("statusbar", " %c(%w%{time}%c)%w %c(%w%{?session %{?away %G}%{?avail %Y}%{?chat %W}%{?dnd %K}%{?xa %g}%{?invisible %C}%{?notavail %r}%{session}}%{?!session ---}%c) %{?window (%wwin%c/%w%{?typing %C}%{window}}%{?query %c:%W%{query}}%{?debug %c(%Cdebug}%c)%w%{?activity %c(%wact%c/%W}%{activity}%{?activity %c)%w}%{?mail %c(%wmail%c/%w}%{mail}%{?mail %c)}%{?more %c(%Gmore%c)}", 1);
format_add("header", " %{?query %c(%{?query_away %w}%{?query_avail %W}%{?query_invisible %K}%{?query_notavail %k}%{query}%{?query_descr %c/%w%{query_descr}}%c) %{?query_ip (%wip%c/%w%{query_ip}%c)} %{irctopic}}%{?!query %c(%wekg2%c/%w%{version}%c) (%w%{url}%c)}", 1);
- format_add("statusbar_act_important", "%W", 1);
+ format_add("statusbar_act_important", "%Y", 1);
+ format_add("statusbar_act_important2us", "%W", 1);
format_add("statusbar_act", "%K", 1);
format_add("statusbar_act_typing", "%c", 1);
format_add("statusbar_act_important_typing", "%C", 1);
+ format_add("statusbar_act_important2us_typing", "%C", 1);
format_add("statusbar_timestamp", "%H:%M", 1);
/* ui-password-input */
Modified: trunk/ekg/windows.c
===================================================================
--- trunk/ekg/windows.c 2008-07-12 18:20:44 UTC (rev 4102)
+++ trunk/ekg/windows.c 2008-07-14 09:03:06 UTC (rev 4103)
@@ -617,9 +617,9 @@
if (!xstrncasecmp(params[0], "active", par0_matchlen)) {
window_t *w;
- int a,id = 0;
+ int a, id = 0;
- for (a=2; !id && a>0; a--)
+ for (a=3; !id && a>0; a--)
for (w = windows; w; w = w->next) {
if ((w->act==a) && !w->floating && w->id) {
id = w->id;
Modified: trunk/ekg/windows.h
===================================================================
--- trunk/ekg/windows.h 2008-07-12 18:20:44 UTC (rev 4102)
+++ trunk/ekg/windows.h 2008-07-14 09:03:06 UTC (rev 4103)
@@ -54,7 +54,7 @@
unsigned short left, top; /* pozycja (x, y) względem początku ekranu */
unsigned short width, height; /* wymiary okna */
- unsigned int act : 2; /* activity: 1 - status/junk; 2 - msg */
+ unsigned int act : 2; /* activity: 1 - status/junk; 2 - msg ; 3 - msg to us */
unsigned int in_typing : 1; /* user is composing a message to us */
unsigned int in_active : 1; /* user has sent some kind of message,
so we can start sending composing to him/her */
Modified: trunk/plugins/irc/misc.c
===================================================================
--- trunk/plugins/irc/misc.c 2008-07-12 18:20:44 UTC (rev 4102)
+++ trunk/plugins/irc/misc.c 2008-07-14 09:03:06 UTC (rev 4103)
@@ -1157,6 +1157,8 @@
format = saprintf("irc_%s_f_chan%s%s", prv?"msg":"not",
(!w)?"":"_n", ekgbeep?"h":"");
+ if (!xosd_to_us)
+ class |= EKG_MSGCLASS_NOT2US;
/* ok new irc-find-person checked */
if ((person = irc_find_person(j->people, param[0]+1)))
Modified: trunk/plugins/ncurses/old.c
===================================================================
--- trunk/plugins/ncurses/old.c 2008-07-12 18:20:44 UTC (rev 4102)
+++ trunk/plugins/ncurses/old.c 2008-07-14 09:03:06 UTC (rev 4103)
@@ -1631,14 +1631,14 @@
window_t *w;
for (w = windows; w; w = w->next) {
- char tmp[33];
+ char tmp[36];
if ((!w->act && !w->in_typing) || !w->id || (w == window_current))
continue;
if (act)
string_append_c(s, ',');
- sprintf(tmp, "statusbar_act%s%s", (w->act == 2 ? "_important" : ""), (w->in_typing ? "_typing" : ""));
+ sprintf(tmp, "statusbar_act%s%s%s", (w->act > 1 ? "_important" : ""), (w->act > 2 ? "2us" : ""), (w->in_typing ? "_typing" : ""));
string_append(s, format_find(tmp));
string_append(s, itoa(w->id));
act = 1;
Więcej informacji o liście dyskusyjnej ekg2-commit