예제 #1
0
파일: vcard.py 프로젝트: pacoqueen/bbinn
	def fill_jabber_page(self):
		tooltips = gtk.Tooltips()
		self.xml.get_widget('nickname_label').set_text(self.contact.name)
		self.xml.get_widget('jid_label').set_text(self.contact.jid)
		uf_sub = helpers.get_uf_sub(self.contact.sub)
		self.xml.get_widget('subscription_label').set_text(uf_sub)
		eb = self.xml.get_widget('subscription_label_eventbox')
		if self.contact.sub == 'from':
			tt_text = _("This contact is interested in your presence information, but you are not interested in his/her presence")
		elif self.contact.sub == 'to':
			tt_text = _("You are interested in the contact's presence information, but he/she is not interested in yours")
		elif self.contact.sub == 'both':
			tt_text = _("You and the contact are interested in each other's presence information")
		else: # None
			tt_text = _("You are not interested in the contact's presence, and neither he/she is interested in yours")
		tooltips.set_tip(eb, tt_text)

		label = self.xml.get_widget('ask_label')
		uf_ask = helpers.get_uf_ask(self.contact.ask)
		label.set_text(uf_ask)
		eb = self.xml.get_widget('ask_label_eventbox')
		if self.contact.ask == 'subscribe':
			tooltips.set_tip(eb,
			_("You are waiting contact's answer about your subscription request"))
		self.xml.get_widget('nickname_entry').set_text(self.contact.name)
		log = True
		if self.contact.jid in gajim.config.get_per('accounts', self.account,
			'no_log_for').split(' '):
			log = False
		checkbutton = self.xml.get_widget('log_history_checkbutton')
		checkbutton.set_active(log)
		checkbutton.connect('toggled', self.on_log_history_checkbutton_toggled)
		
		resources = '%s (%s)' % (self.contact.resource, unicode(
			self.contact.priority))
		uf_resources = self.contact.resource + _(' resource with priority ')\
			+ unicode(self.contact.priority)
		if not self.contact.status:
			self.contact.status = ''
		
		# stats holds show and status message
		stats = helpers.get_uf_show(self.contact.show)
		if self.contact.status:
			stats += ': ' + self.contact.status
		gajim.connections[self.account].request_os_info(self.contact.jid,
			self.contact.resource)
		self.os_info = {0: {'resource': self.contact.resource, 'client': '',
			'os': ''}}
		i = 1
		if gajim.contacts[self.account].has_key(self.contact.jid):
			for c in gajim.contacts[self.account][self.contact.jid]:
				if c.resource != self.contact.resource:
					resources += '\n%s (%s)' % (c.resource,
						unicode(c.priority))
					uf_resources += '\n' + c.resource + _(' resource with priority ')\
						+ unicode(c.priority)
					if not c.status:
						c.status = ''
					stats += '\n' + c.show + ': ' + c.status
					gajim.connections[self.account].request_os_info(self.contact.jid,
						c.resource)
					self.os_info[i] = {'resource': c.resource, 'client': '',
						'os': ''}
					i += 1
		self.xml.get_widget('resource_prio_label').set_text(resources)
		tip = gtk.Tooltips()
		resource_prio_label_eventbox = self.xml.get_widget(
			'resource_prio_label_eventbox')
		tip.set_tip(resource_prio_label_eventbox, uf_resources)
		
		tip = gtk.Tooltips()
		status_label_eventbox = self.xml.get_widget('status_label_eventbox')
		tip.set_tip(status_label_eventbox, stats)
		status_label = self.xml.get_widget('status_label')
		status_label.set_max_width_chars(15)
		status_label.set_text(stats)
		
		gajim.connections[self.account].request_vcard(self.contact.jid)
