def get_last_line_date(buffer): date = '1970-01-01 01:00:00' infolist = w.infolist_get('buffer_lines', buffer, '') while w.infolist_prev(infolist): date = w.infolist_time(infolist, 'date') if date != '1970-01-01 01:00:00': # Some lines like "Day changed to" message doesn't have date # set so loop until we find a message that does break w.infolist_free(infolist) return date
def get_last_line_date(buffer): date = "1970-01-01 01:00:00" infolist = w.infolist_get("buffer_lines", buffer, "") while w.infolist_prev(infolist): date = w.infolist_time(infolist, "date") if date != "1970-01-01 01:00:00": # Some lines like "Day changed to" message doesn't have date # set so loop until we find a message that does break w.infolist_free(infolist) return date
def privmsgs(ptr): lines = weechat.infolist_get('buffer_lines', ptr, '') chan = weechat.buffer_get_string(ptr, 'localvar_channel') while weechat.infolist_prev(lines): kind, nick, text = lineextract(lines) if kind == 'irc_privmsg': yield chan, nick, text weechat.infolist_free(lines)
def get_last_line_date(buffer): date = '1970-01-01 01:00:00' infolist = w.infolist_get('buffer_lines', buffer, '') while w.infolist_prev(infolist): date = w.infolist_time(infolist, 'date') # since WeeChat 2.2, infolist_time returns a long integer instead of # a string if not isinstance(date, str): date = time.strftime('%F %T', time.localtime(int(date))) if date != '1970-01-01 01:00:00': # Some lines like "Day changed to" message doesn't have date # set so loop until we find a message that does break w.infolist_free(infolist) return date
def prev(self): self.cursor = weechat.infolist_prev(self.pointer) return self.cursor
def dev_pev(ptr): """ prev an infolist """ if w.infolist_prev(ptr): w.prnt("", f"cursor moved to previous item for infolist {ptr}") else: w.prnt("", f"cursor reached beginning of infolist {ptr}")