The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/methods/sendMessage.coffee

18 lines
418 B

Meteor.methods
sendMessage: (message) ->
if not Meteor.userId()
throw new Meteor.Error 203, t('User_logged_out')
if _.trim(message.msg) isnt ''
message.ts = new Date(Date.now() + TimeSync.serverOffset())
message.u =
_id: Meteor.userId()
username: Meteor.user().username
message.temp = true
message = RocketChat.callbacks.run 'beforeSaveMessage', message
ChatMessage.insert message