Returns the contacts for this user.

        Contacts are other users that this user has received messages
        from or send messages to.

        :param user:
            The :class:`User` which to get the contacts for.
326713
def get_contacts_for(self, user):
        
        contacts = self.filter(Q(um_from_user=user) | Q(um_to_user=user))
        return contacts
253353
def fetch_friend_ids(self, user):
        
        friends = self.fetch_friends(user)
        friend_ids = []
        for friend in friends:
            friend_ids.append(friend.id)
        return friend_ids
639149
def inbox_count_for(user):
    
    return Message.objects.filter(recipient=user, read_at__isnull=True, recipient_deleted_at__isnull=True).count()
1049218
def get_all_contacts_of_client(self, client_id):
        
        return self._iterate_through_pages(
            get_function=self.get_contacts_of_client_per_page,
            resource=CONTACTS,
            **{'client_id': client_id}
        )
678519
def post_user_contact_lists(self, id, **data):
        
        
        return self.post("/users/{0}/contact_lists/".format(id), data=data)
794580
def getContactTypes(self):
        
        yield VIPPersonContactType()
        yield EmailContactType(self.store)
        yield PostalContactType()
        yield PhoneNumberContactType()
        yield NotesContactType()
        for getContactTypes in self._gatherPluginMethods('getContactTypes'):
            for contactType in getContactTypes():
                self._checkContactType(contactType)
                yield contactType
104765
def _linkUser(self, user):
        
        KEY = "linked_contact_uid"

        username = user.getId()
        contact = self.getContactByUsername(username)

        # User is linked to another contact (fix in UI)
        if contact and contact.UID() != self.UID():
            raise ValueError("User '{}' is already linked to Contact '{}'"
                             .format(username, contact.Title()))

        # User is linked to multiple other contacts (fix in Data)
        if isinstance(contact, list):
            raise ValueError("User '{}' is linked to multiple Contacts: '{}'"
                             .format(username, ",".join(
                                 map(lambda x: x.Title(), contact))))

        # XXX: Does it make sense to "remember" the UID as a User property?
        tool = user.getTool()
        try:
            user.getProperty(KEY)
        except ValueError:
            logger.info("Adding User property {}".format(KEY))
            tool.manage_addProperty(KEY, "", "string")

        # Set the UID as a User Property
        uid = self.UID()
        user.setMemberProperties({KEY: uid})
        logger.info("Linked Contact UID {} to User {}".format(
            user.getProperty(KEY), username))

        # Set the Username
        self.setUsername(user.getId())

        # Update the Email address from the user
        self.setEmailAddress(user.getProperty("email"))

        # somehow the `getUsername` index gets out of sync
        self.reindexObject()

        # N.B. Local owner role and client group applies only to client
        #      contacts, but not lab contacts.
        if IClient.providedBy(self.aq_parent):
            # Grant local Owner role
            self._addLocalOwnerRole(username)
            # Add user to "Clients" group
            self._addUserToGroup(username, group="Clients")

        return True
567175
def get_user(self, user_id):
        
        try:
            return User.objects.get(id=user_id)
        except User.DoesNotExist:
            return None
39110
def getContactUIDForUser(self):
        
        mt = getToolByName(self, 'portal_membership')
        user = mt.getAuthenticatedMember()
        user_id = user.getUserName()
        pc = getToolByName(self, 'portal_catalog')
        r = pc(portal_type='Contact',
               getUsername=user_id)
        if len(r) == 1:
            return r[0].UID
611030
def show_user(self, user):
        
        res = self.post('loadUsers', {'userId': user})
        if isinstance(res, list) and len(res) > 0:
            res = res[0]
        return _fix_user(res)
322092
def getContactUIDForUser(self):
        
        user = self.REQUEST.AUTHENTICATED_USER
        user_id = user.getUserName()
        r = self.portal_catalog(
            portal_type='Contact',
            getUsername=user_id
        )
        if len(r) == 1:
            return r[0].UID
589122
def sendContact(self, context={}):
    
    for recipient in self.recipients:
      super(ContactFormMail, self).__init__(recipient, self.async)
      self.sendEmail('contactForm', 'New contact form message', context)
922426
def getusers(self, userlist):
        
        userobjs = [User(self, **rawuser) for rawuser in
                    self._getusers(names=userlist).get('users', [])]

        # Return users in same order they were passed in
        ret = []
        for u in userlist:
            for uobj in userobjs[:]:
                if uobj.email == u:
                    userobjs.remove(uobj)
                    ret.append(uobj)
                    break
        ret += userobjs
        return ret
2649
def users(self):
        
        friends = [MyPlexUser(self, elem) for elem in self.query(MyPlexUser.key)]
        requested = [MyPlexUser(self, elem, self.REQUESTED) for elem in self.query(self.REQUESTED)]
        return friends + requested
291603
def get_user_contact_list(self, id, contact_list_id, **data):
        
        
        return self.get("/users/{0}/contact_lists/{0}/".format(id,contact_list_id), data=data)
1267024
def getVerifiers(self):
        
        contacts = list()
        for verifier in self.getVerifiersIDs():
            user = api.get_user(verifier)
            contact = api.get_user_contact(user, ["LabContact"])
            if contact:
                contacts.append(contact)
        return contacts
602598
def contacts(opts={})
      # NOTE: caching functionality can be dependant of the nature of the list, if dynamic or not ...
      bypass_cache = opts.delete(:bypass_cache) { false }
      recent = opts.delete(:recent) { false }
      paged = opts.delete(:paged) { false }

      if bypass_cache || @contacts.nil?
        path = recent ? RECENT_CONTACTS_PATH : CONTACTS_PATH
        opts[:list_id] = @id

        response = Hubspot::Connection.get_json(path, Hubspot::ContactProperties.add_default_parameters(opts))
        @contacts = response['contacts'].map! { |c| Hubspot::Contact.from_result(c) }
        paged ? response : @contacts
      else
        @contacts
      end
    end