[ekg2-commit] r3740 - trunk/ekg: trunk/ekg/commands.c trunk/ekg/ekg.c trunk/ekg/metacontacts.c trunk/ekg/protocol.c trunk/ekg/stuff.c
SVN commit
svn w toxygen.net
Wto, 5 Lut 2008, 21:37:42 CET
Author: peres
Date: 2008-02-05 21:37:42 +0100 (Tue, 05 Feb 2008)
New Revision: 3740
Modified:
trunk/ekg/commands.c
trunk/ekg/ekg.c
trunk/ekg/metacontacts.c
trunk/ekg/protocol.c
trunk/ekg/stuff.c
Log:
- replacing most of status range comparisons with macros EKG_STATUS_IS*,
- small autoaw/xa fix (I think that there were a bug, but not sure),
- display_notify==2 update (thanks to Wieslaw Ochminski for reminder).
Modified: trunk/ekg/commands.c
===================================================================
--- trunk/ekg/commands.c 2008-02-05 13:02:29 UTC (rev 3739)
+++ trunk/ekg/commands.c 2008-02-05 20:37:42 UTC (rev 3740)
@@ -243,8 +243,8 @@
u = userlist_find(session, send_nicks[i]);
/* I think we should also remove errors and likes here
- * if I'm wrong, change the > to == */
- if (!u || (u->status > EKG_STATUS_NA))
+ * if I'm wrong, change the macro to comparison */
+ if (!u || !EKG_STATUS_IS_NA(u->status))
continue;
tabnick_remove(send_nicks[i]);
@@ -1471,7 +1471,7 @@
printq("user_info_nickname", u->nickname);
printq("user_info_status", status);
- if (u->status_time && (u->status <= EKG_STATUS_NA)) {
+ if (u->status_time && EKG_STATUS_IS_NA(u->status)) {
struct tm *status_time;
char buf[100];
@@ -1515,7 +1515,7 @@
printq("user_info_groups", groups);
xfree(groups);
}
- if (u->status <= EKG_STATUS_NA) {
+ if (EKG_STATUS_IS_NA(u->status)) {
char buf[100];
struct tm *last_seen_time;
Modified: trunk/ekg/ekg.c
===================================================================
--- trunk/ekg/ekg.c 2008-02-05 13:02:29 UTC (rev 3739)
+++ trunk/ekg/ekg.c 2008-02-05 20:37:42 UTC (rev 3740)
@@ -173,7 +173,7 @@
session_t *s = l->data;
int tmp;
- if (!s->connected || (s->status < EKG_STATUS_AWAY))
+ if (!s->connected || (s->status < EKG_STATUS_XA))
continue;
do {
Modified: trunk/ekg/metacontacts.c
===================================================================
--- trunk/ekg/metacontacts.c 2008-02-05 13:02:29 UTC (rev 3739)
+++ trunk/ekg/metacontacts.c 2008-02-05 20:37:42 UTC (rev 3740)
@@ -515,8 +515,8 @@
{
/* hardly simplified that, XXX could you check it?
* additional todo: use state priorities? */
- const int last_na = (last->status <= EKG_STATUS_NA);
- const int u_na = (u->status <= EKG_STATUS_NA);
+ const int last_na = EKG_STATUS_IS_NA(last->status);
+ const int u_na = EKG_STATUS_IS_NA(u->status);
if (((last_na == u_na) && ret->prio < i->prio) || (last_na && !u_na)) {
ret = i;
Modified: trunk/ekg/protocol.c
===================================================================
--- trunk/ekg/protocol.c 2008-02-05 13:02:29 UTC (rev 3739)
+++ trunk/ekg/protocol.c 2008-02-05 20:37:42 UTC (rev 3740)
@@ -325,17 +325,17 @@
return 0;
/* jeśli ktoś nam znika, zapamiętajmy kiedy go widziano */
- if (!u->resources && (u->status > EKG_STATUS_NA) && (status <= EKG_STATUS_NA))
+ if (!u->resources && !EKG_STATUS_IS_NA(u->status) && EKG_STATUS_IS_NA(status))
u->last_seen = when ? when : time(NULL);
/* XXX dodać events_delay */
/* jeśli dostępny lub zajęty, dopisz to taba. jeśli niedostępny, usuń */
- if ((status >= EKG_STATUS_AVAIL) && config_completion_notify && u->nickname)
+ if (EKG_STATUS_IS_AVAIL(status) && config_completion_notify && u->nickname)
tabnick_add(u->nickname);
- if ((status > EKG_STATUS_NA) && (status < EKG_STATUS_AVAIL) /* == aways */ && (config_completion_notify & 4) && u->nickname)
+ if (!EKG_STATUS_IS_AWAY(status) && (config_completion_notify & 4) && u->nickname)
tabnick_add(u->nickname);
- if ((status < EKG_STATUS_NA) && (config_completion_notify & 2) && u->nickname)
+ if (EKG_STATUS_IS_NA(status) && (config_completion_notify & 2) && u->nickname)
tabnick_remove(u->nickname);
@@ -346,16 +346,10 @@
* wartość 2 wyświetla tylko zmiany z niedostępnego na dostępny i na odwrót.
*/
- if ((sess_notify == -1 ? config_display_notify : sess_notify) & 2) {
- /* jeśli na zajęty, ignorujemy */
- if (st == EKG_STATUS_AWAY)
- goto notify_plugins;
+ if (((sess_notify == -1 ? config_display_notify : sess_notify) & 2)
+ && !(EKG_STATUS_IS_NA(st) ^ EKG_STATUS_IS_NA(status)))
+ goto notify_plugins;
- /* jeśli na dostępny, ignorujemy */
- if (st == EKG_STATUS_AVAIL)
- goto notify_plugins;
- }
-
/* ignorowanie statusu - nie wyświetlamy, ale pluginy niech robią co chcą */
if (ignore_status)
goto notify_plugins;
@@ -383,13 +377,13 @@
}
notify_plugins:
- if (st > EKG_STATUS_NA) {
+ if (!EKG_STATUS_IS_NA(st)) {
u->last_status = st;
xfree(u->last_descr);
u->last_descr = xstrdup(de);
}
- if ((st <= EKG_STATUS_NA) && (status > EKG_STATUS_NA) && !ignore_events)
+ if (EKG_STATUS_IS_NA(st) && !EKG_STATUS_IS_NA(status) && !ignore_events)
query_emit_id(NULL, EVENT_ONLINE, __session, __uid);
if (!ignore_status) {
@@ -432,11 +426,11 @@
* EVENT_AWAY for away&xa&dnd
* ... */
if (!ignore_events) {
- if (status >= EKG_STATUS_AVAIL)
+ if (EKG_STATUS_IS_AVAIL(status))
query_emit_id(NULL, EVENT_AVAIL, __session, __uid);
- else if (status > EKG_STATUS_NA)
+ else if (EKG_STATUS_IS_AWAY(status))
query_emit_id(NULL, EVENT_AWAY, __session, __uid);
- else if (status <= EKG_STATUS_NA)
+ else if (EKG_STATUS_IS_NA(status))
query_emit_id(NULL, EVENT_NA, __session, __uid);
}
Modified: trunk/ekg/stuff.c
===================================================================
--- trunk/ekg/stuff.c 2008-02-05 13:02:29 UTC (rev 3739)
+++ trunk/ekg/stuff.c 2008-02-05 20:37:42 UTC (rev 3740)
@@ -2486,7 +2486,7 @@
char var[100];
variable_t *v;
- if (status <= EKG_STATUS_NA) {
+ if (EKG_STATUS_IS_NA(status)) { /* or maybe == NA ? */
xstrcpy(var, ("quit_reason"));
xstrcpy(file, "quit.reasons");
} else if (status == EKG_STATUS_AVAIL) {
Więcej informacji o liście dyskusyjnej ekg2-commit