Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Find problem from ports

 [1/5] from: ptretter:charter at: 30-Sep-2000 12:24


I was creating a script for IRC when I noticed that the find command doesn't seem to work right from reading the port and parsing the data but does when reading from the console with the same functions. I am reading in a typical message string into iput-buffer for example (Port is opening a port to irc): ircparser: func [/local a b c][ a: parse/all copy input-buffer "!" sendnick: pick a 1 b: pick a 2 print b sendmsg: find b ":" print sendmsg c: parse copy input-buffer senduser: pick c 2 sendcmd: pick c 3 sendchan: pick c 4 ] while [true][ wait port input-buffer: copy first port if find/part input-buffer ":" 1 [ input-buffer: remove head input-buffer ircparser ] _________________________________ Console Windows _______________ NOTICE AUTH :*** Looking up your hostname... NOTICE AUTH :*** Found your hostname, cached NOTICE AUTH :*** Checking Ident NOTICE AUTH :*** No Ident response none ** Script Error: find expected series argument of type: series port bitset. ** Where: sendmsg: find b ":" print ________________________________________________________________ Anyone know what the problem is? Seems to work ok if I recreate the issue from the console.

 [2/5] from: jsc:dataheaven at: 1-Oct-2000 1:32


IMHO you make too much assumptions on the IRC-protocoll in your parser. Here's the more complete irc-parsing-function of my IRC-Bot: parse-msg: func [str [string!] /local _sender _par_tk _nick_tk _usr_tk _svr_tk _tpar_tk _trl_tk _cmd_tk _white _nonwhite _parch _space _middle _params _message] [ _white: charset [#" " #"^-" #"^@" #0 #"^M" #"^/"] _nonwhite: complement _white _parch: complement charset " ^-^@^M^/:" _space: [some _white] _middle: [_parch any _nonwhite] _params: [_space [ copy _tpar_tk _middle (append _par_tk _tpar_tk) _params | [#":" copy _trl_tk to end ]]] _message: [opt [#":" [[copy _nick_tk to "!" skip copy _usr_tk to "@" skip copy _svr_tk to " " skip] |copy _nick_tk to " " skip]] copy _cmd_tk to " " _params] clear _par_tk: [] set [_nick_tk _usr_tk _svr_tk _tpar_tk _trl_tk _cmd_tk] none parse/all str _message _sender: either _usr_tk [reduce ['nick _nick_tk 'user _usr_tk 'host _svr_tk]] [_nick_tk] make object! [ sender: _sender command: _cmd_tk parameters: copy _par_tk trailing-arg: _trl_tk ] ] It's not absolutely ready yet, but it works for all IRC-messages On Sat, 30 Sep 2000, you wrote:

 [3/5] from: ptretter::charter::net at: 30-Sep-2000 22:52


Your absolutely right - I made my ircparser very simple for the bots messages it recieves in the input-buffer based on what I am trying to achieve. I do intend to make a full fledged ircparser soon for my script but more importantly as a full irc compliant client in accorance with RFC 1459. I will also include ident server also when I am done. I did find that it wasnt a problem with find it was that I had received a message that didnt contain the "!" in the parse. It presented the problem. I fixed it with an if function to check for "!" before ircparsing. I have been very selective on the which incoming messages I use this ircparser function as I have other functions for different messages. I appreciate your input. Very helpful. Paul Tretter

 [4/5] from: jsc:dataheaven at: 1-Oct-2000 6:38


On Sun, 01 Oct 2000, you wrote:
> Your absolutely right - I made my ircparser very simple for the bots > messages it recieves in the input-buffer based on what I am trying to
<<quoted lines omitted: 7>>
> have other functions for different messages. > I appreciate your input. Very helpful.
Why not join forces to create a IRC-Bot that simply blasts all eggdrop-trash away? REBOL/Core is small enough to run on Shell-Accounts - it also supports eough platforms - so it seems to be the perfect language for an IRC-Bot. I plan following features: - Maintenance-port that gives a REBOL-Prompt to extend/bugfix the bot at runtime (Password authenticated with encrypted passwords) - Several in-IRC commands (KICK,JOIN,SEEN,PART,PASS...) - Different categories of users with configurable rights - Inter-Bot-Communications (to work togehter when something happens) - multiple server-connections from one REBOL process - and more to come... I've some experience in writing IRC-Bots. I've written a Bot with C++ and another with Commn Lisp (fully runtime extensible through maintenance-port) This bots run for several years now. Regards, Jochen

 [5/5] from: ptretter:charter at: 1-Oct-2000 7:26


Very cool. Im interested in the maintenance port idea. Not sure how to go about doing that. I also want a feature to crawl irc for information. That way the bot would just be "out there". Lets start a channel to exchange information somewhere. The bot can play a role in that. Paul Tretter

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted