Improve chat roster parsing, message read state and loading feedback
This commit is contained in:
1 parent
c980ba10de
commit
c8941dc199
16 files changed
+183
-20
No files matched your search
@@ -27,10 +27,11 @@ export class Chat {
|
||||
const count=line.match(/^(\d+) Station\(s\) connected:/);if(count){this.users=[];this.remaining=Number(count[1]);this.section='users';return;}
|
||||
const user=parseUser(line);if(user){this.users=this.users.filter(u=>u.call!==user.call);this.users.push(user);if(user.call===this.call)this.topic=user.topic;this.remaining--;if(this.remaining<=0)this.section='';return;}
|
||||
if(line==='Active Topics are:'){this.topics=[];this.section='topics';return;}
|
||||
if(/^\d+ Node\(s\)|^Here |^User [A-Z0-9-]+|^Links Defined:/.test(line)){if(line==='Links Defined:'){this.section='links';this.links=[]}else this.section='';return;}
|
||||
if(/^\d+ Node\(s\)|^Here |^User [A-Z0-9-]+|^Links Defined:/.test(line)){if(line==='Links Defined:'){this.section='links';this.links=[]}else this.section=/^(?:\d+ Node\(s\)|Here )/.test(line)?'nodes':'';return;}
|
||||
if(this.section==='topics'){if(/^[A-Za-z0-9_-]+$/.test(line)&&line!==this.call){this.topics.push(line);}return;}
|
||||
if(this.section==='links'){const m=line.match(/^([A-Z0-9]+(?:-\d+)?)\s+(Open|Connect failed|Connecting|Closed|Idle)(.*)$/i);if(m){this.links.push({call:m[1],state:m[2],detail:m[3].trim()});return;}this.section='';}
|
||||
if(/^(Nodes via|\s*[A-Z0-9#]{3,6}(?:\s+[A-Z0-9#]{3,6}){2,})/.test(line))return;
|
||||
if(/^Nodes via /.test(line)){this.section='nodes';return;}
|
||||
if(this.section==='nodes'&&/^[A-Z0-9#][A-Z0-9#_-]{0,31}(?:\s+[A-Z0-9#][A-Z0-9#_-]{0,31})*$/.test(line))return;
|
||||
if(/^[A-Z0-9-]+ Chat Server|^Type \/h|^Bringing up links|^This may take|^The \/p|^[A-Z0-9]{1,6}:/.test(line))return;
|
||||
const message=line.match(/^(?:\d{2}:\d{2}(?::\d{2})?\s+)?(?:<|\[)?([A-Z0-9]*\d[A-Z0-9]*(?:-\d+)?)(?:>|\])?\s*(?:\([^)]*\))?[: ]+(.+)$/);
|
||||
this.event(message?'message':'system',message?message[2]:line,message?message[1]:null);}
|
||||
|
||||
Reference in new issue
Block a user