示例#1
0
 def update_nicklist(self):
     w.buffer_set(self.channel_buffer, "nicklist", "1")
     w.nicklist_remove_all(self.channel_buffer)
     for user in self.members:
         user = self.server.users.find(user)
         if user.presence == 'away':
             w.nicklist_add_nick(self.channel_buffer, "", user.name, user.color(), " ", "", 1)
         else:
             w.nicklist_add_nick(self.channel_buffer, "", user.name, user.color(), "+", "", 1)
示例#2
0
 def update_nicklist(self):
     w.buffer_set(self.channel_buffer, "nicklist", "1")
     w.nicklist_remove_all(self.channel_buffer)
     for user in self.members:
         user = self.server.users.find(user)
         if user.presence == 'away':
             w.nicklist_add_nick(self.channel_buffer, "", user.name,
                                 user.color(), " ", "", 1)
         else:
             w.nicklist_add_nick(self.channel_buffer, "", user.name,
                                 user.color(), "+", "", 1)
示例#3
0
 def disconnect(self):
     if self.hook_fd is not None:
         weechat.unhook(self.hook_fd)
     if self.socket is not None:
         self.socket.close()
     if self.buffer is not None:
         self.contacts = {}
         weechat.nicklist_remove_all(self.buffer)
         weechat.prnt(self.buffer, '... Disconnected ...')
     self.hook_fd = None
     self.socket = None
     self.contacts = {}
示例#4
0
 def disconnect(self) :
     if self.hook_fd is not None :
         weechat.unhook(self.hook_fd)
     if self.socket is not None :
         self.socket.close()
     if self.buffer is not None :
         self.contacts = {}
         weechat.nicklist_remove_all(self.buffer)
         weechat.prnt(self.buffer, '... Disconnected ...')
     self.hook_fd = None
     self.socket = None
     self.contacts = {}
示例#5
0
def nicklist_timer(data, remaining_calls):
    for server in xd:
        users_r = requests.get(urljoin(server, "api/user-list"))
        users = users_r.json()["users"]
        for channel in xd[server]["channels"].itervalues():
            weechat.nicklist_remove_all(channel["buffer"])
            group = weechat.nicklist_add_group(channel["buffer"], "", "Users",
                                               "weechat.color.nicklist_group",
                                               1)
            for u in users:
                weechat.nicklist_add_nick(
                    channel["buffer"], group, u["username"],
                    "default" if u["online"] else "lightgrey", "",
                    "lightgreen", 1)
    return weechat.WEECHAT_RC_OK