예제 #2
0
파일: vcard.py 프로젝트: jabber-at/gajim
    def fill_jabber_page(self):
        self.xml.get_object('nickname_label').set_markup(
                '<b><span size="x-large">' +
                self.contact.get_shown_name() +
                '</span></b>')
        self.xml.get_object('jid_label').set_text(self.contact.jid)

        subscription_label = self.xml.get_object('subscription_label')
        ask_label = self.xml.get_object('ask_label')
        if self.gc_contact:
            self.xml.get_object('subscription_title_label').set_markup(Q_("?Role in Group Chat:<b>Role:</b>"))
            uf_role = helpers.get_uf_role(self.gc_contact.role)
            subscription_label.set_text(uf_role)

            self.xml.get_object('ask_title_label').set_markup(_("<b>Affiliation:</b>"))
            uf_affiliation = helpers.get_uf_affiliation(self.gc_contact.affiliation)
            ask_label.set_text(uf_affiliation)
        else:
            uf_sub = helpers.get_uf_sub(self.contact.sub)
            subscription_label.set_text(uf_sub)
            eb = self.xml.get_object('subscription_label_eventbox')
            if self.contact.sub == 'from':
                tt_text = _("This contact is interested in your presence information, but you are not interested in his/her presence")
            elif self.contact.sub == 'to':
                tt_text = _("You are interested in the contact's presence information, but he/she is not interested in yours")
            elif self.contact.sub == 'both':
                tt_text = _("You and the contact are interested in each other's presence information")
            else: # None
                tt_text = _("You are not interested in the contact's presence, and neither he/she is interested in yours")
            eb.set_tooltip_text(tt_text)

            uf_ask = helpers.get_uf_ask(self.contact.ask)
            ask_label.set_text(uf_ask)
            eb = self.xml.get_object('ask_label_eventbox')
            if self.contact.ask == 'subscribe':
                tt_text = _("You are waiting contact's answer about your subscription request")
            else:
                tt_text = _("There is no pending subscription request.")
            eb.set_tooltip_text(tt_text)

        resources = '%s (%s)' % (self.contact.resource, unicode(
                self.contact.priority))
        uf_resources = self.contact.resource + _(' resource with priority ')\
                + unicode(self.contact.priority)
        if not self.contact.status:
            self.contact.status = ''

        # Request list time status only if contact is offline
        if self.contact.show == 'offline':
            if self.gc_contact:
                j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
                gajim.connections[self.account].request_last_status_time(j, r,
                        self.contact.jid)
            else:
                gajim.connections[self.account].request_last_status_time(
                        self.contact.jid, '')

        # do not wait for os_info if contact is not connected or has error
        # additional check for observer is needed, as show is offline for him
        if self.contact.show in ('offline', 'error')\
        and not self.contact.is_observer():
            self.os_info_arrived = True
        else: # Request os info if contact is connected
            if self.gc_contact:
                j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
                gobject.idle_add(gajim.connections[self.account].request_os_info,
                        j, r, self.contact.jid)
            else:
                gobject.idle_add(gajim.connections[self.account].request_os_info,
                        self.contact.jid, self.contact.resource)

        # do not wait for entity_time if contact is not connected or has error
        # additional check for observer is needed, as show is offline for him
        if self.contact.show in ('offline', 'error')\
        and not self.contact.is_observer():
            self.entity_time_arrived = True
        else: # Request entity time if contact is connected
            if self.gc_contact:
                j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
                gobject.idle_add(gajim.connections[self.account].\
                        request_entity_time, j, r, self.contact.jid)
            else:
                gobject.idle_add(gajim.connections[self.account].\
                        request_entity_time, self.contact.jid, self.contact.resource)

        self.os_info = {0: {'resource': self.real_resource, 'client': '',
                'os': ''}}
        self.time_info = {0: {'resource': self.real_resource, 'time': ''}}
        i = 1
        contact_list = gajim.contacts.get_contacts(self.account, self.contact.jid)
        if contact_list:
            for c in contact_list:
                if c.resource != self.contact.resource:
                    resources += '\n%s (%s)' % (c.resource,
                            unicode(c.priority))
                    uf_resources += '\n' + c.resource + \
                            _(' resource with priority ') + unicode(c.priority)
                    if c.show not in ('offline', 'error'):
                        gobject.idle_add(
                                gajim.connections[self.account].request_os_info, c.jid,
                                c.resource)
                        gobject.idle_add(gajim.connections[self.account].\
                                request_entity_time, c.jid, c.resource)
                    self.os_info[i] = {'resource': c.resource, 'client': '',
                            'os': ''}
                    self.time_info[i] = {'resource': c.resource, 'time': ''}
                    i += 1

        self.xml.get_object('resource_prio_label').set_text(resources)
        resource_prio_label_eventbox = self.xml.get_object(
                'resource_prio_label_eventbox')
        resource_prio_label_eventbox.set_tooltip_text(uf_resources)

        self.fill_status_label()

        if self.gc_contact:
            # If we know the real jid, remove the resource from vcard request
            gajim.connections[self.account].request_vcard(self.real_jid_for_vcard,
                    self.gc_contact.get_full_jid())
        else:
            gajim.connections[self.account].request_vcard(self.contact.jid)
