环信IM (三)对话
2016-05-03 15:55
246 查看
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. ??
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
相关文章推荐
- struts2通配符,动态方法的调用
- 证书和描述文件相关的一定要标明。
- 辽宁大连IPv6高校
- code::blocks 在linux下的安装 全过程
- Fiddler捕获 iPhone/Android 流量
- H5页面适配所有iPhone和安卓机型的六个技巧
- iOS开发——环形渐变进度条
- java实现读写excel表格
- 线程死锁 Thread dead lock
- leetcode 169---Majority Element
- tensorflow源码安装
- android操作xml
- HTML&CSS——对背景图定位中background-position属性的自我理解
- Java集合和树
- 线程优先级与线程安全
- 超链接无效
- ztr loves lucky numbers--hdu5676(DFS)
- VC++6.0在win8.1系统下的兼容性破解
- 关于毫秒数转date类型的细节问题
- Android WebView使用基础