环信IM (三)对话

1.

var sendText = function() {
	if (textSending) {
		return;
	}
	textSending = true;
	var msgInput = document.getElementById(talkInputId);
	var msg = msgInput.value;
	if (msg == null || msg.length == 0) {
		textSending = false;
		return;
	}
	var to = curChatUserId;
	if (to == null) {
		textSending = false;
		return;
	}
	var options = {
		to : to,
		msg : msg,
		type : "chat"
	};
	// 群组消息和个人消息的判断分支
	if (curChatUserId.indexOf(groupFlagMark) >= 0) {
		options.type = groupFlagMark;
		options.to = curRoomId;
	} else if (curChatUserId.indexOf(chatRoomMark) >= 0) {
		options.type = groupFlagMark;
		options.roomType = chatRoomMark;
		options.to = curRoomId;
	}

	//easemobwebim-sdk发送文本消息的方法 to为发送给谁,meg为文本消息对象
	conn.sendTextMessage(options);
	//当前登录人发送的信息在聊天窗口中原样显示
	var msgtext = Easemob.im.Utils.parseLink(Easemob.im.Utils.parseEmotions(encode(msg)));
	appendMsg(curUserId, to, msgtext);
	turnoffFaces_box();
	msgInput.value = "";
	msgInput.focus();
	setTimeout(function() {
		textSending = false;
	}, 1000);
};
2.

			//获取当前登录人的群组列表
			conn.listRooms({
				success : function(rooms) {
					if (rooms && rooms.length > 0) {
						buildListRoomDiv("contracgrouplist", rooms);//群组列表页面处理
						if (curChatUserId === null) {
							setCurrentContact(groupFlagMark + rooms[0].roomId);
							$('#accordion2').click();
						}
					}
					conn.setPresence();//设置用户上线状态,必须调用
				},
				error : function(e) {
					conn.setPresence();//设置用户上线状态,必须调用
				}
			});
3.  ??
groupFlagMark + rooms[0].roomId




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值