File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,19 @@ function sepiaFW_build_account(){
118118 }
119119
120120 //----------------------
121+
122+ //get general ID prefix
123+ Account . getIdPrefix = function ( ) {
124+ if ( userId ) {
125+ return userId . split ( / \d / , 2 ) [ 0 ] ;
126+ } else {
127+ return undefined ;
128+ }
129+ }
130+ //does the given string look like an ID
131+ Account . stringLooksLikeAnID = function ( str ) {
132+ return ! ! str . match ( new RegExp ( "^" + Account . getIdPrefix ( ) . toLowerCase ( ) + "\\d+$" ) ) ;
133+ }
121134
122135 //get user id
123136 Account . getUserId = function ( ) {
Original file line number Diff line number Diff line change @@ -1209,6 +1209,10 @@ function sepiaFW_build_ui_build(){
12091209 userList . forEach ( function ( user ) {
12101210 var entryClass = "" ;
12111211 var name = user . name ; //TODO: distinguish identical names
1212+ //prevent names that are like IDs
1213+ if ( SepiaFW . account . stringLooksLikeAnID ( name ) ) {
1214+ name = "ID:" + name ;
1215+ }
12121216 if ( $ . inArray ( user . id + "_" + user . deviceId , avoidDoubles ) == - 1 ) {
12131217 if ( user . id === userId && user . deviceId === deviceId ) {
12141218 entryClass = "me" ;
Original file line number Diff line number Diff line change @@ -1480,7 +1480,7 @@ function sepiaFW_build_webSocket_client(){
14801480 receiver = recUid ; //we should set receiver in any case to prevent a public message
14811481 }
14821482 res . shift ( ) ;
1483- text = res . join ( " " ) ;
1483+ text = res . join ( " " ) . trim ( ) ;
14841484
14851485 //locked receiver overwrite
14861486 } else if ( activeChatPartner && ! hasSpecialCommand ) {
@@ -1551,10 +1551,12 @@ function sepiaFW_build_webSocket_client(){
15511551 }
15521552
15531553 Client . getActiveChannelUsersByIdOrName = function ( nameOrId ) {
1554+ nameOrId = nameOrId . toLowerCase ( ) ;
1555+ var id = SepiaFW . account . stringLooksLikeAnID ( nameOrId ) ? nameOrId : "" ;
15541556 var receivers = [ ] ;
15551557 if ( nameOrId ) {
15561558 $ . each ( userList , function ( index , u ) {
1557- if ( nameOrId . toLowerCase ( ) === u . name . toLowerCase ( ) || nameOrId . toLowerCase ( ) === u . id . toLowerCase ( ) ) {
1559+ if ( ( id && id === u . id . toLowerCase ( ) ) || nameOrId === u . name . toLowerCase ( ) ) {
15581560 receivers . push ( u ) ;
15591561 }
15601562 } ) ;
You can’t perform that action at this time.
0 commit comments