Adds a user to the channel.
325775
def add_user(self, user):
        """"""
        if not isinstance(user, User):
            user = User(user)
        if user.nick in self.members:
            _log.warning("Ignoring request to add user '%s' to channel '%s' "
                         "because that user is already in the member list.",
                         user, self.name)
            return
        self.members[user.nick] = user
        _log.debug("Added '%s' to channel '%s'", user, self.name)
1156510
function (username, channel) {
        var userChannels = this.getUserNotifications(username);

        // dont remove if they dont exist
        if (userChannels === null) {
            return false;
        }

        var index = userChannels.indexOf(channel);

        // dont remove if the channel doesnt exist
        if (index < 0) {
            return false;
        }

        // remove the channel
        userChannels.splice(index, 1);

        //if no channels left remove the entire user
        if (userChannels.length === 0) {
            var userIndex = -1;
            this.notifications.some(function (element, index) {
                if (element.username === username) {
                    userIndex = index;
                    return true;
                }
                return false;
            });
            this.notifications.splice(userIndex, 1);
            this.latestVideos.removeUser(username);
        }

        // save the new data
        this.saveNotifications();
        return true;
    }
1305510
def add_user(self, **kwargs):
        """"""
        user = self.UserClass(**kwargs)
        if hasattr(user, 'active'):
            user.active = True
        self.db_adapter.add_object(user)
        return user
83744
def add_recipient(recipient)
      raise 'Tried to add recipient to a non-group channel' unless group?
      raise ArgumentError, 'Tried to add a non-recipient to a group' unless recipient.is_a?(Recipient)

      @recipients << recipient
    end
180957
def create_user(self, user):
        
        self.run("useradd -m %s" % user)
        usr =  getpwnam(user)
        return usr
118949
def prj_add_user(self, *args, **kwargs):
        
        if not self.cur_prj:
            return
        dialog = UserAdderDialog(project=self.cur_prj)
        dialog.exec_()
        users = dialog.users
        for user in users:
            userdata = djitemdata.UserItemData(user)
            treemodel.TreeItem(userdata, self.prj_user_model.root)
        self.cur_prj.save()
140212
def invite_user(self, new_member, inviter=None, roster=None):
        """"""
        roster = roster or self.client.getRoster()
        jid = new_member['JID']

        logger.info('roster %s %s' % (jid, roster.getSubscription(jid)))
        if jid in roster.keys() and roster.getSubscription(jid) in ['both', 'to']:
            new_member['STATUS'] = 'ACTIVE'
            if inviter:
                self.send_message('%s is already a member' % (jid,), inviter)
        else:
            new_member['STATUS'] = 'INVITED'
            self.broadcast('inviting %s to the room' % (jid,))

            #Add nickname according to http://xmpp.org/extensions/xep-0172.html
            subscribe_presence = xmpp.dispatcher.Presence(to=jid, typ='subscribe')
            if 'NICK' in self.params:
                subscribe_presence.addChild(name='nick', namespace=xmpp.protocol.NS_NICK, payload=self.params['NICK'])
            self.client.send(subscribe_presence)

        if not self.is_member(new_member):
            new_member.setdefault('NICK', jid.split('@')[0])
            self.params['MEMBERS'].append(new_member)
1327236
public void addUser(PrincipalUser user) {
        SystemAssert.requireArgument(user != null, "Null user can not be added.");
        users.add(user);
    }
621976
def add_user(self, user, group):
        
        if self.is_user_in(user, group):
            raise UserAlreadyInAGroup
        self.new_groups.add(group, user)
385792
public function userSubscriptionChannel($channel, $user, $token = null)
    {
        return $this->sendRequest('GET', 'users/'.$user.'/subscriptions/'.$channel, $this->getToken($token));
    }
477702
public function addChannel(Channel $channel): self
    {
        $channelName = $channel->getName();

        if (!isset($this->channels[$channelName])) {
            $this->channels[$channelName] = $channel;
        }

        return $this;
    }
732988
def change_nick(self, nick):
        """"""
        
        old_nick = self.nick
        self.nick = IRCstr(nick)
        
        for c in self.channels:
            c.users.remove(old_nick)
            c.users.add(self.nick)
675043
def users
      users = Set.new

      @channels.each do |channel|
        users.merge channel.users
      end

      users
    end
695283
def subscribe(self, channel_name, auth=None):
        
        data = {'channel': channel_name}
        if auth is None:
            if channel_name.startswith('presence-'):
                data['auth'] = self._generate_presence_token(channel_name)
                data['channel_data'] = json.dumps(self.user_data)
            elif channel_name.startswith('private-'):
                data['auth'] = self._generate_auth_token(channel_name)
        else:
            data['auth'] = auth

        self.connection.send_event('pusher:subscribe', data)

        self.channels[channel_name] = Channel(channel_name, self.connection)

        return self.channels[channel_name]
1058837
def add_recipient(data)
      channel_id = data['channel_id'].to_i
      channel = self.channel(channel_id)

      recipient_user = ensure_user(data['user'])
      recipient = Recipient.new(recipient_user, channel, self)
      channel.add_recipient(recipient)
    end
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
228281
def add_subscriber_to_channel(channel, message)
      registry_channels = CelluloidPubsub::Registry.channels
      @channels << channel
      registry_channels << channel unless registry_channels.include?(channel)
      @server.mutex.synchronize do
        @server.subscribers[channel] = channel_subscribers(channel).push(reactor: Actor.current, message: message)
      end
    end