[ekg2-commit] ekg2: contacts.c (HEAD) contacts.h (HEAD) main.c (HEAD) vars-pl.txt (HEAD) [peres]
CVS commit
cvs w toxygen.net
Pon, 22 Paź 2007, 17:21:32 CEST
Module name: ekg2
Changes by: peres 2007-10-22 17:21:29
Modified files:
contacts.c contacts.h main.c vars-pl.txt
Log message:
Breaking up ncurses:contacts_options into separate variables.
TODO: update english help.
Index: contacts.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/contacts.c,v
diff -d -u -r1.82 -r1.83
--- contacts.c 1 Sep 2007 21:51:15 -0000 1.82
+++ contacts.c 22 Oct 2007 15:21:29 -0000 1.83
@@ -55,9 +55,9 @@
static int contacts_frame = WF_LEFT;
static int contacts_descr = 0;
static int contacts_wrap = 0;
-#define CONTACTS_ORDER_DEFAULT "chavawxadninnoer" /* if you modify it, please modify also CONTACTS_ORDER_DEFAULT_LEN */
-#define CONTACTS_ORDER_DEFAULT_LEN 16 /* CONTACTS_ORDER_DEFAULT_LEN == strlen(CONTACTS_ORDER_DEFAULT) */
-static char contacts_order[100] = CONTACTS_ORDER_DEFAULT;
+#define CONTACTS_ORDER_DEFAULT "chavawxadninnouner" /* if you modify it, please modify also CONTACTS_ORDER_DEFAULT_LEN */
+#define CONTACTS_ORDER_DEFAULT_LEN 18 /* CONTACTS_ORDER_DEFAULT_LEN == strlen(CONTACTS_ORDER_DEFAULT) */
+static char contacts_order[32] = CONTACTS_ORDER_DEFAULT;
static int contacts_nosort = 0;
static size_t corderlen = CONTACTS_ORDER_DEFAULT_LEN; /* it must be always equal xstrlen(contacts_order) XXX please note if you add somewhere code which modify contacts_order */
@@ -67,7 +67,13 @@
int config_contacts_size;
int config_contacts;
int config_contacts_groups_all_sessions;
-char *config_contacts_options;
+int config_contacts_descr;
+int config_contacts_edge;
+int config_contacts_frame;
+int config_contacts_margin;
+int config_contacts_orderbystate;
+int config_contacts_wrap;
+char *config_contacts_order;
char *config_contacts_groups;
int config_contacts_metacontacts_swallow;
@@ -630,86 +636,25 @@
if (config_contacts_size > 1000)
config_contacts_size = 1000;
- contacts_margin = 1;
- contacts_edge = WF_RIGHT;
- contacts_frame = WF_LEFT;
+ if (config_contacts_margin > 10)
+ config_contacts_margin = 10;
+ contacts_margin = config_contacts_margin;
+ if (config_contacts_edge > 3)
+ config_contacts_edge = 2;
+ contacts_edge = (1 << config_contacts_edge);
+ contacts_frame = (!config_contacts_frame ? 0
+ : contacts_edge & (WF_LEFT|WF_RIGHT) ? contacts_edge ^ (WF_LEFT|WF_RIGHT)
+ : contacts_edge ^ (WF_TOP|WF_BOTTOM));
xstrcpy(contacts_order, CONTACTS_ORDER_DEFAULT); corderlen = CONTACTS_ORDER_DEFAULT_LEN; /* xstrlen(CONTACTS_ORDER_DEFAULT) eq CONTACTS_ORDER_DEFAULT_LEN */
- contacts_wrap = 0;
- contacts_descr = 0;
- contacts_nosort = 0;
-
- if (config_contacts_options) {
- char **args = array_make(config_contacts_options, " \t,", 0, 1, 1);
- int i;
-
- for (i = 0; args[i]; i++) {
- if (!xstrcasecmp(args[i], "left")) {
- contacts_edge = WF_LEFT;
- if (contacts_frame)
- contacts_frame = WF_RIGHT;
- }
-
- else if (!xstrcasecmp(args[i], "right")) {
- contacts_edge = WF_RIGHT;
- if (contacts_frame)
- contacts_frame = WF_LEFT;
- }
-
- else if (!xstrcasecmp(args[i], "top")) {
- contacts_edge = WF_TOP;
- if (contacts_frame)
- contacts_frame = WF_BOTTOM;
- }
-
- else if (!xstrcasecmp(args[i], "bottom")) {
- contacts_edge = WF_BOTTOM;
- if (contacts_frame)
- contacts_frame = WF_TOP;
- }
-
- else if (!xstrcasecmp(args[i], "noframe"))
- contacts_frame = 0;
-
- else if (!xstrcasecmp(args[i], "frame")) {
- switch (contacts_edge) {
- case WF_TOP: contacts_frame = WF_BOTTOM; break;
- case WF_BOTTOM: contacts_frame = WF_TOP; break;
- case WF_LEFT: contacts_frame = WF_RIGHT; break;
- case WF_RIGHT: contacts_frame = WF_LEFT; break;
- }
- }
-
- else if (!xstrncasecmp(args[i], "margin=", 7)) {
- contacts_margin = atoi(args[i] + 7);
- if (contacts_margin > 10)
- contacts_margin = 10;
- if (contacts_margin < 0)
- contacts_margin = 0;
- }
-
- else if (!xstrcasecmp(args[i], "nomargin")) contacts_margin = 0;
-
- else if (!xstrcasecmp(args[i], "wrap")) contacts_wrap = 1;
-
- else if (!xstrcasecmp(args[i], "nowrap")) contacts_wrap = 0;
-
- else if (!xstrcasecmp(args[i], "descr")) contacts_descr = 1;
-
- else if (!xstrcasecmp(args[i], "nosort")) contacts_nosort = 1;
-
- else if (!xstrcasecmp(args[i], "nodescr")) contacts_descr = 0;
-
- else if (!xstrncasecmp(args[i], "order=", 6)) {
- snprintf(contacts_order, sizeof(contacts_order), args[i] + 6); /* snprintf returns count of char... can we count on it? */
- corderlen = xstrlen(contacts_order);
- }
- }
-
- if (contacts_margin < 0)
- contacts_margin = 0;
+ contacts_wrap = config_contacts_wrap;
+ contacts_descr = config_contacts_descr;
+ contacts_nosort = !config_contacts_orderbystate;
- array_free(args);
+ if (config_contacts_order) {
+ strlcpy(contacts_order, config_contacts_order, sizeof(contacts_order));
+ corderlen = xstrlen(contacts_order);
}
+
/* XXX destroy window only if (!config_contacts) ? XXX */
if ((w = window_find_sa(NULL, "__contacts", 1))) {
window_kill(w);
Index: contacts.h
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/contacts.h,v
diff -d -u -r1.12 -r1.13
--- contacts.h 31 Aug 2006 16:43:13 -0000 1.12
+++ contacts.h 22 Oct 2007 15:21:29 -0000 1.13
@@ -4,7 +4,13 @@
extern int config_contacts_size;
extern int config_contacts;
extern int config_contacts_groups_all_sessions;
-extern char *config_contacts_options;
+extern int config_contacts_descr;
+extern int config_contacts_edge;
+extern int config_contacts_frame;
+extern int config_contacts_margin;
+extern int config_contacts_orderbystate;
+extern int config_contacts_wrap;
+extern char *config_contacts_order;
extern char *config_contacts_groups;
extern int config_contacts_metacontacts_swallow;
Index: main.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/main.c,v
diff -d -u -r1.105 -r1.106
--- main.c 21 Oct 2007 10:13:06 -0000 1.105
+++ main.c 22 Oct 2007 15:21:29 -0000 1.106
@@ -509,14 +509,20 @@
{
config_contacts_size = 9; /* szerokość okna kontaktów */
config_contacts = 2; /* czy ma być okno kontaktów */
+ config_contacts_edge = 2;
+ config_contacts_frame = 1;
+ config_contacts_margin = 1;
+ config_contacts_wrap = 0;
+ config_contacts_descr = 0;
+ config_contacts_orderbystate = 1;
config_lastlog_size = 10; /* szerokosc/dlugosc okna kontaktow */
config_lastlog_lock = 1; /* czy blokujemy lastloga.. zeby nam nie zmienialo sie w czasie zmiany okna, *wolne* */
- xfree(config_contacts_options);
+ xfree(config_contacts_order);
xfree(config_contacts_groups);
- config_contacts_options = NULL; /* opcje listy kontaktów */
+ config_contacts_order = NULL;
config_contacts_groups = NULL; /* grupy listy kontaktów */
config_contacts_groups_all_sessions = 0; /* all sessions ? */
config_contacts_metacontacts_swallow = 1;
@@ -649,11 +655,18 @@
* changes...
*/
variable_add(&ncurses_plugin, ("contacts"), VAR_INT, 1, &config_contacts, (void (*)(const char *))ncurses_contacts_changed, NULL, NULL);
+ variable_add(&ncurses_plugin, ("contacts_descr"), VAR_BOOL, 1, &config_contacts_descr, (void (*)(const char *))ncurses_contacts_changed, NULL, dd_contacts);
+ variable_add(&ncurses_plugin, ("contacts_edge"), VAR_INT, 1, &config_contacts_edge,(void (*)(const char *))ncurses_contacts_changed, variable_map(4, 0, 0, "left", 1, 0, "top", 2, 0, "right", 3, 0, "bottom"), dd_contacts);
+
+ variable_add(&ncurses_plugin, ("contacts_frame"), VAR_BOOL, 1, &config_contacts_frame, (void (*)(const char *))ncurses_contacts_changed, NULL, dd_contacts);
variable_add(&ncurses_plugin, ("contacts_groups"), VAR_STR, 1, &config_contacts_groups, (void (*)(const char *))ncurses_contacts_changed, NULL, dd_contacts);
variable_add(&ncurses_plugin, ("contacts_groups_all_sessons"), VAR_BOOL, 1, &config_contacts_groups_all_sessions, (void (*)(const char *))ncurses_contacts_changed, NULL, dd_contacts);
- variable_add(&ncurses_plugin, ("contacts_options"), VAR_STR, 1, &config_contacts_options, (void (*)(const char *))ncurses_contacts_changed, NULL, dd_contacts);
- variable_add(&ncurses_plugin, ("contacts_size"), VAR_INT, 1, &config_contacts_size, (void (*)(const char *))ncurses_contacts_changed, NULL, dd_contacts);
+ variable_add(&ncurses_plugin, ("contacts_margin"), VAR_INT, 1, &config_contacts_margin, (void (*)(const char *))ncurses_contacts_changed, NULL, dd_contacts);
variable_add(&ncurses_plugin, ("contacts_metacontacts_swallow"), VAR_BOOL, 1, &config_contacts_metacontacts_swallow, (void (*)(const char *))ncurses_all_contacts_changed, NULL, dd_contacts);
+ variable_add(&ncurses_plugin, ("contacts_order"), VAR_STR, 1, &config_contacts_order, (void (*)(const char *))ncurses_contacts_changed, NULL, dd_contacts);
+ variable_add(&ncurses_plugin, ("contacts_orderbystate"), VAR_BOOL, 1, &config_contacts_orderbystate, (void (*)(const char *))ncurses_contacts_changed, NULL, dd_contacts);
+ variable_add(&ncurses_plugin, ("contacts_size"), VAR_INT, 1, &config_contacts_size, (void (*)(const char *))ncurses_contacts_changed, NULL, dd_contacts);
+ variable_add(&ncurses_plugin, ("contacts_wrap"), VAR_BOOL, 1, &config_contacts_wrap, (void (*)(const char *))ncurses_contacts_changed, NULL, dd_contacts);
variable_add(&ncurses_plugin, ("lastlog_size"), VAR_INT, 1, &config_lastlog_size, (void (*)(const char *))ncurses_lastlog_changed, NULL, NULL);
variable_add(&ncurses_plugin, ("lastlog_lock"), VAR_BOOL, 1, &config_lastlog_lock, NULL, NULL, NULL);
variable_add(&ncurses_plugin, ("display_transparent"), VAR_BOOL, 1, &config_display_transparent, ncurses_display_transparent_changed, NULL, NULL);
Index: vars-pl.txt
===================================================================
RCS file: /home/cvs/ekg2/plugins/ncurses/vars-pl.txt,v
diff -d -u -r1.4 -r1.5
--- vars-pl.txt 16 Feb 2007 01:27:15 -0000 1.4
+++ vars-pl.txt 22 Oct 2007 15:21:29 -0000 1.5
@@ -36,6 +36,32 @@
strony ekranu. jeśli jest równe 2, informacje o zmianie stanu nie
są wyświetlane, ignorując wartość zmiennej ,,display_notify''.
+contacts_descr
+ typ: bool
+ domyślna wartość: 0
+
+ czy wyświetlać opisy stanu kontaktów?
+
+contacts_edge
+ typ: liczba
+ domyślna wartość: 2
+
+ położenie listy kontaktów na ekranie (krawędź):
+
+ 0 - lewa
+
+ 1 - górna
+
+ 2 - prawa
+
+ 3 - dolna
+
+contacts_frame
+ typ: bool
+ domyślna wartość: 1
+
+ czy wyświetlać ramkę oddzielającą listę od głównego okna?
+
contacts_groups
typ: tekst
domyślna wartość: brak
@@ -51,6 +77,12 @@
Jeśli jest włączona, przy wyświetlaniu kontaktów z grupy brane są pod
uwagę wszystkie sesje.
+contacts_margin
+ typ: liczba
+ domyślna wartość: 1
+
+ margines między listą kontaktów, a głównym oknem.
+
contacts_metacontacts_swallow
typ: bool
domyślna wartość: 1
@@ -59,12 +91,11 @@
w liście kontaktów wyświetlany jest metakontakt, ukrywane są poszczególne
kontakty do niego należące.
-contacts_options
+contacts_order
typ: tekst
domyślna wartość: brak
- opcje listy kontaktów oddzielone przecinkiem lub spacją. domyślne
- ustawienia to ,,right, frame, margin=1, nowrap, nodescr, order=chavawxadninnoer''
+ kolejność wyświetlania stanów na liście kontaktów
możliwe stany to:
@@ -82,20 +113,21 @@
no - niedostępny
- er - niepoprawny kontakt
+ er - błąd przy pobieraniu stanu
- można pominąć niektóre stany -- nie będą po prostu wyświetlane na liście.
+ un - nieznany stan
+ bl - blokujący
- lista dostępnych opcji:
- - left, right, top, bottom - położenie listy kontaktów na ekranie,
- - frame, noframe - lista oddzielona ramką od głównego okna lub nie,
- - margin=n, nomargin - margines między listą a głównym oknem lub brak,
- - wrap, nowrap - treść listy będzie zawijana lub ucinana,
- - descr, nodescr - opisy stanu będą lub nie będą wyświetlane,
- - order=n - kolejność wyświetlanych stanów.
- - nosort - kolejność listy jest alfabetyczna, wyświetlane są jednak
- tylko statusy pojawiające się w opcji order
+ można pominąć niektóre stany -- nie będą po prostu wyświetlane na liście.
+
+contacts_orderbystate
+ typ: bool
+ domyślna wartość: 0
+
+ czy grupować opisy wg. statusu? jeśli nie, kontakty będą sortowane
+ alfabetyczne, ale wyświetlane będą tylko statusy, wymienione w opcji
+ contacts_order.
contacts_size
typ: liczba
@@ -103,6 +135,12 @@
określa szerokość okienka z listą kontaktów.
+contacts_wrap
+ typ: bool
+ domyślna wartość: 0
+
+ czy zawijać zbyt długie kontakty?
+
display_transparent
typ: bool
domyślna wartość: 1
Więcej informacji o liście dyskusyjnej ekg2-commit