changeset 22:6a97e7cd00d9

[/trunk] Changeset 37 by mikael * Unexport the scr_SearchWindow() function. Use the new scr_IsHiddenMessage() function instead.
author mikael
date Sun, 27 Mar 2005 19:32:38 +0000
parents 7eeda3a06b21
children d7107507424b
files mcabber/TODO mcabber/buddies.c mcabber/screen.c mcabber/screen.h
diffstat 4 files changed, 28 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/TODO	Sun Mar 27 18:52:11 2005 +0000
+++ b/mcabber/TODO	Sun Mar 27 19:32:38 2005 +0000
@@ -1,5 +1,4 @@
 
-* un-export window internal structure, use a public function
 * pending message not displayed if buddy outside Contact window
 
 * Use libjabber
@@ -19,7 +18,7 @@
 * Handle window resize
 * Command line completion
 * Scroll back history
-* Save history 
+* Save history
 * Shortcut to jump to next message received (shift-tab?)
 * File transfer? :)
 * Conferences :)
--- a/mcabber/buddies.c	Sun Mar 27 18:52:11 2005 +0000
+++ b/mcabber/buddies.c	Sun Mar 27 19:32:38 2005 +0000
@@ -217,7 +217,6 @@
   int n;
   int maxx, maxy;
   int fakeOffset = buddyOffset;
-  window_entry_t *wintmp;
 
   getmaxyx(win, maxy, maxx);
 
@@ -242,16 +241,7 @@
     }
 
     tmp = buddy_entry(pos);
-    // FIXME: we should create a function instead of exporting this! :-(
-    // Cf. revision ~28
-    wintmp = scr_SearchWindow(tmp->jid);
-    /*
-    if (wintmp)
-      scr_LogPrint("wintmp != NULL");
-    else
-      scr_LogPrint("wintmp == NULL");
-    */
-    if ((wintmp) && (wintmp->hidden_msg)) {
+    if (scr_IsHiddenMessage(tmp->jid)) {
       pending = '#';
     }
 
--- a/mcabber/screen.c	Sun Mar 27 18:52:11 2005 +0000
+++ b/mcabber/screen.c	Sun Mar 27 19:32:38 2005 +0000
@@ -13,12 +13,24 @@
 #include "parsecfg.h"
 #include "lang.h"
 #include "server.h"
+#include "list.h"
 
 /* Definicion de tipos */
 #define window_entry(n) list_entry(n, window_entry_t, list)
 
 LIST_HEAD(window_list);
 
+typedef struct _window_entry_t {
+  WINDOW *win;
+  PANEL *panel;
+  char *name;
+  int nlines;
+  char **texto;
+  int hidden_msg;
+  struct list_head list;
+} window_entry_t;
+
+
 /* Variables globales a SCREEN.C */
 static WINDOW *rosterWnd, *chatWnd, *inputWnd;
 static WINDOW *logWnd, *logWnd_border;
@@ -588,6 +600,18 @@
   doupdate();
 }
 
+//  scr_IsHiddenMessage(jid)
+// Returns TRUE if there is a hidden message in the window
+// for the jid contact.
+int scr_IsHiddenMessage(char *jid) {
+  window_entry_t *wintmp;
+
+  wintmp = scr_SearchWindow(jid);
+  if ((wintmp) && (wintmp->hidden_msg))
+    return TRUE;
+
+  return FALSE;
+}
 
 void send_message(int sock, char *msg)
 {
--- a/mcabber/screen.h	Sun Mar 27 18:52:11 2005 +0000
+++ b/mcabber/screen.h	Sun Mar 27 19:32:38 2005 +0000
@@ -2,9 +2,6 @@
 #define __SCREEN_H__ 1
 
 #include <ncurses.h>
-#include <panel.h>
-
-#include "list.h"
 
 #define COLOR_POPUP     1
 #define COLOR_GENERAL   3
@@ -18,17 +15,6 @@
 
 #define INPUTLINE_LENGTH  1024
 
-
-typedef struct _window_entry_t {
-  WINDOW *win;
-  PANEL *panel;
-  char *name;
-  int nlines;
-  char **texto;
-  int hidden_msg;
-  struct list_head list;
-} window_entry_t;
-
 extern int update_roaster;
 
 void scr_InitCurses(void);
@@ -42,7 +28,8 @@
 void scr_RoolWindow(void);
 void scr_ShowBuddyWindow(void);
 void scr_LogPrint(const char *fmt, ...);
-window_entry_t *scr_SearchWindow(char *winId);
+
+int scr_IsHiddenMessage(char *jid);
 
 WINDOW *scr_GetRosterWindow(void);
 WINDOW *scr_GetStatusWindow(void);