Mercurial > hg
comparison mcabber/src/screen.c @ 1156:cae430fcd385
Mcabber will load symlinked histories only once, now.
author | Frank Zschockelt |
---|---|
date | Wed, 14 Feb 2007 13:25:42 +0100 |
parents | f746d91c5d3b |
children | 5c857f0f0ab8 |
comparison
equal
deleted
inserted
replaced
1155:3b9bbf6c4c93 | 1156:cae430fcd385 |
---|---|
410 g_free(buffer); | 410 g_free(buffer); |
411 } | 411 } |
412 g_free(btext); | 412 g_free(btext); |
413 } | 413 } |
414 | 414 |
415 static winbuf *scr_SearchWindow(const char *winId, int special) | |
416 { | |
417 char *id; | |
418 winbuf *wbp; | |
419 | |
420 if (special) | |
421 return statusWindow; // Only one special window atm. | |
422 | |
423 if (!winId) | |
424 return NULL; | |
425 | |
426 id = g_strdup(winId); | |
427 mc_strtolower(id); | |
428 wbp = g_hash_table_lookup(winbufhash, id); | |
429 g_free(id); | |
430 return wbp; | |
431 } | |
432 | |
433 int scr_BuddyBufferExists(const char *bjid) | |
434 { | |
435 return (scr_SearchWindow(bjid, FALSE) != NULL); | |
436 } | |
437 | |
415 // scr_new_buddy(title, dontshow) | 438 // scr_new_buddy(title, dontshow) |
416 // Note: title (aka winId/jid) can be NULL for special buffers | 439 // Note: title (aka winId/jid) can be NULL for special buffers |
417 static winbuf *scr_new_buddy(const char *title, int dont_show) | 440 static winbuf *scr_new_buddy(const char *title, int dont_show) |
418 { | 441 { |
419 winbuf *tmp; | 442 winbuf *tmp; |
434 update_panels(); | 457 update_panels(); |
435 | 458 |
436 // If title is NULL, this is a special buffer | 459 // If title is NULL, this is a special buffer |
437 if (title) { | 460 if (title) { |
438 char *id; | 461 char *id; |
439 // Load buddy history from file (if enabled) | 462 id = hlog_get_log_jid(title); |
440 hlog_read_history(title, &tmp->hbuf, maxX - Roster_Width - PREFIX_WIDTH); | 463 if (id) { |
464 if(scr_BuddyBufferExists(id)) | |
465 tmp->hbuf=(scr_SearchWindow(id, FALSE))->hbuf; | |
466 else | |
467 tmp->hbuf=(scr_new_buddy(id, TRUE))->hbuf; | |
468 g_free(id); | |
469 } | |
470 else // Load buddy history from file (if enabled) | |
471 hlog_read_history(title, &tmp->hbuf, maxX - Roster_Width - PREFIX_WIDTH); | |
441 | 472 |
442 id = g_strdup(title); | 473 id = g_strdup(title); |
443 mc_strtolower(id); | 474 mc_strtolower(id); |
444 g_hash_table_insert(winbufhash, id, tmp); | 475 g_hash_table_insert(winbufhash, id, tmp); |
445 } | 476 } |
446 return tmp; | 477 return tmp; |
447 } | |
448 | |
449 static winbuf *scr_SearchWindow(const char *winId, int special) | |
450 { | |
451 char *id; | |
452 winbuf *wbp; | |
453 | |
454 if (special) | |
455 return statusWindow; // Only one special window atm. | |
456 | |
457 if (!winId) | |
458 return NULL; | |
459 | |
460 id = g_strdup(winId); | |
461 mc_strtolower(id); | |
462 wbp = g_hash_table_lookup(winbufhash, id); | |
463 g_free(id); | |
464 return wbp; | |
465 } | |
466 | |
467 int scr_BuddyBufferExists(const char *bjid) | |
468 { | |
469 return (scr_SearchWindow(bjid, FALSE) != NULL); | |
470 } | 478 } |
471 | 479 |
472 // scr_UpdateWindow() | 480 // scr_UpdateWindow() |
473 // (Re-)Display the given chat window. | 481 // (Re-)Display the given chat window. |
474 static void scr_UpdateWindow(winbuf *win_entry) | 482 static void scr_UpdateWindow(winbuf *win_entry) |
565 break; | 573 break; |
566 } | 574 } |
567 } | 575 } |
568 g_free(lines); | 576 g_free(lines); |
569 } | 577 } |
570 | 578 |
571 static winbuf * scr_CreateWindow(const char *winId, int special, int dont_show) | 579 static winbuf * scr_CreateWindow(const char *winId, int special, int dont_show) |
572 { | 580 { |
573 if (special) { | 581 if (special) { |
574 if (!statusWindow) { | 582 if (!statusWindow) { |
575 statusWindow = scr_new_buddy(NULL, dont_show); | 583 statusWindow = scr_new_buddy(NULL, dont_show); |