Cleanup
This commit is contained in:
@@ -604,16 +604,12 @@ win_page_up(ProfWin* window)
|
||||
if (*page_start == -page_space && prefs_get_boolean(PREF_MAM) && window->type == WIN_CHAT) {
|
||||
ProfChatWin* chatwin = (ProfChatWin*) window;
|
||||
ProfBuffEntry* first_entry = buffer_size(window->layout->buffer) != 0 ? buffer_get_entry(window->layout->buffer, 0) : NULL;
|
||||
char* loading_text = "Loading older messages ...";
|
||||
|
||||
// Don't do anything if still fetching mam messages
|
||||
if (first_entry && !(first_entry->theme_item == THEME_ROOMINFO && g_strcmp0(first_entry->message, loading_text) == 0)) {
|
||||
if (first_entry && !(first_entry->theme_item == THEME_ROOMINFO && g_strcmp0(first_entry->message, LOADING_MESSAGE) == 0)) {
|
||||
if (!chatwin_old_history(chatwin, NULL)) {
|
||||
cons_show("Fetched mam");
|
||||
win_print_loading_history(window);
|
||||
iq_mam_request_older(chatwin);
|
||||
} else {
|
||||
cons_show("Showed history");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1857,9 +1853,8 @@ win_redraw(ProfWin* window)
|
||||
void
|
||||
win_print_loading_history(ProfWin* window)
|
||||
{
|
||||
char* loading_text = "Loading older messages ...";
|
||||
GDateTime* timestamp = buffer_size(window->layout->buffer) != 0 ? buffer_get_entry(window->layout->buffer, 0)->time : g_date_time_new_now_local();
|
||||
buffer_prepend(window->layout->buffer, "-", 0, timestamp, NO_DATE, THEME_ROOMINFO, NULL, NULL, loading_text, NULL, NULL);
|
||||
buffer_prepend(window->layout->buffer, "-", 0, timestamp, NO_DATE, THEME_ROOMINFO, NULL, NULL, LOADING_MESSAGE, NULL, NULL);
|
||||
win_redraw(window);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user