Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.c @ 1157:5c857f0f0ab8
Moved all variables related to hbuf to an extra struct, bufdata
author | Frank Zschockelt |
---|---|
date | Thu, 15 Feb 2007 12:45:03 +0100 |
parents | cae430fcd385 |
children | 53c0c5be43fa |
comparison
equal
deleted
inserted
replaced
1156:cae430fcd385 | 1157:5c857f0f0ab8 |
---|---|
53 static inline void check_offset(int); | 53 static inline void check_offset(int); |
54 | 54 |
55 static GHashTable *winbufhash; | 55 static GHashTable *winbufhash; |
56 | 56 |
57 typedef struct { | 57 typedef struct { |
58 GList *hbuf; | |
59 GList *top; // If top is NULL, we'll display the last lines | |
60 char cleared; // For ex, user has issued a /clear command... | |
61 char lock; | |
62 } buffdata; | |
63 | |
64 typedef struct { | |
58 WINDOW *win; | 65 WINDOW *win; |
59 PANEL *panel; | 66 PANEL *panel; |
60 GList *hbuf; | 67 buffdata *bd; |
61 GList *top; // If top is NULL, we'll display the last lines | |
62 char cleared; // For ex, user has issued a /clear command... | |
63 char lock; | |
64 } winbuf; | 68 } winbuf; |
65 | 69 |
66 struct dimensions { | 70 struct dimensions { |
67 int l; | 71 int l; |
68 int c; | 72 int c; |
460 if (title) { | 464 if (title) { |
461 char *id; | 465 char *id; |
462 id = hlog_get_log_jid(title); | 466 id = hlog_get_log_jid(title); |
463 if (id) { | 467 if (id) { |
464 if(scr_BuddyBufferExists(id)) | 468 if(scr_BuddyBufferExists(id)) |
465 tmp->hbuf=(scr_SearchWindow(id, FALSE))->hbuf; | 469 tmp->bd=(scr_SearchWindow(id, FALSE))->bd; |
466 else | 470 else |
467 tmp->hbuf=(scr_new_buddy(id, TRUE))->hbuf; | 471 tmp->bd=(scr_new_buddy(id, TRUE))->bd; |
468 g_free(id); | 472 g_free(id); |
469 } | 473 } |
470 else // Load buddy history from file (if enabled) | 474 else {// Load buddy history from file (if enabled) |
471 hlog_read_history(title, &tmp->hbuf, maxX - Roster_Width - PREFIX_WIDTH); | 475 tmp->bd = g_new0(buffdata, 1); |
476 hlog_read_history(title, &tmp->bd->hbuf, maxX - Roster_Width - PREFIX_WIDTH); | |
477 } | |
472 | 478 |
473 id = g_strdup(title); | 479 id = g_strdup(title); |
474 mc_strtolower(id); | 480 mc_strtolower(id); |
475 g_hash_table_insert(winbufhash, id, tmp); | 481 g_hash_table_insert(winbufhash, id, tmp); |
482 } else { | |
483 tmp->bd = g_new0(buffdata, 1); | |
476 } | 484 } |
477 return tmp; | 485 return tmp; |
478 } | 486 } |
479 | 487 |
480 // scr_UpdateWindow() | 488 // scr_UpdateWindow() |
488 char date[64]; | 496 char date[64]; |
489 | 497 |
490 width = getmaxx(win_entry->win); | 498 width = getmaxx(win_entry->win); |
491 | 499 |
492 // Should the window be empty? | 500 // Should the window be empty? |
493 if (win_entry->cleared) { | 501 if (win_entry->bd->cleared) { |
494 werase(win_entry->win); | 502 werase(win_entry->win); |
495 return; | 503 return; |
496 } | 504 } |
497 | 505 |
498 // win_entry->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, we |
499 // are displaying the last messages. | 507 // are displaying the last messages. |
500 | 508 |
501 // We will show the last CHAT_WIN_HEIGHT lines. | 509 // We will show the last CHAT_WIN_HEIGHT lines. |
502 // Let's find out where it begins. | 510 // Let's find out where it begins. |
503 if (!win_entry->top || | 511 if (!win_entry->bd->top || |
504 (g_list_position(g_list_first(win_entry->hbuf), win_entry->top) == -1)) { | 512 (g_list_position(g_list_first(win_entry->bd->hbuf), win_entry->bd->top) == -1)) { |
505 // Move up CHAT_WIN_HEIGHT lines | 513 // Move up CHAT_WIN_HEIGHT lines |
506 win_entry->hbuf = g_list_last(win_entry->hbuf); | 514 win_entry->bd->hbuf = g_list_last(win_entry->bd->hbuf); |
507 hbuf_head = win_entry->hbuf; | 515 hbuf_head = win_entry->bd->hbuf; |
508 win_entry->top = NULL; // (Just to make sure) | 516 win_entry->bd->top = NULL; // (Just to make sure) |
509 n = 0; | 517 n = 0; |
510 while (hbuf_head && (n < CHAT_WIN_HEIGHT-1) && g_list_previous(hbuf_head)) { | 518 while (hbuf_head && (n < CHAT_WIN_HEIGHT-1) && g_list_previous(hbuf_head)) { |
511 hbuf_head = g_list_previous(hbuf_head); | 519 hbuf_head = g_list_previous(hbuf_head); |
512 n++; | 520 n++; |
513 } | 521 } |
514 // If the buffer is locked, remember current "top" line for the next time. | 522 // If the buffer is locked, remember current "top" line for the next time. |
515 if (win_entry->lock) | 523 if (win_entry->bd->lock) |
516 win_entry->top = hbuf_head; | 524 win_entry->bd->top = hbuf_head; |
517 } else | 525 } else |
518 hbuf_head = win_entry->top; | 526 hbuf_head = win_entry->bd->top; |
519 | 527 |
520 // Get the last CHAT_WIN_HEIGHT lines. | 528 // Get the last CHAT_WIN_HEIGHT lines. |
521 lines = hbuf_get_lines(hbuf_head, CHAT_WIN_HEIGHT); | 529 lines = hbuf_get_lines(hbuf_head, CHAT_WIN_HEIGHT); |
522 | 530 |
523 // Display these lines | 531 // Display these lines |
579 static winbuf * scr_CreateWindow(const char *winId, int special, int dont_show) | 587 static winbuf * scr_CreateWindow(const char *winId, int special, int dont_show) |
580 { | 588 { |
581 if (special) { | 589 if (special) { |
582 if (!statusWindow) { | 590 if (!statusWindow) { |
583 statusWindow = scr_new_buddy(NULL, dont_show); | 591 statusWindow = scr_new_buddy(NULL, dont_show); |
584 statusWindow->hbuf = statushbuf; | 592 statusWindow->bd->hbuf = statushbuf; |
585 } | 593 } |
586 return statusWindow; | 594 return statusWindow; |
587 } else { | 595 } else { |
588 return scr_new_buddy(winId, dont_show); | 596 return scr_new_buddy(winId, dont_show); |
589 } | 597 } |
603 } | 611 } |
604 | 612 |
605 top_panel(win_entry->panel); | 613 top_panel(win_entry->panel); |
606 currentWindow = win_entry; | 614 currentWindow = win_entry; |
607 chatmode = TRUE; | 615 chatmode = TRUE; |
608 if (!win_entry->lock) | 616 if (!win_entry->bd->lock) |
609 roster_msg_setflag(winId, special, FALSE); | 617 roster_msg_setflag(winId, special, FALSE); |
610 if (!special) | 618 if (!special) |
611 roster_setflags(winId, ROSTER_FLAG_LOCK, TRUE); | 619 roster_setflags(winId, ROSTER_FLAG_LOCK, TRUE); |
612 update_roster = TRUE; | 620 update_roster = TRUE; |
613 | 621 |
690 if (!win_entry) { | 698 if (!win_entry) { |
691 win_entry = scr_CreateWindow(winId, special, dont_show); | 699 win_entry = scr_CreateWindow(winId, special, dont_show); |
692 } | 700 } |
693 | 701 |
694 // The message must be displayed -> update top pointer | 702 // The message must be displayed -> update top pointer |
695 if (win_entry->cleared) | 703 if (win_entry->bd->cleared) |
696 win_entry->top = g_list_last(win_entry->hbuf); | 704 win_entry->bd->top = g_list_last(win_entry->bd->hbuf); |
697 | 705 |
698 // Make sure we do not free the buffer while it's locked or when | 706 // Make sure we do not free the buffer while it's locked or when |
699 // top is set. | 707 // top is set. |
700 if (win_entry->lock || win_entry->top) | 708 if (win_entry->bd->lock || win_entry->bd->top) |
701 num_history_blocks = 0U; | 709 num_history_blocks = 0U; |
702 else | 710 else |
703 num_history_blocks = get_max_history_blocks(); | 711 num_history_blocks = get_max_history_blocks(); |
704 | 712 |
705 text_locale = from_utf8(text); | 713 text_locale = from_utf8(text); |
706 hbuf_add_line(&win_entry->hbuf, text_locale, timestamp, prefix_flags, | 714 hbuf_add_line(&win_entry->bd->hbuf, text_locale, timestamp, prefix_flags, |
707 maxX - Roster_Width - PREFIX_WIDTH, num_history_blocks); | 715 maxX - Roster_Width - PREFIX_WIDTH, num_history_blocks); |
708 g_free(text_locale); | 716 g_free(text_locale); |
709 | 717 |
710 if (win_entry->cleared) { | 718 if (win_entry->bd->cleared) { |
711 win_entry->cleared = FALSE; | 719 win_entry->bd->cleared = FALSE; |
712 if (g_list_next(win_entry->top)) | 720 if (g_list_next(win_entry->bd->top)) |
713 win_entry->top = g_list_next(win_entry->top); | 721 win_entry->bd->top = g_list_next(win_entry->bd->top); |
714 } | 722 } |
715 | 723 |
716 // Make sure the last line appears in the window; update top if necessary | 724 // Make sure the last line appears in the window; update top if necessary |
717 if (!win_entry->lock && win_entry->top) { | 725 if (!win_entry->bd->lock && win_entry->bd->top) { |
718 int dist; | 726 int dist; |
719 GList *first = g_list_first(win_entry->hbuf); | 727 GList *first = g_list_first(win_entry->bd->hbuf); |
720 dist = g_list_position(first, g_list_last(win_entry->hbuf)) - | 728 dist = g_list_position(first, g_list_last(win_entry->bd->hbuf)) - |
721 g_list_position(first, win_entry->top); | 729 g_list_position(first, win_entry->bd->top); |
722 if (dist >= CHAT_WIN_HEIGHT) | 730 if (dist >= CHAT_WIN_HEIGHT) |
723 win_entry->top = NULL; | 731 win_entry->bd->top = NULL; |
724 } | 732 } |
725 | 733 |
726 if (!dont_show) { | 734 if (!dont_show) { |
727 if (win_entry->lock) | 735 if (win_entry->bd->lock) |
728 setmsgflg = TRUE; | 736 setmsgflg = TRUE; |
729 // Show and refresh the window | 737 // Show and refresh the window |
730 top_panel(win_entry->panel); | 738 top_panel(win_entry->panel); |
731 scr_UpdateWindow(win_entry); | 739 scr_UpdateWindow(win_entry); |
732 top_panel(inputPanel); | 740 top_panel(inputPanel); |
955 werase(wbp->win); | 963 werase(wbp->win); |
956 // If a panel exists, replace the old window with the new | 964 // If a panel exists, replace the old window with the new |
957 if (wbp->panel) | 965 if (wbp->panel) |
958 replace_panel(wbp->panel, wbp->win); | 966 replace_panel(wbp->panel, wbp->win); |
959 // Redo line wrapping | 967 // Redo line wrapping |
960 wbp->top = hbuf_previous_persistent(wbp->top); | 968 wbp->bd->top = hbuf_previous_persistent(wbp->bd->top); |
961 | 969 |
962 new_chatwidth = maxX - Roster_Width - PREFIX_WIDTH; | 970 new_chatwidth = maxX - Roster_Width - PREFIX_WIDTH; |
963 if (new_chatwidth != prev_chatwidth) | 971 if (new_chatwidth != prev_chatwidth) |
964 hbuf_rebuild(&wbp->hbuf, new_chatwidth); | 972 hbuf_rebuild(&wbp->bd->hbuf, new_chatwidth); |
965 } | 973 } |
966 | 974 |
967 // scr_Resize() | 975 // scr_Resize() |
968 // Function called when the window is resized. | 976 // Function called when the window is resized. |
969 // - Resize windows | 977 // - Resize windows |
1039 isspe = btype & ROSTER_TYPE_SPECIAL; | 1047 isspe = btype & ROSTER_TYPE_SPECIAL; |
1040 | 1048 |
1041 if (chatmode && !isgrp) { | 1049 if (chatmode && !isgrp) { |
1042 winbuf *win_entry; | 1050 winbuf *win_entry; |
1043 win_entry = scr_SearchWindow(buddy_getjid(BUDDATA(current_buddy)), isspe); | 1051 win_entry = scr_SearchWindow(buddy_getjid(BUDDATA(current_buddy)), isspe); |
1044 if (win_entry && win_entry->lock) | 1052 if (win_entry && win_entry->bd->lock) |
1045 mvwprintw(chatstatusWnd, 0, 0, "*"); | 1053 mvwprintw(chatstatusWnd, 0, 0, "*"); |
1046 } | 1054 } |
1047 | 1055 |
1048 if (isgrp || isspe) { | 1056 if (isgrp || isspe) { |
1049 buf_locale = from_utf8(fullname); | 1057 buf_locale = from_utf8(fullname); |
1707 // Scroll half a screen (or less) | 1715 // Scroll half a screen (or less) |
1708 nbl = CHAT_WIN_HEIGHT/2; | 1716 nbl = CHAT_WIN_HEIGHT/2; |
1709 } else { | 1717 } else { |
1710 nbl = nblines; | 1718 nbl = nblines; |
1711 } | 1719 } |
1712 hbuf_top = win_entry->top; | 1720 hbuf_top = win_entry->bd->top; |
1713 | 1721 |
1714 if (updown == -1) { // UP | 1722 if (updown == -1) { // UP |
1715 if (!hbuf_top) { | 1723 if (!hbuf_top) { |
1716 hbuf_top = g_list_last(win_entry->hbuf); | 1724 hbuf_top = g_list_last(win_entry->bd->hbuf); |
1717 if (!win_entry->cleared) { | 1725 if (!win_entry->bd->cleared) { |
1718 if (!nblines) nbl = nbl*3 - 1; | 1726 if (!nblines) nbl = nbl*3 - 1; |
1719 else nbl += CHAT_WIN_HEIGHT - 1; | 1727 else nbl += CHAT_WIN_HEIGHT - 1; |
1720 } else { | 1728 } else { |
1721 win_entry->cleared = FALSE; | 1729 win_entry->bd->cleared = FALSE; |
1722 } | 1730 } |
1723 } | 1731 } |
1724 for (n=0 ; hbuf_top && n < nbl && g_list_previous(hbuf_top) ; n++) | 1732 for (n=0 ; hbuf_top && n < nbl && g_list_previous(hbuf_top) ; n++) |
1725 hbuf_top = g_list_previous(hbuf_top); | 1733 hbuf_top = g_list_previous(hbuf_top); |
1726 win_entry->top = hbuf_top; | 1734 win_entry->bd->top = hbuf_top; |
1727 } else { // DOWN | 1735 } else { // DOWN |
1728 for (n=0 ; hbuf_top && n < nbl ; n++) | 1736 for (n=0 ; hbuf_top && n < nbl ; n++) |
1729 hbuf_top = g_list_next(hbuf_top); | 1737 hbuf_top = g_list_next(hbuf_top); |
1730 win_entry->top = hbuf_top; | 1738 win_entry->bd->top = hbuf_top; |
1731 // Check if we are at the bottom | 1739 // Check if we are at the bottom |
1732 for (n=0 ; hbuf_top && n < CHAT_WIN_HEIGHT-1 ; n++) | 1740 for (n=0 ; hbuf_top && n < CHAT_WIN_HEIGHT-1 ; n++) |
1733 hbuf_top = g_list_next(hbuf_top); | 1741 hbuf_top = g_list_next(hbuf_top); |
1734 if (!hbuf_top) | 1742 if (!hbuf_top) |
1735 win_entry->top = NULL; // End reached | 1743 win_entry->bd->top = NULL; // End reached |
1736 } | 1744 } |
1737 | 1745 |
1738 // Refresh the window | 1746 // Refresh the window |
1739 scr_UpdateWindow(win_entry); | 1747 scr_UpdateWindow(win_entry); |
1740 | 1748 |
1753 if (!current_buddy) return; | 1761 if (!current_buddy) return; |
1754 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; | 1762 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; |
1755 win_entry = scr_SearchWindow(CURRENT_JID, isspe); | 1763 win_entry = scr_SearchWindow(CURRENT_JID, isspe); |
1756 if (!win_entry) return; | 1764 if (!win_entry) return; |
1757 | 1765 |
1758 win_entry->cleared = TRUE; | 1766 win_entry->bd->cleared = TRUE; |
1759 win_entry->top = NULL; | 1767 win_entry->bd->top = NULL; |
1760 | 1768 |
1761 // Refresh the window | 1769 // Refresh the window |
1762 scr_UpdateWindow(win_entry); | 1770 scr_UpdateWindow(win_entry); |
1763 | 1771 |
1764 // Finished :) | 1772 // Finished :) |
1774 { | 1782 { |
1775 int closebuf = (gint)data; // XXX GPOINTER_TO_INT? | 1783 int closebuf = (gint)data; // XXX GPOINTER_TO_INT? |
1776 winbuf *win_entry = value; | 1784 winbuf *win_entry = value; |
1777 | 1785 |
1778 // Delete the current hbuf | 1786 // Delete the current hbuf |
1779 hbuf_free(&win_entry->hbuf); | 1787 hbuf_free(&win_entry->bd->hbuf); |
1780 | 1788 |
1781 if (closebuf) { | 1789 if (closebuf) { |
1782 g_hash_table_remove(winbufhash, key); | 1790 g_hash_table_remove(winbufhash, key); |
1783 } else { | 1791 } else { |
1784 win_entry->cleared = FALSE; | 1792 win_entry->bd->cleared = FALSE; |
1785 win_entry->top = NULL; | 1793 win_entry->bd->top = NULL; |
1786 } | 1794 } |
1787 } | 1795 } |
1788 | 1796 |
1789 // scr_BufferPurge(closebuf) | 1797 // scr_BufferPurge(closebuf) |
1790 // Purge/Drop the current buddy buffer | 1798 // Purge/Drop the current buddy buffer |
1808 currentWindow = NULL; | 1816 currentWindow = NULL; |
1809 } | 1817 } |
1810 } else { | 1818 } else { |
1811 // (Special buffer) | 1819 // (Special buffer) |
1812 // Reset the current hbuf | 1820 // Reset the current hbuf |
1813 hbuf_free(&win_entry->hbuf); | 1821 hbuf_free(&win_entry->bd->hbuf); |
1814 // Currently it can only be the status buffer | 1822 // Currently it can only be the status buffer |
1815 statushbuf = NULL; | 1823 statushbuf = NULL; |
1816 | 1824 |
1817 win_entry->cleared = FALSE; | 1825 win_entry->bd->cleared = FALSE; |
1818 win_entry->top = NULL; | 1826 win_entry->bd->top = NULL; |
1819 } | 1827 } |
1820 | 1828 |
1821 // Refresh the window | 1829 // Refresh the window |
1822 scr_UpdateBuddyWindow(); | 1830 scr_UpdateBuddyWindow(); |
1823 | 1831 |
1857 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; | 1865 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; |
1858 win_entry = scr_SearchWindow(CURRENT_JID, isspe); | 1866 win_entry = scr_SearchWindow(CURRENT_JID, isspe); |
1859 if (!win_entry) return; | 1867 if (!win_entry) return; |
1860 | 1868 |
1861 if (lock == -1) | 1869 if (lock == -1) |
1862 lock = !win_entry->lock; | 1870 lock = !win_entry->bd->lock; |
1863 | 1871 |
1864 if (lock) { | 1872 if (lock) { |
1865 win_entry->lock = TRUE; | 1873 win_entry->bd->lock = TRUE; |
1866 } else { | 1874 } else { |
1867 win_entry->lock = FALSE; | 1875 win_entry->bd->lock = FALSE; |
1868 //win_entry->cleared = FALSE; | 1876 //win_entry->bd->cleared = FALSE; |
1869 if (isspe || (buddy_getflags(BUDDATA(current_buddy)) & ROSTER_FLAG_MSG)) | 1877 if (isspe || (buddy_getflags(BUDDATA(current_buddy)) & ROSTER_FLAG_MSG)) |
1870 win_entry->top = NULL; | 1878 win_entry->bd->top = NULL; |
1871 } | 1879 } |
1872 | 1880 |
1873 // If chatmode is disabled and we're at the bottom of the buffer, | 1881 // If chatmode is disabled and we're at the bottom of the buffer, |
1874 // we need to set the "top" line, so we need to call scr_ShowBuddyWindow() | 1882 // we need to set the "top" line, so we need to call scr_ShowBuddyWindow() |
1875 // at least once. (Maybe it will cause a double refresh...) | 1883 // at least once. (Maybe it will cause a double refresh...) |
1876 if (!chatmode && !win_entry->top) { | 1884 if (!chatmode && !win_entry->bd->top) { |
1877 chatmode = TRUE; | 1885 chatmode = TRUE; |
1878 scr_ShowBuddyWindow(); | 1886 scr_ShowBuddyWindow(); |
1879 chatmode = FALSE; | 1887 chatmode = FALSE; |
1880 } | 1888 } |
1881 | 1889 |
1898 if (!current_buddy) return; | 1906 if (!current_buddy) return; |
1899 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; | 1907 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; |
1900 win_entry = scr_SearchWindow(CURRENT_JID, isspe); | 1908 win_entry = scr_SearchWindow(CURRENT_JID, isspe); |
1901 if (!win_entry) return; | 1909 if (!win_entry) return; |
1902 | 1910 |
1903 win_entry->cleared = FALSE; | 1911 win_entry->bd->cleared = FALSE; |
1904 if (topbottom == 1) | 1912 if (topbottom == 1) |
1905 win_entry->top = NULL; | 1913 win_entry->bd->top = NULL; |
1906 else | 1914 else |
1907 win_entry->top = g_list_first(win_entry->hbuf); | 1915 win_entry->bd->top = g_list_first(win_entry->bd->hbuf); |
1908 | 1916 |
1909 // Refresh the window | 1917 // Refresh the window |
1910 scr_UpdateWindow(win_entry); | 1918 scr_UpdateWindow(win_entry); |
1911 | 1919 |
1912 // Finished :) | 1920 // Finished :) |
1926 if (!current_buddy) return; | 1934 if (!current_buddy) return; |
1927 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; | 1935 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; |
1928 win_entry = scr_SearchWindow(CURRENT_JID, isspe); | 1936 win_entry = scr_SearchWindow(CURRENT_JID, isspe); |
1929 if (!win_entry) return; | 1937 if (!win_entry) return; |
1930 | 1938 |
1931 if (win_entry->top) | 1939 if (win_entry->bd->top) |
1932 current_line = win_entry->top; | 1940 current_line = win_entry->bd->top; |
1933 else | 1941 else |
1934 current_line = g_list_last(win_entry->hbuf); | 1942 current_line = g_list_last(win_entry->bd->hbuf); |
1935 | 1943 |
1936 search_res = hbuf_search(current_line, direction, text); | 1944 search_res = hbuf_search(current_line, direction, text); |
1937 | 1945 |
1938 if (search_res) { | 1946 if (search_res) { |
1939 win_entry->cleared = FALSE; | 1947 win_entry->bd->cleared = FALSE; |
1940 win_entry->top = search_res; | 1948 win_entry->bd->top = search_res; |
1941 | 1949 |
1942 // Refresh the window | 1950 // Refresh the window |
1943 scr_UpdateWindow(win_entry); | 1951 scr_UpdateWindow(win_entry); |
1944 | 1952 |
1945 // Finished :) | 1953 // Finished :) |
1965 if (pc < 0 || pc > 100) { | 1973 if (pc < 0 || pc > 100) { |
1966 scr_LogPrint(LPRINT_NORMAL, "Bad % value"); | 1974 scr_LogPrint(LPRINT_NORMAL, "Bad % value"); |
1967 return; | 1975 return; |
1968 } | 1976 } |
1969 | 1977 |
1970 search_res = hbuf_jump_percent(win_entry->hbuf, pc); | 1978 search_res = hbuf_jump_percent(win_entry->bd->hbuf, pc); |
1971 | 1979 |
1972 win_entry->cleared = FALSE; | 1980 win_entry->bd->cleared = FALSE; |
1973 win_entry->top = search_res; | 1981 win_entry->bd->top = search_res; |
1974 | 1982 |
1975 // Refresh the window | 1983 // Refresh the window |
1976 scr_UpdateWindow(win_entry); | 1984 scr_UpdateWindow(win_entry); |
1977 | 1985 |
1978 // Finished :) | 1986 // Finished :) |
1992 if (!current_buddy) return; | 2000 if (!current_buddy) return; |
1993 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; | 2001 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; |
1994 win_entry = scr_SearchWindow(CURRENT_JID, isspe); | 2002 win_entry = scr_SearchWindow(CURRENT_JID, isspe); |
1995 if (!win_entry) return; | 2003 if (!win_entry) return; |
1996 | 2004 |
1997 search_res = hbuf_jump_date(win_entry->hbuf, t); | 2005 search_res = hbuf_jump_date(win_entry->bd->hbuf, t); |
1998 | 2006 |
1999 win_entry->cleared = FALSE; | 2007 win_entry->bd->cleared = FALSE; |
2000 win_entry->top = search_res; | 2008 win_entry->bd->top = search_res; |
2001 | 2009 |
2002 // Refresh the window | 2010 // Refresh the window |
2003 scr_UpdateWindow(win_entry); | 2011 scr_UpdateWindow(win_entry); |
2004 | 2012 |
2005 // Finished :) | 2013 // Finished :) |
2044 else | 2052 else |
2045 current_id = buddy_getjid(BUDDATA(current_buddy)); | 2053 current_id = buddy_getjid(BUDDATA(current_buddy)); |
2046 if (current_id) { | 2054 if (current_id) { |
2047 winbuf *win_entry = scr_SearchWindow(current_id, special); | 2055 winbuf *win_entry = scr_SearchWindow(current_id, special); |
2048 if (!win_entry) return; | 2056 if (!win_entry) return; |
2049 iscurrentlocked = win_entry->lock; | 2057 iscurrentlocked = win_entry->bd->lock; |
2050 } | 2058 } |
2051 } else { | 2059 } else { |
2052 current_id = NULL; | 2060 current_id = NULL; |
2053 } | 2061 } |
2054 if (!chatmode || !current_id || strcmp(bjid, current_id) || iscurrentlocked) | 2062 if (!chatmode || !current_id || strcmp(bjid, current_id) || iscurrentlocked) |