예제 #3
0
    def fill_jabber_page(self):
        self.xml.get_object('nickname_label').set_markup(
            '<b><span size="x-large">' + self.contact.get_shown_name() +
            '</span></b>')
        self.xml.get_object('jid_label').set_text(self.contact.jid)

        subscription_label = self.xml.get_object('subscription_label')
        ask_label = self.xml.get_object('ask_label')
        if self.gc_contact:
            self.xml.get_object('subscription_title_label').set_markup(
                Q_("?Role in Group Chat:<b>Role:</b>"))
            uf_role = helpers.get_uf_role(self.gc_contact.role)
            subscription_label.set_text(uf_role)

            self.xml.get_object('ask_title_label').set_markup(
                _("<b>Affiliation:</b>"))
            uf_affiliation = helpers.get_uf_affiliation(
                self.gc_contact.affiliation)
            ask_label.set_text(uf_affiliation)
        else:
            uf_sub = helpers.get_uf_sub(self.contact.sub)
            subscription_label.set_text(uf_sub)
            eb = self.xml.get_object('subscription_label_eventbox')
            if self.contact.sub == 'from':
                tt_text = _(
                    "This contact is interested in your presence information, but you are not interested in their presence"
                )
            elif self.contact.sub == 'to':
                tt_text = _(
                    "You are interested in the contact's presence information, but it is not mutual"
                )
            elif self.contact.sub == 'both':
                tt_text = _(
                    "The contact and you want to exchange presence information"
                )
            else:  # None
                tt_text = _(
                    "You and the contact have a mutual disinterest in each-others presence information"
                )
            eb.set_tooltip_text(tt_text)

            uf_ask = helpers.get_uf_ask(self.contact.ask)
            ask_label.set_text(uf_ask)
            eb = self.xml.get_object('ask_label_eventbox')
            if self.contact.ask == 'subscribe':
                tt_text = _(
                    "You are waiting contact's answer about your subscription request"
                )
            else:
                tt_text = _("There is no pending subscription request.")
            eb.set_tooltip_text(tt_text)

        resources = '%s (%s)' % (self.contact.resource,
                                 str(self.contact.priority))
        uf_resources = self.contact.resource + _(' resource with priority ')\
                + str(self.contact.priority)
        if not self.contact.status:
            self.contact.status = ''

        # Request list time status only if contact is offline
        if self.contact.show == 'offline':
            if self.gc_contact:
                j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
                gajim.connections[self.account].request_last_status_time(
                    j, r, self.contact.jid)
            else:
                gajim.connections[self.account].request_last_status_time(
                    self.contact.jid, '')

        # do not wait for os_info if contact is not connected or has error
        # additional check for observer is needed, as show is offline for him
        if self.contact.show in ('offline', 'error')\
        and not self.contact.is_observer():
            self.os_info_arrived = True
        else:  # Request os info if contact is connected
            if self.gc_contact:
                j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
                GLib.idle_add(gajim.connections[self.account].request_os_info,
                              j, r, self.contact.jid)
            else:
                GLib.idle_add(gajim.connections[self.account].request_os_info,
                              self.contact.jid, self.contact.resource)

        # do not wait for entity_time if contact is not connected or has error
        # additional check for observer is needed, as show is offline for him
        if self.contact.show in ('offline', 'error')\
        and not self.contact.is_observer():
            self.entity_time_arrived = True
        else:  # Request entity time if contact is connected
            if self.gc_contact:
                j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
                GLib.idle_add(gajim.connections[self.account].\
                    request_entity_time, j, r, self.contact.jid)
            else:
                GLib.idle_add(gajim.connections[self.account].\
                    request_entity_time, self.contact.jid, self.contact.resource)

        self.os_info = {
            0: {
                'resource': self.real_resource,
                'client': '',
                'os': ''
            }
        }
        self.time_info = {0: {'resource': self.real_resource, 'time': ''}}
        i = 1
        contact_list = gajim.contacts.get_contacts(self.account,
                                                   self.contact.jid)
        if contact_list:
            for c in contact_list:
                if c.resource != self.contact.resource:
                    resources += '\n%s (%s)' % (c.resource, str(c.priority))
                    uf_resources += '\n' + c.resource + \
                            _(' resource with priority ') + str(c.priority)
                    if c.show not in ('offline', 'error'):
                        GLib.idle_add(gajim.connections[self.account].\
                            request_os_info, c.jid, c.resource)
                        GLib.idle_add(gajim.connections[self.account].\
                            request_entity_time, c.jid, c.resource)
                    self.os_info[i] = {
                        'resource': c.resource,
                        'client': '',
                        'os': ''
                    }
                    self.time_info[i] = {'resource': c.resource, 'time': ''}
                    i += 1

        self.xml.get_object('resource_prio_label').set_text(resources)
        resource_prio_label_eventbox = self.xml.get_object(
            'resource_prio_label_eventbox')
        resource_prio_label_eventbox.set_tooltip_text(uf_resources)

        self.fill_status_label()

        if self.gc_contact:
            # If we know the real jid, remove the resource from vcard request
            gajim.connections[self.account].request_vcard(
                self.real_jid_for_vcard, self.gc_contact.get_full_jid())
        else:
            gajim.connections[self.account].request_vcard(self.contact.jid)
