Menu

#8 RFC 2812 prefix parsing

open
nobody
None
5
2005-05-28
2005-05-28
No

Prefix parsing according to RFC 2812 2.3.1.
Now it is possible to distinguish origin of messages
(user or server) by empty $ircdata->nick, ident or host
fields.
---
prefix = servername / ( nickname [ [ "!" user ] "@"
host ] )
---
this could also be done by regex
"|^([^.\s]+)((!(\S+))?@(\S+))?$|U"
$1 - nick, $4 - ident, $5 - host
something like this

if (preg_match("|^([^.\s]+)((!(\S+))?@(\S+))?$|U",
$from, $matches)) {

$ircdata->nick = $matches[1];
$ircdata->ident = $matches[4];
$ircdata->host = $matches[5]

}

$ircdata->from = $from;

Discussion

  • anatoly techtonik

    patch without regexp

     
  • anatoly techtonik

    Logged In: YES
    user_id=669020

    forgot to add - patch attached

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.