Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.c @ 185:e8e447a07641
[/trunk] Changeset 197 by mikael
* Use a constant to store the prefix (timestamp + in/out string) length
* Change timestamp display format (add the month & day)
author | mikael |
---|---|
date | Thu, 05 May 2005 20:05:39 +0000 |
parents | b5aa2b9c425a |
children | 4ce9ff808baa |
comparison
equal
deleted
inserted
replaced
184:b5aa2b9c425a | 185:e8e447a07641 |
---|---|
219 top_panel(chatPanel); | 219 top_panel(chatPanel); |
220 } | 220 } |
221 update_panels(); | 221 update_panels(); |
222 | 222 |
223 // Load buddy history from file (if enabled) | 223 // Load buddy history from file (if enabled) |
224 hlog_read_history(title, &tmp->hbuf, maxX - scr_WindowWidth(rosterWnd) - 14); | 224 hlog_read_history(title, &tmp->hbuf, maxX - ROSTER_WIDTH - PREFIX_WIDTH); |
225 | 225 |
226 list_add_tail(&tmp->list, &window_list); | 226 list_add_tail(&tmp->list, &window_list); |
227 | 227 |
228 return tmp; | 228 return tmp; |
229 } | 229 } |
286 | 286 |
287 // Display these lines | 287 // Display these lines |
288 for (n = 0; n < CHAT_WIN_HEIGHT; n++) { | 288 for (n = 0; n < CHAT_WIN_HEIGHT; n++) { |
289 wmove(win_entry->win, n, 0); | 289 wmove(win_entry->win, n, 0); |
290 line = *(lines+n); | 290 line = *(lines+n); |
291 // NOTE: update PREFIX_WIDTH if you change the date format!! | |
292 // You need to set it to the whole prefix length + 1 | |
291 if (line) { | 293 if (line) { |
292 if (line->timestamp) { | 294 if (line->timestamp) { |
293 strftime(date, 35, "%H:%M", localtime(&line->timestamp)); | 295 strftime(date, 35, "%m-%d %H:%M", localtime(&line->timestamp)); |
294 } else | 296 } else |
295 strcpy(date, " "); | 297 strcpy(date, " "); |
296 if (line->flags & HBB_PREFIX_IN) | 298 if (line->flags & HBB_PREFIX_IN) |
297 wprintw(win_entry->win, "[%.5s] <== ", date); | 299 wprintw(win_entry->win, "%.11s <== ", date); |
298 else if (line->flags & HBB_PREFIX_OUT) | 300 else if (line->flags & HBB_PREFIX_OUT) |
299 wprintw(win_entry->win, "[%.5s] --> ", date); | 301 wprintw(win_entry->win, "%.11s --> ", date); |
300 else { | 302 else { |
301 wprintw(win_entry->win, " "); | 303 wprintw(win_entry->win, "%.11s ", date); |
302 } | 304 } |
303 wprintw(win_entry->win, "%s", line->text); // line | 305 wprintw(win_entry->win, "%s", line->text); // line |
304 wclrtoeol(win_entry->win); | 306 wclrtoeol(win_entry->win); |
305 g_free(line->text); | 307 g_free(line->text); |
306 } else { | 308 } else { |
381 if (win_entry == NULL) { | 383 if (win_entry == NULL) { |
382 win_entry = scr_CreateBuddyPanel(winId, dont_show); | 384 win_entry = scr_CreateBuddyPanel(winId, dont_show); |
383 } | 385 } |
384 | 386 |
385 hbuf_add_line(&win_entry->hbuf, text, timestamp, prefix_flags, | 387 hbuf_add_line(&win_entry->hbuf, text, timestamp, prefix_flags, |
386 maxX - scr_WindowWidth(rosterWnd) - 14); | 388 maxX - ROSTER_WIDTH - PREFIX_WIDTH); |
387 | 389 |
388 if (win_entry->cleared) { | 390 if (win_entry->cleared) { |
389 win_entry->cleared = 0; // The message must be displayed | 391 win_entry->cleared = 0; // The message must be displayed |
390 win_entry->top = g_list_last(win_entry->hbuf); | 392 win_entry->top = g_list_last(win_entry->hbuf); |
391 } | 393 } |
538 if (search_entry->panel) { | 540 if (search_entry->panel) { |
539 replace_panel(search_entry->panel, search_entry->win); | 541 replace_panel(search_entry->panel, search_entry->win); |
540 } | 542 } |
541 // Redo line wrapping | 543 // Redo line wrapping |
542 hbuf_rebuild(&search_entry->hbuf, | 544 hbuf_rebuild(&search_entry->hbuf, |
543 maxX - scr_WindowWidth(rosterWnd) - 14); | 545 maxX - ROSTER_WIDTH - PREFIX_WIDTH); |
544 } | 546 } |
545 } | 547 } |
546 | 548 |
547 // Refresh current buddy window | 549 // Refresh current buddy window |
548 if (chatmode) | 550 if (chatmode) |