bigbluebutton-Github/labs/meteor-client/collections/chat.coffee
Anton Georgiev 3ad1bdd341 Merge branch 'prototype-metor-client' of github.com:perroned/bigbluebutton into meteor-merge-private-chat
Conflicts:
	labs/meteor-client/client/globals.coffee
	labs/meteor-client/client/views/chat/chat_bar.coffee
	labs/meteor-client/collections/collections.coffee
	labs/meteor-client/lib/router.coffee
	labs/meteor-client/server/publish.coffee
	labs/meteor-client/server/server.coffee
2014-07-09 15:09:27 +00:00

31 lines
1.3 KiB
CoffeeScript
Executable File

Meteor.methods
addChatToCollection: (meetingId, messageObject) ->
entry = {
meetingId: meetingId
message: { # or message: messageObject but this is more verbose
chat_type: messageObject.chat_type
message: messageObject.message
to_username: messageObject.to_username
from_tz_offset: messageObject.from_tz_offset
from_color: messageObject.from_color
to_userid: messageObject.to_userid
from_userid: messageObject.from_userid
from_time: messageObject.from_time
from_username: messageObject.from_username
from_lang: messageObject.from_lang
}
}
id = Meteor.Chat.insert(entry)
console.log "added chat id=[#{id}]:#{messageObject.message}. Chat.size is now
#{Meteor.Chat.find({meetingId: meetingId}).count()}"
sendChatMessagetoServer: (meetingId, messageObject) ->
Meteor.call "publishChatMessage", meetingId, messageObject
invalidateAllTabs: (userId, setFirst=false) -> # make all tabs false
Meteor.ChatTabs.update({'belongsTo':userId}, { $set: { isActive:false} }, {multi:true})
if setFirst # able to specify the first to be active
firstRecord = Meteor.ChatTabs.findOne({})
Meteor.ChatTabs.update({_id: firstRecord._id}, {$set: isActive:true})