예제 #4
0
파일: vcard.py 프로젝트: gajim/gajim
    def fill_jabber_page(self):
        self.xml.get_object("nickname_label").set_markup(
            '<b><span size="x-large">' + self.contact.get_shown_name() + "</span></b>"
        )
        self.xml.get_object("jid_label").set_text(self.contact.jid)

        subscription_label = self.xml.get_object("subscription_label")
        ask_label = self.xml.get_object("ask_label")
        if self.gc_contact:
            self.xml.get_object("subscription_title_label").set_markup(Q_("?Role in Group Chat:<b>Role:</b>"))
            uf_role = helpers.get_uf_role(self.gc_contact.role)
            subscription_label.set_text(uf_role)

            self.xml.get_object("ask_title_label").set_markup(_("<b>Affiliation:</b>"))
            uf_affiliation = helpers.get_uf_affiliation(self.gc_contact.affiliation)
            ask_label.set_text(uf_affiliation)
        else:
            uf_sub = helpers.get_uf_sub(self.contact.sub)
            subscription_label.set_text(uf_sub)
            eb = self.xml.get_object("subscription_label_eventbox")
            if self.contact.sub == "from":
                tt_text = _(
                    "This contact is interested in your presence information, but you are not interested in his/her presence"
                )
            elif self.contact.sub == "to":
                tt_text = _(
                    "You are interested in the contact's presence information, but he/she is not interested in yours"
                )
            elif self.contact.sub == "both":
                tt_text = _("You and the contact are interested in each other's presence information")
            else:  # None
                tt_text = _(
                    "You are not interested in the contact's presence, and neither he/she is interested in yours"
                )
            eb.set_tooltip_text(tt_text)

            uf_ask = helpers.get_uf_ask(self.contact.ask)
            ask_label.set_text(uf_ask)
            eb = self.xml.get_object("ask_label_eventbox")
            if self.contact.ask == "subscribe":
                tt_text = _("You are waiting contact's answer about your subscription request")
            else:
                tt_text = _("There is no pending subscription request.")
            eb.set_tooltip_text(tt_text)

        resources = "%s (%s)" % (self.contact.resource, str(self.contact.priority))
        uf_resources = self.contact.resource + _(" resource with priority ") + str(self.contact.priority)
        if not self.contact.status:
            self.contact.status = ""

        # Request list time status only if contact is offline
        if self.contact.show == "offline":
            if self.gc_contact:
                j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
                gajim.connections[self.account].request_last_status_time(j, r, self.contact.jid)
            else:
                gajim.connections[self.account].request_last_status_time(self.contact.jid, "")

        # do not wait for os_info if contact is not connected or has error
        # additional check for observer is needed, as show is offline for him
        if self.contact.show in ("offline", "error") and not self.contact.is_observer():
            self.os_info_arrived = True
        else:  # Request os info if contact is connected
            if self.gc_contact:
                j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
                GLib.idle_add(gajim.connections[self.account].request_os_info, j, r, self.contact.jid)
            else:
                GLib.idle_add(gajim.connections[self.account].request_os_info, self.contact.jid, self.contact.resource)

        # do not wait for entity_time if contact is not connected or has error
        # additional check for observer is needed, as show is offline for him
        if self.contact.show in ("offline", "error") and not self.contact.is_observer():
            self.entity_time_arrived = True
        else:  # Request entity time if contact is connected
            if self.gc_contact:
                j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
                GLib.idle_add(gajim.connections[self.account].request_entity_time, j, r, self.contact.jid)
            else:
                GLib.idle_add(
                    gajim.connections[self.account].request_entity_time, self.contact.jid, self.contact.resource
                )

        self.os_info = {0: {"resource": self.real_resource, "client": "", "os": ""}}
        self.time_info = {0: {"resource": self.real_resource, "time": ""}}
        i = 1
        contact_list = gajim.contacts.get_contacts(self.account, self.contact.jid)
        if contact_list:
            for c in contact_list:
                if c.resource != self.contact.resource:
                    resources += "\n%s (%s)" % (c.resource, str(c.priority))
                    uf_resources += "\n" + c.resource + _(" resource with priority ") + str(c.priority)
                    if c.show not in ("offline", "error"):
                        GLib.idle_add(gajim.connections[self.account].request_os_info, c.jid, c.resource)
                        GLib.idle_add(gajim.connections[self.account].request_entity_time, c.jid, c.resource)
                    self.os_info[i] = {"resource": c.resource, "client": "", "os": ""}
                    self.time_info[i] = {"resource": c.resource, "time": ""}
                    i += 1

        self.xml.get_object("resource_prio_label").set_text(resources)
        resource_prio_label_eventbox = self.xml.get_object("resource_prio_label_eventbox")
        resource_prio_label_eventbox.set_tooltip_text(uf_resources)

        self.fill_status_label()

        if self.gc_contact:
            # If we know the real jid, remove the resource from vcard request
            gajim.connections[self.account].request_vcard(self.real_jid_for_vcard, self.gc_contact.get_full_jid())
        else:
            gajim.connections[self.account].request_vcard(self.contact.jid)
