void quassel_irssi_set_last_seen_msg(void *arg, int buffer_id, int msgid) { (void) msgid; Quassel_SERVER_REC *server = (Quassel_SERVER_REC*)arg; if(!PROTO_CHECK_CAST(SERVER(server), Quassel_SERVER_REC, chat_type, "Quassel")) return; Quassel_CHANNEL_REC* chanrec = NULL; //First find channel GSList *chans = server->channels; while(chans) { chanrec = (Quassel_CHANNEL_REC*) chans->data; if(chanrec->buffer_id == buffer_id) break; chanrec = NULL; chans = g_slist_next(chans); } if(!chanrec) return; chanrec->last_seen_msg_id = msgid; if(chanrec->init_last_seen_msg_id == -1) chanrec->init_last_seen_msg_id = msgid; //Now find windows GSList *win = windows; while(win) { WINDOW_REC* winrec = (WINDOW_REC*) win->data; if(winrec->active_server != SERVER(server) && winrec->connect_server != SERVER(server)) goto next; if(!winrec->active) goto next; if(strcmp(winrec->active->visible_name, chanrec->name)==0) { signal_emit("window dehilight", 1, winrec); if(winrec != active_win) { LINE_REC *linerec = textbuffer_view_get_bookmark(WINDOW_GUI(winrec)->view, "trackbar"); if(linerec) textbuffer_view_remove_line(WINDOW_GUI(winrec)->view, linerec); char *str = malloc(winrec->width+3); str[0] = '%'; str[1] = 'K'; for(int i=0; i<winrec->width; ++i) str[i+2]='-'; str[winrec->width+2]=0; printtext_string_window(winrec, MSGLEVEL_NEVER, str); free(str); textbuffer_view_set_bookmark_bottom(WINDOW_GUI(winrec)->view, "trackbar"); } } next: win = g_slist_next(win); } }
static void window_print_daychange(WINDOW_REC *window, struct tm *tm) { THEME_REC *theme; TEXT_DEST_REC dest; char *format, str[256]; theme = active_win->theme != NULL ? active_win->theme : current_theme; format_create_dest(&dest, NULL, NULL, MSGLEVEL_NEVER, window); format = format_get_text_theme(theme, MODULE_NAME, &dest, TXT_DAYCHANGE); if (strftime(str, sizeof(str), format, tm) <= 0) str[0] = '\0'; g_free(format); printtext_string_window(window, MSGLEVEL_NEVER, str); }