Example #1
0
 def set_inactive(self):
     self.presence = "away"
     for channel in self.server.channels:
         if channel.has_user(self.identifier):
             channel.update_nicklist()
     w.nicklist_nick_set(self.server.buffer, self.nicklist_pointer, "prefix", " ")
     w.nicklist_nick_set(self.server.buffer, self.nicklist_pointer, "visible", "0")
Example #2
0
 def set_inactive(self):
     self.presence = "away"
     for channel in self.server.channels:
         if channel.has_user(self.identifier):
             channel.update_nicklist()
     w.nicklist_nick_set(self.server.buffer, self.nicklist_pointer,
                         "prefix", " ")
     w.nicklist_nick_set(self.server.buffer, self.nicklist_pointer,
                         "visible", "0")
Example #3
0
def process_presence_change(data):
  global nick_ptr
  if data["user"] == nick:
    nick_ptr = w.nicklist_search_nick(general_buffer_ptr,'',nick)
    if data["presence"] == 'active':
      w.nicklist_nick_set(general_buffer_ptr, nick_ptr, "prefix", "+")
    else:
      w.nicklist_nick_set(general_buffer_ptr, nick_ptr, "prefix", " ")
  else:
    pass
Example #4
0
def update_fullname(buffer, name):
    if name not in nicklist:
        weechat.prnt('', 'Name %s not known' % name)
        return
    nick = weechat.nicklist_search_nick(buffer, '', name)
    if not nick:
        weechat.prnt('', 'Nick not found for %r in %s' % (name, buffer))
        return

    fullname = encode(nicklist[name]['name'])
    prefix = weechat.nicklist_nick_get_string(buffer, nick, 'prefix')
    if not prefix.startswith(fullname):
        prefix = '%s %s' % (fullname, prefix)
        weechat.nicklist_nick_set(buffer, nick, 'prefix', prefix)
Example #5
0
def buf_room_add(buf, nick, groupname=""):
	if weechat.nicklist_search_group(buf, "", "members") == "":
		weechat.nicklist_add_group(buf, "", "members", "weechat.color.nicklist_group", 1)
	nickbufp = weechat.nicklist_add_nick(buf, groupname, nick, "bar_fg", "", "bar_fg", 1)
	weechat.nicklist_nick_set(buf, nickbufp, "color", "white")
Example #6
0
def roomRead(pssName, _):
	global _tmp_room_initial

	for r in cache.rooms.values():

		if not _tmp_room_initial[r.get_name()]:
			continue

		msgs = []

		ctx = EventContext()
		ctx.reset(PSS_BUFTYPE_ROOM, pssName, r.get_name())
		buf = weechat.buffer_search("python", ctx.to_buffer_name())

		(_, fails) = r.feedcollection.gethead(cache.get_active_bzz(), True)
		for f in fails:
			nick = cache.get_contact_by_public_key(f.get_public_key()).get_nick()
			nickbufp = weechat.nicklist_search_nick(buf, "", nick)
			#weechat.nicklist_remove_nick(buf, nickbufp)
			weechat.nicklist_nick_set(buf, nickbufp, "color", "240")
			wOut(
				PSS_BUFPFX_WARN,
				[buf],
				"---",
				"Feed for '" +  nick + "' timed out and has been deactivated. Read-add manually to reactivate"
			)


		msgs = r.feedcollection.get()
		#sys.stderr.write("getting feed for room: " + repr(r) + ": " + "msglen" + repr(len(msgs)))

		for m in msgs:

			# use set nick if message sender is self
			# \todo eliminate, move to instant feedback on send for self
			contact = None
			nick = ""
			ps = cache.get_pss(ctx.get_node())
			if ps.get_public_key() == m.key:
				contact = ps.account
				nick = cache.get_nodeself(ctx.get_node())
			# \todo use binary key repr in nicks dict
			else:
				contact = cache.get_contact_by_public_key(m.key)
				nick = contact.get_nick()

			msg = r.extract_message(m.content, contact)

			wOut(
				PSS_BUFPFX_DEBUG,
				[],
				">>>",
				"write buf " + ctx.to_buffer_name() + " room " + r.get_name()
			)
			wOut(
				PSS_BUFPFX_IN,
				[buf],
				nick,
				msg
			)


	return weechat.WEECHAT_RC_OK