|
|
|
@ -62,8 +62,8 @@
|
|
|
|
|
var cnts = data.data.cnts;
|
|
|
|
|
for (var i = cnts.length - 1; i >= 0; i--) {
|
|
|
|
|
var unreadmapEle = {msgCount: 0};
|
|
|
|
|
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(
|
|
|
|
|
cnts[i].from)] = unreadmapEle;
|
|
|
|
|
window.sdk.unreadMap[getName(WKIT.Conn.sdk.Base.getNick(
|
|
|
|
|
cnts[i].from))] = unreadmapEle;
|
|
|
|
|
}
|
|
|
|
|
getUnreadMsgCount();
|
|
|
|
|
},
|
|
|
|
@ -78,18 +78,20 @@
|
|
|
|
|
WKIT.Conn.sdk.Base.getUnreadMsgCount({
|
|
|
|
|
count: 40,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
console.log(data);
|
|
|
|
|
var unreads = data.data;
|
|
|
|
|
var uids = "";
|
|
|
|
|
for (var i = unreads.length - 1; i >= 0; i--) {
|
|
|
|
|
if(window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(unreads[i].contact)]){
|
|
|
|
|
window.sdk.unreadMap[getName(WKIT.Conn.sdk.Base.getNick(unreads[i].contact))].msgCount =
|
|
|
|
|
unreads[i].msgCount;
|
|
|
|
|
var nick = getName(WKIT.Conn.sdk.Base.getNick(unreads[i].contact));
|
|
|
|
|
if(nick.length<=6){
|
|
|
|
|
uids += nick+",";
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
|
uids += nick.substring(0,uid.length-5) + ",";
|
|
|
|
|
}
|
|
|
|
|
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(unreads[i].contact)].msgCount =
|
|
|
|
|
unreads[i].msgCount;
|
|
|
|
|
var nick = WKIT.Conn.sdk.Base.getNick(unreads[i].contact)
|
|
|
|
|
uids += nick.substr(0,nick.length-6) + ",";
|
|
|
|
|
}
|
|
|
|
|
console.log("unreadMap",window.sdk.unreadMap);
|
|
|
|
|
window.sdk.loadContactList(uids);
|
|
|
|
|
},
|
|
|
|
|
error: function (error) {
|
|
|
|
@ -100,7 +102,9 @@
|
|
|
|
|
|
|
|
|
|
function updateContractList(data) {
|
|
|
|
|
var msg = data.msgs[0];
|
|
|
|
|
var msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from);
|
|
|
|
|
var msg_uid = getName(WKIT.Conn.sdk.Base.getNick(msg.from))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (window.sdk.unreadMap[msg_uid]) {
|
|
|
|
|
window.sdk.unreadMap[msg_uid].msgCount = window.sdk.unreadMap[msg_uid].msgCount + 1;
|
|
|
|
|
} else {
|
|
|
|
@ -116,6 +120,14 @@
|
|
|
|
|
$("#J_wkitPluginFrameWrap").css("margin", "0 0 0 0");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getName(uid) {
|
|
|
|
|
if(uid.substring(uid.length-5,uid.length-4)=='_'){
|
|
|
|
|
var prefix = uid.substring(0,uid.length-5);
|
|
|
|
|
var suffix =uid.substring(uid.length-5,uid.length).toUpperCase();
|
|
|
|
|
return prefix+suffix;
|
|
|
|
|
}
|
|
|
|
|
return uid;
|
|
|
|
|
}
|
|
|
|
|
function getQueryString(name) {
|
|
|
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
|
|
|
var r = window.location.search.substr(1).match(reg);
|
|
|
|
|