comparison mcabber/src/screen.c @ 1204:e802ec0c02d2

Basic support for nick highlighting in MUC rooms (the whole line is colored)
author Mikael Berthe <mikael@lilotux.net>
date Sat, 28 Apr 2007 21:52:57 +0200
parents be06bbe7e449
children 2de8f8ba1f34
comparison
equal deleted inserted replaced
1203:c96fef31ff96 1204:e802ec0c02d2
176 { 176 {
177 const char *colors[] = { 177 const char *colors[] = {
178 "", "", 178 "", "",
179 "general", 179 "general",
180 "msgout", 180 "msgout",
181 "msghl",
181 "status", 182 "status",
182 "roster", 183 "roster",
183 "rostersel", 184 "rostersel",
184 "rosterselmsg", 185 "rosterselmsg",
185 "rosternewmsg", 186 "rosternewmsg",
224 init_pair(i+1, ((color) ? FindColor(color) : COLOR_WHITE), 225 init_pair(i+1, ((color) ? FindColor(color) : COLOR_WHITE),
225 FindColor(background)); 226 FindColor(background));
226 break; 227 break;
227 case COLOR_MSGOUT: 228 case COLOR_MSGOUT:
228 init_pair(i+1, ((color) ? FindColor(color) : COLOR_CYAN), 229 init_pair(i+1, ((color) ? FindColor(color) : COLOR_CYAN),
230 FindColor(background));
231 break;
232 case COLOR_MSGHL:
233 init_pair(i+1, ((color) ? FindColor(color) : COLOR_YELLOW),
229 FindColor(background)); 234 FindColor(background));
230 break; 235 break;
231 case COLOR_STATUS: 236 case COLOR_STATUS:
232 init_pair(i+1, ((color) ? FindColor(color) : COLOR_WHITE), 237 init_pair(i+1, ((color) ? FindColor(color) : COLOR_WHITE),
233 FindColor(backstatus)); 238 FindColor(backstatus));
627 wmove(win_entry->win, n, 0); 632 wmove(win_entry->win, n, 0);
628 line = *(lines+n); 633 line = *(lines+n);
629 // NOTE: update PREFIX_WIDTH if you change the date format!! 634 // NOTE: update PREFIX_WIDTH if you change the date format!!
630 // You need to set it to the whole prefix length + 1 635 // You need to set it to the whole prefix length + 1
631 if (line) { 636 if (line) {
632 if (line->flags & HBB_PREFIX_HLIGHT) 637 if (line->flags & HBB_PREFIX_HLIGHT_OUT)
633 wattrset(win_entry->win, get_color(COLOR_MSGOUT)); 638 wattrset(win_entry->win, get_color(COLOR_MSGOUT));
639 else if (line->flags & HBB_PREFIX_HLIGHT)
640 wattrset(win_entry->win, get_color(COLOR_MSGHL));
634 641
635 if (line->timestamp && !(line->flags & HBB_PREFIX_SPECIAL)) { 642 if (line->timestamp && !(line->flags & HBB_PREFIX_SPECIAL)) {
636 strftime(date, 30, "%m-%d %H:%M", localtime(&line->timestamp)); 643 strftime(date, 30, "%m-%d %H:%M", localtime(&line->timestamp));
637 } else 644 } else
638 strcpy(date, " "); 645 strcpy(date, " ");
663 wprintw(win_entry->win, "%.11s ", date); 670 wprintw(win_entry->win, "%.11s ", date);
664 } 671 }
665 672
666 wprintw(win_entry->win, "%s", line->text); // Display text line 673 wprintw(win_entry->win, "%s", line->text); // Display text line
667 674
668 if (line->flags & HBB_PREFIX_HLIGHT) 675 if (line->flags & HBB_PREFIX_HLIGHT_OUT ||
676 line->flags & HBB_PREFIX_HLIGHT)
669 wattrset(win_entry->win, get_color(COLOR_GENERAL)); 677 wattrset(win_entry->win, get_color(COLOR_GENERAL));
670 wclrtoeol(win_entry->win); 678 wclrtoeol(win_entry->win);
671 g_free(line->text); 679 g_free(line->text);
672 g_free(line); 680 g_free(line);
673 } else { 681 } else {
1460 // If prefix is NULL, HBB_PREFIX_IN is supposed. 1468 // If prefix is NULL, HBB_PREFIX_IN is supposed.
1461 void scr_WriteIncomingMessage(const char *jidfrom, const char *text, 1469 void scr_WriteIncomingMessage(const char *jidfrom, const char *text,
1462 time_t timestamp, guint prefix) 1470 time_t timestamp, guint prefix)
1463 { 1471 {
1464 if (!(prefix & 1472 if (!(prefix &
1465 ~HBB_PREFIX_NOFLAG & ~HBB_PREFIX_HLIGHT & ~HBB_PREFIX_PGPCRYPT)) 1473 ~HBB_PREFIX_NOFLAG & ~HBB_PREFIX_HLIGHT & ~HBB_PREFIX_HLIGHT_OUT &
1474 ~HBB_PREFIX_PGPCRYPT))
1466 prefix |= HBB_PREFIX_IN; 1475 prefix |= HBB_PREFIX_IN;
1467 1476
1468 scr_WriteMessage(jidfrom, text, timestamp, prefix); 1477 scr_WriteMessage(jidfrom, text, timestamp, prefix);
1469 } 1478 }
1470 1479
1472 { 1481 {
1473 GSList *roster_elt; 1482 GSList *roster_elt;
1474 roster_elt = roster_find(jidto, jidsearch, 1483 roster_elt = roster_find(jidto, jidsearch,
1475 ROSTER_TYPE_USER|ROSTER_TYPE_AGENT|ROSTER_TYPE_ROOM); 1484 ROSTER_TYPE_USER|ROSTER_TYPE_AGENT|ROSTER_TYPE_ROOM);
1476 1485
1477 scr_WriteMessage(jidto, text, 0, prefix|HBB_PREFIX_OUT|HBB_PREFIX_HLIGHT); 1486 scr_WriteMessage(jidto, text, 0, prefix|HBB_PREFIX_OUT|HBB_PREFIX_HLIGHT_OUT);
1478 1487
1479 // Show jidto's buffer unless the buddy is not in the buddylist 1488 // Show jidto's buffer unless the buddy is not in the buddylist
1480 if (roster_elt && g_list_position(buddylist, roster_elt->data) != -1) 1489 if (roster_elt && g_list_position(buddylist, roster_elt->data) != -1)
1481 scr_ShowWindow(jidto, FALSE); 1490 scr_ShowWindow(jidto, FALSE);
1482 } 1491 }