Create a direct message session with another user.
428586
def im_create(self, username, **kwargs):
        """"""
        return self.__call_api_post('im.create', username=username, kwargs=kwargs)
132494
private Chat createChat(Message message) {
        Jid from = message.getFrom();
        // According to RFC6120 8.1.2.1 4. messages without a 'from' attribute are valid, but they
        // are of no use in this case for ChatManager
        if (from == null) {
            return null;
        }

        EntityJid userJID = from.asEntityJidIfPossible();
        if (userJID == null) {
            LOGGER.warning("Message from JID without localpart: '" + message.toXML() + "'");
            return null;
        }
        String threadID = message.getThread();
        if (threadID == null) {
            threadID = nextID();
        }

        return createChat(userJID, threadID, false);
    }
1222975
def group_create_session(self, groupid, participantid, skmsgdata):
        
        logger.debug("group_create_session(groupid=%s, participantid=%s, skmsgdata=[omitted])"
                     % (groupid, participantid))
        senderKeyName = SenderKeyName(groupid, AxolotlAddress(participantid, 0))
        senderkeydistributionmessage = SenderKeyDistributionMessage(serialized=skmsgdata)
        self._group_session_builder.process(senderKeyName, senderkeydistributionmessage)
639260
def welcome(self, user):
        
        self.send_message(create_message('RoomServer', 'Please welcome {name} to the server!\nThere are currently {i} users online -\n {r}\n'.format(name=user.id, 
                          i=self.amount_of_users_connected, 
                          r=' '.join(self.user_names))))
        logging.debug('Welcoming user {user} to {room}'.format(user=user.id.name, room=self.name))
772223
function view_session_message(req, msg) {
		var result = copy(msg);
		result.$ref = ref(req, opts.path + '/messages', msg.$id );
		return result;
	}
1243596
function send_dm_by_name( $screen_name, $text, $id = NULL )
	{
		$params = array();
		$params['text'] = $text;
		$params['screen_name'] = $screen_name;
		if ($id) {
			$this->id_format( $id );
			$params['id'] = $id;
		}
		return $this->oauth->post( 'direct_messages/new', $params);
	}
906488
def cli(ctx, email, first_name, last_name, password, role="user", metadata={}):
    
    return ctx.gi.users.create_user(email, first_name, last_name, password, role=role, metadata=metadata)
984735
def run(self, args):
        
        email = args.email                  # email of person to send email to
        username = args.username            # username of person to send email to, will be None if email is specified
        force_send = args.resend            # is this a resend so we should force sending
        auth_role = args.auth_role          # authorization role(project permissions) to give to the user
        msg_file = args.msg_file            # message file who's contents will be sent with the share
        message = read_argument_file_contents(msg_file)
        print("Sharing project.")
        to_user = self.remote_store.lookup_or_register_user_by_email_or_username(email, username)
        try:
            project = self.fetch_project(args, must_exist=True, include_children=False)
            dest_email = self.service.share(project, to_user, force_send, auth_role, message)
            print("Share email message sent to " + dest_email)
        except D4S2Error as ex:
            if ex.warning:
                print(ex.message)
            else:
                raise
74265
def send_user_to_user_message(self, from_user_id, target_user_ids, message='', contains_markup=True,
                                  scope='message/user'):
        
        return _post(
            token=self.oauth.get_user_token(scope),
            uri='/message/send',
            data={
                'From': from_user_id,
                'To': ",".join(target_user_ids),
                'Body': message,
                'ContainsMarkup': contains_markup
            }
        )
213937
function create_message(req, data) {
		debug.assert(data).is('object');
		if(!is.uuid(data.$id)) {
			data.$id = require('node-uuid').v4();
		}
		req.session.client.messages[data.$id] = data;
	}
607111
def _user(self, user, real_name):
        
        with self.lock:
            self.send('USER %s 0 * :%s' % (user, real_name))
            if self.readable():
                self._recv()
                self.stepback()
801745
def create
      session[:impersonator_redirect_path] = params[:redirect_path].presence
      @user = MnoEnterprise::User.find(params[:user_id])
      if @user.present?
        if @user.admin_role.present?
          flash[:notice] = 'User is a staff member'
        else
          impersonate(@user)
        end
      else
        flash[:notice] = "User doesn't exist"
      end

      path = mnoe_home_path
      path = add_param_to_fragment(path, 'dhbRefId', params[:dhbRefId]) if params[:dhbRefId].present?

      redirect_to path
    end
1241109
def adduser(app, username, password):
    """"""
    with app.app_context():
        create_user(username=username, password=password)
        click.echo('user created!')
596396
def user(self, username, realname):
        """"""
        cmd = 'USER {username} 0 * :{realname}'.format(**locals())
        self.send_raw(cmd)
752796
def create_contact(self, *args, **kwargs):
        """"""
        url = 'contacts.json'
        contact_data = {
            'active': True,
            'helpdesk_agent': False,
            'description': 'Freshdesk Contact'
        }
        contact_data.update(kwargs)
        payload = {
            'user': contact_data
        }

        return Contact(**self._api._post(url, data=payload)['user'])
1221410
function createConversationUpdate(args, membersAdded, membersRemoved) {
    let conversationUpdateActivity = createActivity({
        type: activitytypes.conversationupdate,
        recipient: args[args.botId],
        conversationId: args.conversation.id
    });
    conversationUpdateActivity.membersAdded = membersAdded || [];
    conversationUpdateActivity.membersRemoved = membersRemoved || [];
    conversationUpdateActivity.timestamp = getIncrementedDate(100);
    return conversationUpdateActivity;
}
1154813
def direct_reply(self, text):
        
        channel_id = self._client.open_dm_channel(self._get_user_id())
        self._client.rtm_send_message(channel_id, text)