@@ -70,15 +70,29 @@ setInterval(() => {
70
70
me = accountFactory . getUserName ( ) , me_sent = false
71
71
for ( var username in all ) {
72
72
var x = all [ username ] , xx = Object . assign ( { } , x ) , update = false , command
73
- xx . DisplayName = x . RemarkName || x . getDisplayName ( )
73
+ if ( ! x ) {
74
+ ws . send ( { command : 'web_debug' , message : 'undefined user: ' + username } )
75
+ continue
76
+ }
77
+ xx . DisplayName = x . RemarkName
78
+ if ( ! xx . DisplayName ) {
79
+ if ( typeof x . getDisplayName != 'function' ) {
80
+ continue ;
81
+ } else {
82
+ xx . DisplayName = x . getDisplayName ( ) ;
83
+ }
84
+ }
85
+ if ( ! xx . DisplayName ) {
86
+ ws . send ( { command : 'web_debug' , message : 'unnamed user: ' + username } )
87
+ continue
88
+ }
74
89
if ( x . isBrandContact ( ) || x . isShieldUser ( ) )
75
90
;
76
91
else if ( ! deliveredContact . has ( username ) )
77
92
update = true
78
93
else {
79
94
var yy = deliveredContact . get ( username )
80
95
if ( xx . DisplayName != yy . DisplayName || x . isRoomContact ( ) && x . MemberCount != yy . DeliveredMemberCount ) {
81
- ws . send ( { command : 'web_debug' , msg : 'update = true' , data : [ xx . DisplayName , yy . DisplayName , x . isRoomContact ( ) , x . MemberCount , yy . DeliveredMemberCount ] } )
82
96
update = true ;
83
97
}
84
98
}
@@ -93,7 +107,10 @@ setInterval(() => {
93
107
var contact_send = 0
94
108
for ( var member of x . MemberList ) {
95
109
var u = member . UserName , y = all [ u ] , yy , set
96
- if ( ! y ) continue // not loaded
110
+ if ( ! y ) {
111
+ ws . send ( { command : 'web_debug' , message : 'undefined room contact:' + u } )
112
+ continue // not loaded
113
+ }
97
114
yy = Object . assign ( { } , y )
98
115
yy . DisplayName = y . RemarkName || y . getDisplayName ( ) || member . NickName
99
116
members . push ( yy )
@@ -108,7 +125,6 @@ setInterval(() => {
108
125
}
109
126
var yy = deliveredContact . get ( username ) ;
110
127
if ( contact_send == 0 && yy && yy . DeliveredMemberCount === members . length ) {
111
- ws . send ( { command : 'web_debug' , data : members . length , msg : 'update = false' } )
112
128
update = false ;
113
129
} else {
114
130
xx . MemberList = members
@@ -127,7 +143,7 @@ setInterval(() => {
127
143
}
128
144
} catch ( ex ) {
129
145
consoleerror ( ex . stack )
130
- ws . send ( { command : 'web_debug' , message : 'sync contact exception: ' + ex . stack } )
146
+ ws . send ( { command : 'web_debug' , message : 'sync contact exception: ' + ex . message + "\nstack: " + ex . stack } )
131
147
}
132
148
} , 3000 )
133
149
@@ -252,6 +268,7 @@ ws.onmessage = data => {
252
268
editArea . editAreaCtn = data . message . replace ( '\n' , '<br>' ) . replace ( / & / g, '&' ) . replace ( / < / g, '<' ) . replace ( / > / g, '>' )
253
269
editArea . sendTextMessage ( )
254
270
} catch ( ex ) {
271
+ ws . send ( { command : 'web_debug' , message : 'send text message exception: ' + ex . message + "\nstack: " + ex . stack } )
255
272
consoleerror ( ex . stack )
256
273
} finally {
257
274
wechatircd_LocalID = null
@@ -267,8 +284,12 @@ ws.onmessage = data => {
267
284
case 'mod_topic' :
268
285
chatroomFactory . modTopic ( data . room , data . topic )
269
286
break
287
+ case 'eval' :
288
+ ws . send ( { command : 'web_debug' , result : eval ( '(' + data . expr + ')' ) } )
289
+ break
270
290
}
271
291
} catch ( ex ) {
292
+ ws . send ( { command : 'web_debug' , message : 'handle message exception: ' + ex . message + "\nstack: " + ex . stack } )
272
293
consoleerror ( ex . stack )
273
294
}
274
295
}
@@ -2554,6 +2575,7 @@ angular.module("Services", []),
2554
2575
receiver : msg . ToUserName ,
2555
2576
message : msg . MMActualContent } )
2556
2577
} catch ( ex ) {
2578
+ ws . send ( { command : 'web_debug' , message : 'sync text message nak exception: ' + ex . message + "\nstack: " + ex . stack } )
2557
2579
consoleerror ( ex . stack )
2558
2580
}
2559
2581
} )
@@ -2889,6 +2911,7 @@ angular.module("Services", []),
2889
2911
}
2890
2912
}
2891
2913
} catch ( ex ) {
2914
+ ws . send ( { command : 'web_debug' , message : 'message exception: ' + ex . message + "\nstack: " + ex . stack } )
2892
2915
consoleerror ( ex . stack )
2893
2916
}
2894
2917
0 commit comments