mirror of
https://github.com/vishapoberon/vipak.git
synced 2026-04-05 20:42:26 +00:00
different handling of different message types. -- noch
This commit is contained in:
parent
898bab4509
commit
fc6636cf9d
1 changed files with 53 additions and 20 deletions
51
IRC.Mod
51
IRC.Mod
|
|
@ -165,7 +165,7 @@ BEGIN
|
||||||
sh.zeroStr(str);
|
sh.zeroStr(str);
|
||||||
b := Internet.Read(inst.connection, str);
|
b := Internet.Read(inst.connection, str);
|
||||||
IF b THEN
|
IF b THEN
|
||||||
Out.String("received: '"); Out.Ln;
|
Out.String("received: '");
|
||||||
Out.String(str); Out.String("'"); Out.Ln;
|
Out.String(str); Out.String("'"); Out.Ln;
|
||||||
ELSE
|
ELSE
|
||||||
Out.String("receive failed"); Out.Ln;
|
Out.String("receive failed"); Out.Ln;
|
||||||
|
|
@ -377,24 +377,54 @@ END cutMentionFromMessage;
|
||||||
PROCEDURE parse(VAR inst: instance; VAR line: ARRAY OF CHAR);
|
PROCEDURE parse(VAR inst: instance; VAR line: ARRAY OF CHAR);
|
||||||
VAR
|
VAR
|
||||||
message: ARRAY msgLen OF CHAR;
|
message: ARRAY msgLen OF CHAR;
|
||||||
user, username, identname : ARRAY 64 OF CHAR;
|
userpart, username, identname : ARRAY 64 OF CHAR;
|
||||||
host: ARRAY 64 OF CHAR;
|
host: ARRAY 64 OF CHAR;
|
||||||
messagetype: ARRAY 16 OF CHAR;
|
messagetype: ARRAY 16 OF CHAR;
|
||||||
rcpt: ARRAY 64 OF CHAR;
|
rcpt: ARRAY 64 OF CHAR;
|
||||||
b: BOOLEAN;
|
b: BOOLEAN;
|
||||||
mn: BOOLEAN;
|
mn: BOOLEAN;
|
||||||
|
i: INTEGER;
|
||||||
BEGIN
|
BEGIN
|
||||||
|
i := 0; mn := FALSE; b := FALSE;
|
||||||
b := getUser(line, user);
|
b := getUser(line, userpart);
|
||||||
b := getMsgType(line, messagetype);
|
b := getMsgType(line, messagetype);
|
||||||
b := getRecipient(line, rcpt);
|
|
||||||
b := getMsg(line, message);
|
|
||||||
|
|
||||||
|
IF (messagetype = msgNOTICE) OR (messagetype = msgJOIN) OR
|
||||||
|
(messagetype = msgQUIT) OR (messagetype = msgPRIVMSG) THEN
|
||||||
|
|
||||||
IF messagetype = msgPRIVMSG THEN
|
IF messagetype = msgPRIVMSG THEN
|
||||||
b := getUserName(user, username);
|
b := getUserName(userpart, username);
|
||||||
b := getIdentName(user, identname);
|
b := getIdentName(userpart, identname);
|
||||||
b := getHost(user, host);
|
b := getHost(userpart, host);
|
||||||
|
b := getRecipient(line, rcpt);
|
||||||
|
b := getMsg(line, message);
|
||||||
|
END;
|
||||||
|
|
||||||
|
IF messagetype = msgNOTICE THEN
|
||||||
|
username := "";
|
||||||
|
identname := "";
|
||||||
|
host := userpart;
|
||||||
|
Strings.Delete(host, 0, 1);
|
||||||
|
b := getRecipient(line, rcpt);
|
||||||
|
b := getMsg(line, message);
|
||||||
|
END;
|
||||||
|
|
||||||
|
IF messagetype = msgJOIN THEN
|
||||||
|
b := getUserName(userpart, username);
|
||||||
|
b := getIdentName(userpart, identname);
|
||||||
|
b := getHost(userpart, host);
|
||||||
|
b := getRecipient(line, rcpt);
|
||||||
|
message := "";
|
||||||
|
END;
|
||||||
|
|
||||||
|
IF messagetype = msgQUIT THEN
|
||||||
|
b := getUserName(userpart, username);
|
||||||
|
b := getIdentName(userpart, identname);
|
||||||
|
b := getHost(userpart, host);
|
||||||
|
rcpt := "";
|
||||||
|
message := "";
|
||||||
|
Strings.FindNext(":", line, 1, b, i);
|
||||||
|
sh.getTillEOL(line, i, message);
|
||||||
END;
|
END;
|
||||||
|
|
||||||
IF rcpt = inst.nick THEN (* private message *)
|
IF rcpt = inst.nick THEN (* private message *)
|
||||||
|
|
@ -408,6 +438,9 @@ BEGIN
|
||||||
inst.callbackPublic(message, messagetype, username, identname, rcpt, host);
|
inst.callbackPublic(message, messagetype, username, identname, rcpt, host);
|
||||||
END;
|
END;
|
||||||
END;
|
END;
|
||||||
|
ELSE
|
||||||
|
Out.String("unknown msg type: '"); Out.String(message); Out.String("' - ignoring!"); Out.Ln;
|
||||||
|
END;
|
||||||
END parse;
|
END parse;
|
||||||
|
|
||||||
PROCEDURE processResponse(VAR inst: instance; VAR line: ARRAY OF CHAR): BOOLEAN;
|
PROCEDURE processResponse(VAR inst: instance; VAR line: ARRAY OF CHAR): BOOLEAN;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue