mcabber/src/screen.c
changeset 50 5425ee13dce6
parent 47 7259a61e1a4b
child 65 a8689087db5c
equal deleted inserted replaced
49:18a03a69f5e4 50:5425ee13dce6
   162     i++;
   162     i++;
   163   }
   163   }
   164 }
   164 }
   165 
   165 
   166 
   166 
   167 window_entry_t *scr_CreatePanel(char *title, int x, int y, int lines,
   167 window_entry_t *scr_CreatePanel(const char *title, int x, int y,
   168 				int cols, int dont_show)
   168                                 int lines, int cols, int dont_show)
   169 {
   169 {
   170   window_entry_t *tmp = calloc(1, sizeof(window_entry_t));
   170   window_entry_t *tmp = calloc(1, sizeof(window_entry_t));
   171 
   171 
   172   tmp->win = newwin(lines, cols, y, x);
   172   tmp->win = newwin(lines, cols, y, x);
   173   tmp->panel = new_panel(tmp->win);
   173   tmp->panel = new_panel(tmp->win);
   193 
   193 
   194 void scr_RoolWindow(void)
   194 void scr_RoolWindow(void)
   195 {
   195 {
   196 }
   196 }
   197 
   197 
   198 window_entry_t *scr_SearchWindow(char *winId)
   198 window_entry_t *scr_SearchWindow(const char *winId)
   199 {
   199 {
   200   struct list_head *pos, *n;
   200   struct list_head *pos, *n;
   201   window_entry_t *search_entry = NULL;
   201   window_entry_t *search_entry = NULL;
   202 
   202 
   203   list_for_each_safe(pos, n, &window_list) {
   203   list_for_each_safe(pos, n, &window_list) {
   209     }
   209     }
   210   }
   210   }
   211   return NULL;
   211   return NULL;
   212 }
   212 }
   213 
   213 
   214 void scr_ShowWindow(char *winId)
   214 void scr_ShowWindow(const char *winId)
   215 {
   215 {
   216   int n, width, i;
   216   int n, width, i;
   217   window_entry_t *tmp = scr_SearchWindow(winId);
   217   window_entry_t *tmp = scr_SearchWindow(winId);
   218   if (tmp != NULL) {
   218   if (tmp != NULL) {
   219     top_panel(tmp->panel);
   219     top_panel(tmp->panel);
   244     scr_ShowWindow(tmp->jid);
   244     scr_ShowWindow(tmp->jid);
   245   top_panel(inputPanel);
   245   top_panel(inputPanel);
   246 }
   246 }
   247 
   247 
   248 
   248 
   249 void scr_WriteInWindow(char *winId, char *texto, int TimeStamp, int force_show)
   249 void scr_WriteInWindow(const char *winId, char *texto, int TimeStamp, int force_show)
   250 {
   250 {
   251   time_t ahora;
   251   time_t ahora;
   252   int n;
   252   int n;
   253   int i;
   253   int i;
   254   int width;
   254   int width;
   383   refresh();
   383   refresh();
   384   endwin();
   384   endwin();
   385   return;
   385   return;
   386 }
   386 }
   387 
   387 
   388 void scr_WriteMessage(char *jid, char *text, char *prefix)
   388 void scr_WriteMessage(const char *jid, const char *text, char *prefix)
   389 {
   389 {
   390   char **submsgs;
   390   char **submsgs;
   391   int n, i;
   391   int n, i;
   392   char *buffer = (char *) malloc(strlen(text) + strlen(text));
   392   char *buffer = (char *) malloc(strlen(text) + strlen(text));
   393 
   393 
   414   free(buffer);
   414   free(buffer);
   415 
   415 
   416   top_panel(inputPanel);
   416   top_panel(inputPanel);
   417 }
   417 }
   418 
   418 
   419 void scr_WriteIncomingMessage(char *jidfrom, char *text)
   419 void scr_WriteIncomingMessage(const char *jidfrom, const char *text)
   420 {
   420 {
   421   char *buffer = utf8_decode(text);
   421   char *buffer = utf8_decode(text);
   422   scr_WriteMessage(jidfrom, buffer, "<== ");
   422   scr_WriteMessage(jidfrom, buffer, "<== ");
   423   free(buffer);
   423   free(buffer);
   424   update_panels();
   424   update_panels();
   425   doupdate();
   425   doupdate();
   426 }
   426 }
   427 
   427 
   428 void scr_WriteOutgoingMessage(char *jidto, char *text)
   428 void scr_WriteOutgoingMessage(const char *jidto, const char *text)
   429 {
   429 {
   430   scr_ShowWindow(jidto);
   430   scr_ShowWindow(jidto);
   431   scr_WriteMessage(jidto, text, "--> ");
   431   scr_WriteMessage(jidto, text, "--> ");
   432   //refresh(); // XXX ?
   432   //refresh(); // XXX ?
   433 }
   433 }
   481 }
   481 }
   482 
   482 
   483 //  scr_IsHiddenMessage(jid)
   483 //  scr_IsHiddenMessage(jid)
   484 // Returns TRUE if there is a hidden message in the window
   484 // Returns TRUE if there is a hidden message in the window
   485 // for the jid contact.
   485 // for the jid contact.
   486 int scr_IsHiddenMessage(char *jid) {
   486 int scr_IsHiddenMessage(const char *jid) {
   487   window_entry_t *wintmp;
   487   window_entry_t *wintmp;
   488 
   488 
   489   wintmp = scr_SearchWindow(jid);
   489   wintmp = scr_SearchWindow(jid);
   490   if ((wintmp) && (wintmp->hidden_msg))
   490   if ((wintmp) && (wintmp->hidden_msg))
   491     return TRUE;
   491     return TRUE;