Creates a chat with one or more users.

        :Parameters:
          Usernames : str
            One or more Skypenames of the users.

        :return: A chat object
        :rtype: `Chat`

        :see: `Chat.AddMembers`
163087
def CreateChatWith(self, *Usernames):
        
        return Chat(self, chop(self._DoCommand('CHAT CREATE %s' % ', '.join(Usernames)), 2)[1])
292095
def create_user(self, username, password, tags=""):
        
        path = Client.urls['users_by_name'] % username
        body = json.dumps({'password': password, 'tags': tags})
        return self._call(path, 'PUT', body=body,
                                 headers=Client.json_headers)
291994
def get_chat_members_count(self, chat_id):
        
        result = apihelper.get_chat_members_count(self.token, chat_id)
        return result
789459
private function usersInChat($users, Chat $chat) {
        $chatMembers=$chat->getChatMembers();
        $chatMembers->initialize();
        return $chatMembers->count() == count($users)
            && $chatMembers->forAll(function($index, $user) use ($users){
                return in_array($user, $users);
            });
    }
796632
async def AddUser(self, users):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='UserManager',
                   request='AddUser',
                   version=2,
                   params=_params)
        _params['users'] = users
        reply = await self.rpc(msg)
        return reply
362022
def add_to_groups(self, username, groups):
        
        self._check_fix_users(username)
        current_groups = self.users[username]['groups']
        new_groups = current_groups | set(groups)
        self.users[username]['groups'] = new_groups
1328014
def get_users(self, **kwargs):
        
        return GetUsers(settings=self.settings, **kwargs).call(**kwargs)
1241992
def get_chat_member(self, user_id):
        
        return self.bot.api_call(
            "getChatMember", chat_id=str(self.id), user_id=str(user_id)
        )
1040606
def message(request, socket, context, message):
    
    room = get_object_or_404(ChatRoom, id=message["room"])
    if message["action"] == "start":
        name = strip_tags(message["name"])
        user, created = room.users.get_or_create(name=name)
        if not created:
            socket.send({"action": "in-use"})
        else:
            context["user"] = user
            users = [u.name for u in room.users.exclude(id=user.id)]
            socket.send({"action": "started", "users": users})
            user.session = socket.session.session_id
            user.save()
            joined = {"action": "join", "name": user.name, "id": user.id}
            socket.send_and_broadcast_channel(joined)
    else:
        try:
            user = context["user"]
        except KeyError:
            return
        if message["action"] == "message":
            message["message"] = strip_tags(message["message"])
            message["name"] = user.name
            socket.send_and_broadcast_channel(message)
425566
def users(self):
        
        if not self.__users:
            self.__users = Users(self.__connection)
        return self.__users
239789
def msg2usernames(msg, processor=None, legacy=False, **config):
    
    return processor.usernames(msg, **config)
883034
def Chat(self, Name=''):
        
        o = Chat(self, Name)
        o.Status # Tests if such a chat really exists.
        return o
389225
def get_users_info(self, usernames):
        
        retval = {username: None for username in usernames}
        remaining_users = usernames

        infos = self._database.users.find({"username": {"$in": remaining_users}})
        for info in infos:
            retval[info["username"]] = (info["realname"], info["email"])

        return retval
289649
def join(self, event):
        

        try:
            channel_uuid = event.data
            user_uuid = event.user.uuid

            if channel_uuid in self.chat_channels:
                self.log('User joins a known channel', lvl=debug)
                if user_uuid in self.chat_channels[channel_uuid].users:
                    self.log('User already joined', lvl=warn)
                else:
                    self.chat_channels[channel_uuid].users.append(user_uuid)
                    self.chat_channels[channel_uuid].save()
                    packet = {
                        'component': 'hfos.chat.host',
                        'action': 'join',
                        'data': channel_uuid
                    }
                    self.fireEvent(send(event.client.uuid, packet))
            else:
                self.log('Request to join unavailable channel', lvl=warn)
        except Exception as e:
            self.log('Join error:', e, type(e), exc=True, lvl=error)
320825
def users_sentiments_single_most_frequent(
        self,
        usernames = None,
        ):
        
        users_sentiments_single_most_frequent = dict()
        if usernames is None:
            usernames = self.usernames()
        try:
            for username in usernames:
                sentiment = self.user_sentiments_most_frequent(
                    username             = username,
                    single_most_frequent = True
                )
                users_sentiments_single_most_frequent[username] = sentiment
            return users_sentiments_single_most_frequent
        except:
            log.error("error -- possibly a problem with tweets stored")
            return None
1169502
def getContactByUsername(cls, username):
        

        # Check if the User is linked already
        pc = api.portal.get_tool("portal_catalog")
        contacts = pc(portal_type=cls.portal_type,
                      getUsername=username)

        # No Contact assigned to this username
        if len(contacts) == 0:
            return None

        # Multiple Users assigned, this should never happen
        if len(contacts) > 1:
            logger.error("User '{}' is bound to multiple Contacts '{}'".format(
                username, ",".join(map(lambda c: c.Title, contacts))))
            return map(lambda x: x.getObject(), contacts)

        # Return the found Contact object
        return contacts[0].getObject()
269498
def by_user_names(cls, user_names, db_session=None):
        
        user_names = [(name or "").lower() for name in user_names]
        db_session = get_db_session(db_session)
        query = db_session.query(cls.model)
        query = query.filter(sa.func.lower(cls.model.user_name).in_(user_names))
        # q = q.options(sa.orm.eagerload(cls.groups))
        return query