Example #1
0
			.done(function(isMember) {

				if (isMember) {

					var now = TimestampHelper.getTimestamp();
					ChatLogMongoHelper.insertMessage(rid, message, userId, now)
					
					.done(function(isSucceed) {
						
						if (isSucceed) {
							var resObject = {'message': data.message, 'sender': data.sender, 'timestamp': now};
							this.io.to(data.rid).emit('broadcastSendMessage', resObject, function(data) {});
							resFunc(resObject);
						} else {
							resFunc(false);
						}
						
					},

					function(err) {
						console.log(err);
						resFunc(err);
					});

				} else {
					resFunc(false);
				}

			}, function(err) {
Example #2
0
			.done(function(isMember) {

				if (isMember) {

					ChatLogMongoHelper.getChatLog(rid, pos, num)
					.done(function(result) {
						resFunc(result);
					}, 

					function(err) {
						console.log(err);
						resFunc(err);
					});
				} else {
					resFunc(false);
				}
				
			}, function(err) {