File: userlist.rb

package info (click to toggle)
mikutter 3.8.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,544 kB
  • sloc: ruby: 20,548; sh: 99; makefile: 19
file content (21 lines) | stat: -rw-r--r-- 489 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# -*- coding: utf-8 -*-

# 最後にやりとりしたDMの日時でソートする機能のついたUserlist
module Plugin::DirectMessage
  class UserList < Gtk::UserList
    def initialize
      super
      @dm_last_date = Hash.new
    end

    def gen_order(user)
      @dm_last_date[user.id] || 0 end

    def update(update_hash)
      update_hash.each do |user, last_date|
        @dm_last_date[user[:id]] = last_date.to_i
      end
      add_user(update_hash.keys)
    end
  end
end