Mercurial > hg
comparison mcabber/src/screen.c @ 1160:14f5876b5555
Slight optimization + line wrapping
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 15 Feb 2007 23:56:20 +0100 |
parents | 53c0c5be43fa |
children | eb05f960613f |
comparison
equal
deleted
inserted
replaced
1159:53c0c5be43fa | 1160:14f5876b5555 |
---|---|
463 // If title is NULL, this is a special buffer | 463 // If title is NULL, this is a special buffer |
464 if (title) { | 464 if (title) { |
465 char *id; | 465 char *id; |
466 id = hlog_get_log_jid(title); | 466 id = hlog_get_log_jid(title); |
467 if (id) { | 467 if (id) { |
468 if(scr_BuddyBufferExists(id)) | 468 winbuf *wb = scr_SearchWindow(id, FALSE); |
469 tmp->bd=(scr_SearchWindow(id, FALSE))->bd; | 469 if (!wb) |
470 else | 470 wb = scr_new_buddy(id, TRUE); |
471 tmp->bd=(scr_new_buddy(id, TRUE))->bd; | 471 tmp->bd=wb->bd; |
472 g_free(id); | 472 g_free(id); |
473 } else { // Load buddy history from file (if enabled) | 473 } else { // Load buddy history from file (if enabled) |
474 tmp->bd = g_new0(buffdata, 1); | 474 tmp->bd = g_new0(buffdata, 1); |
475 hlog_read_history(title, &tmp->bd->hbuf, | 475 hlog_read_history(title, &tmp->bd->hbuf, |
476 maxX - Roster_Width - PREFIX_WIDTH); | 476 maxX - Roster_Width - PREFIX_WIDTH); |
501 if (win_entry->bd->cleared) { | 501 if (win_entry->bd->cleared) { |
502 werase(win_entry->win); | 502 werase(win_entry->win); |
503 return; | 503 return; |
504 } | 504 } |
505 | 505 |
506 // win_entry->bd->top is the top message of the screen. If it set to NULL, we | 506 // win_entry->bd->top is the top message of the screen. If it set to NULL, |
507 // are displaying the last messages. | 507 // we are displaying the last messages. |
508 | 508 |
509 // We will show the last CHAT_WIN_HEIGHT lines. | 509 // We will show the last CHAT_WIN_HEIGHT lines. |
510 // Let's find out where it begins. | 510 // Let's find out where it begins. |
511 if (!win_entry->bd->top || | 511 if (!win_entry->bd->top || (g_list_position(g_list_first(win_entry->bd->hbuf), |
512 (g_list_position(g_list_first(win_entry->bd->hbuf), win_entry->bd->top) == -1)) { | 512 win_entry->bd->top) == -1)) { |
513 // Move up CHAT_WIN_HEIGHT lines | 513 // Move up CHAT_WIN_HEIGHT lines |
514 win_entry->bd->hbuf = g_list_last(win_entry->bd->hbuf); | 514 win_entry->bd->hbuf = g_list_last(win_entry->bd->hbuf); |
515 hbuf_head = win_entry->bd->hbuf; | 515 hbuf_head = win_entry->bd->hbuf; |
516 win_entry->bd->top = NULL; // (Just to make sure) | 516 win_entry->bd->top = NULL; // (Just to make sure) |
517 n = 0; | 517 n = 0; |