예제 #5
0
파일: vcard.py 프로젝트: tdruiva/gajim
    def fill_jabber_page(self):
        tooltips = gtk.Tooltips()
        self.xml.get_widget('nickname_label').set_markup(
            '<b><span size="x-large">' + self.contact.get_shown_name() +
            '</span></b>')
        self.xml.get_widget('jid_label').set_text(self.contact.jid)

        subscription_label = self.xml.get_widget('subscription_label')
        ask_label = self.xml.get_widget('ask_label')
        if self.gc_contact:
            self.xml.get_widget('subscription_title_label').set_markup(
                _("<b>Role:</b>"))
            uf_role = helpers.get_uf_role(self.gc_contact.role)
            subscription_label.set_text(uf_role)

            self.xml.get_widget('ask_title_label').set_markup(
                _("<b>Affiliation:</b>"))
            uf_affiliation = helpers.get_uf_affiliation(
                self.gc_contact.affiliation)
            ask_label.set_text(uf_affiliation)
        else:
            uf_sub = helpers.get_uf_sub(self.contact.sub)
            subscription_label.set_text(uf_sub)
            eb = self.xml.get_widget('subscription_label_eventbox')
            if self.contact.sub == 'from':
                tt_text = _(
                    "This contact is interested in your presence information, but you are not interested in his/her presence"
                )
            elif self.contact.sub == 'to':
                tt_text = _(
                    "You are interested in the contact's presence information, but he/she is not interested in yours"
                )
            elif self.contact.sub == 'both':
                tt_text = _(
                    "You and the contact are interested in each other's presence information"
                )
            else:  # None
                tt_text = _(
                    "You are not interested in the contact's presence, and neither he/she is interested in yours"
                )
            tooltips.set_tip(eb, tt_text)

            uf_ask = helpers.get_uf_ask(self.contact.ask)
            ask_label.set_text(uf_ask)
            eb = self.xml.get_widget('ask_label_eventbox')
            if self.contact.ask == 'subscribe':
                tt_text = _(
                    "You are waiting contact's answer about your subscription request"
                )
            else:
                tt_text = _("There is no pending subscription request.")
            tooltips.set_tip(eb, tt_text)

        resources = '%s (%s)' % (self.contact.resource,
                                 unicode(self.contact.priority))
        uf_resources = self.contact.resource + _(' resource with priority ')\
         + unicode(self.contact.priority)
        if not self.contact.status:
            self.contact.status = ''

        # Request list time status
        if self.gc_contact:
            j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
            gajim.connections[self.account].request_last_status_time(
                j, r, self.contact.jid)
        else:
            gajim.connections[self.account].request_last_status_time(
                self.contact.jid, self.contact.resource)

        # do not wait for os_info if contact is not connected or has error
        # additional check for observer is needed, as show is offline for him
        if self.contact.show in ('offline', 'error')\
        and not self.contact.is_observer():
            self.os_info_arrived = True
        else:  # Request os info if contact is connected
            if self.gc_contact:
                j, r = gajim.get_room_and_nick_from_fjid(self.real_jid)
                gobject.idle_add(
                    gajim.connections[self.account].request_os_info, j, r,
                    self.contact.jid)
            else:
                gobject.idle_add(
                    gajim.connections[self.account].request_os_info,
                    self.contact.jid, self.contact.resource)
        self.os_info = {
            0: {
                'resource': self.contact.resource,
                'client': '',
                'os': ''
            }
        }
        i = 1
        contact_list = gajim.contacts.get_contacts(self.account,
                                                   self.contact.jid)
        if contact_list:
            for c in contact_list:
                if c.resource != self.contact.resource:
                    resources += '\n%s (%s)' % (c.resource, unicode(
                        c.priority))
                    uf_resources += '\n' + c.resource + \
                     _(' resource with priority ') + unicode(c.priority)
                    if c.show not in ('offline', 'error'):
                        gobject.idle_add(
                            gajim.connections[self.account].request_os_info,
                            c.jid, c.resource)
                    gajim.connections[self.account].request_last_status_time(
                        c.jid, c.resource)
                    self.os_info[i] = {
                        'resource': c.resource,
                        'client': '',
                        'os': ''
                    }
                    i += 1
        self.xml.get_widget('resource_prio_label').set_text(resources)
        resource_prio_label_eventbox = self.xml.get_widget(
            'resource_prio_label_eventbox')
        tooltips.set_tip(resource_prio_label_eventbox, uf_resources)

        self.fill_status_label()

        if self.gc_contact:
            # If we know the real jid, remove the resource from vcard request
            if self.gc_contact.jid:
                jid = self.gc_contact.jid
            else:
                jid = self.real_jid
            gajim.connections[self.account].request_vcard(
                jid, self.gc_contact.get_full_jid())
        else:
            gajim.connections[self.account].request_vcard(self.contact.jid)