comparison mcabber/screen.c @ 21:7eeda3a06b21

[/trunk] Changeset 36 by mikael * Translations, cleanups.
author mikael
date Sun, 27 Mar 2005 18:52:11 +0000
parents e97f323c8aa2
children 6a97e7cd00d9
comparison
equal deleted inserted replaced
20:e97f323c8aa2 21:7eeda3a06b21
305 doupdate(); 305 doupdate();
306 free(instr); 306 free(instr);
307 keypad(inputWnd, TRUE); 307 keypad(inputWnd, TRUE);
308 } 308 }
309 309
310
311
312 void scr_RoolWindow(void) 310 void scr_RoolWindow(void)
313 { 311 {
314 } 312 }
315 313
316 window_entry_t *scr_SearchWindow(char *winId) 314 window_entry_t *scr_SearchWindow(char *winId)
378 376
379 if (!chatmode) 377 if (!chatmode)
380 dont_show = TRUE; 378 dont_show = TRUE;
381 else if ((!force_show) && ((!currentWindow || (currentWindow != tmp)))) 379 else if ((!force_show) && ((!currentWindow || (currentWindow != tmp))))
382 dont_show = TRUE; 380 dont_show = TRUE;
383 scr_LogPrint("dont_show=%d", dont_show); 381 // scr_LogPrint("dont_show=%d", dont_show);
384 382
385 if (tmp == NULL) { 383 if (tmp == NULL) {
386 tmp = scr_CreatePanel(winId, 20, 0, CHAT_WIN_HEIGHT, maxX - 20, dont_show); 384 tmp = scr_CreatePanel(winId, 20, 0, CHAT_WIN_HEIGHT, maxX - 20, dont_show);
387 tmp->texto = (char **) calloc((CHAT_WIN_HEIGHT+1) * 3, sizeof(char *)); 385 tmp->texto = (char **) calloc((CHAT_WIN_HEIGHT+1) * 3, sizeof(char *));
388 for (n = 0; n < CHAT_WIN_HEIGHT * 3; n++) 386 for (n = 0; n < CHAT_WIN_HEIGHT * 3; n++)
489 //logWnd = newwin(LOG_WIN_HEIGHT - 2, maxX-20 - 2, CHAT_WIN_HEIGHT+1, 20+1); 487 //logWnd = newwin(LOG_WIN_HEIGHT - 2, maxX-20 - 2, CHAT_WIN_HEIGHT+1, 20+1);
490 logWnd = derwin(logWnd_border, LOG_WIN_HEIGHT-2, maxX-2, 1, 1); 488 logWnd = derwin(logWnd_border, LOG_WIN_HEIGHT-2, maxX-2, 1, 1);
491 logPanel = new_panel(logWnd); 489 logPanel = new_panel(logWnd);
492 wbkgd(logWnd, COLOR_PAIR(COLOR_GENERAL)); 490 wbkgd(logWnd, COLOR_PAIR(COLOR_GENERAL));
493 //wattrset(logWnd, COLOR_PAIR(COLOR_GENERAL)); 491 //wattrset(logWnd, COLOR_PAIR(COLOR_GENERAL));
494 wprintw(logWnd, "Here we are\n"); 492 scr_LogPrint("Start up.");
495 scr_LogPrint("Here we are :-)");
496 493
497 scrollok(logWnd,TRUE); 494 scrollok(logWnd,TRUE);
498 idlok(logWnd,TRUE); // XXX Necessary? 495 //idlok(logWnd,TRUE); // XXX Necessary?
499 496
500 inputWnd = newwin(1, maxX, maxY-1, 0); 497 inputWnd = newwin(1, maxX, maxY-1, 0);
501 inputPanel = new_panel(inputWnd); 498 inputPanel = new_panel(inputWnd);
502 //wbkgd(inputWnd, COLOR_PAIR(COLOR_GENERAL)); 499 //wbkgd(inputWnd, COLOR_PAIR(COLOR_GENERAL));
503 500
541 538
542 top_panel(inputPanel); 539 top_panel(inputPanel);
543 //wmove(inputWnd, 0, ptr_inputline - (char*)&inputLine); 540 //wmove(inputWnd, 0, ptr_inputline - (char*)&inputLine);
544 update_panels(); 541 update_panels();
545 doupdate(); 542 doupdate();
546 }
547
548 void scr_WriteMessage(int sock)
549 {
550 char **submsgs;
551 int n, i;
552 char *buffer = (char *) calloc(1, 1024);
553 char *buffer2 = (char *) calloc(1, 1024);
554 buddy_entry_t *tmp = bud_SelectedInfo();
555
556 scr_ShowWindow(tmp->jid);
557
558 ut_CenterMessage(i18n("write your message here"), 60, buffer2);
559
560 scr_CreatePopup(tmp->jid, buffer2, 60, 1, buffer);
561
562 if (strlen(buffer)) {
563 sprintf(buffer2, "--> %s", buffer);
564
565 submsgs =
566 ut_SplitMessage(buffer2, &n,
567 maxX - scr_WindowHeight(rosterWnd) - 20);
568 for (i = 0; i < n; i++) {
569 if (i == 0)
570 scr_WriteInWindow(tmp->jid, submsgs[i], TRUE, TRUE);
571 else
572 scr_WriteInWindow(tmp->jid, submsgs[i], FALSE, TRUE);
573 }
574
575 for (i = 0; i < n; i++)
576 free(submsgs[i]);
577 free(submsgs);
578
579 move(CHAT_WIN_HEIGHT - 1, maxX - 1);
580 refresh();
581 sprintf(buffer2, "%s@%s/%s", cfg_read("username"),
582 cfg_read("server"), cfg_read("resource"));
583 srv_sendtext(sock, tmp->jid, buffer, buffer2);
584 }
585 free(buffer);
586 free(buffer2);
587 } 543 }
588 544
589 int scr_Getch(void) 545 int scr_Getch(void)
590 { 546 {
591 int ch; 547 int ch;