summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2016-08-17 19:22:54 +0200
committerJulien Dessaux2016-08-17 19:22:54 +0200
commit21258ec3e64b5d1d909a0853cb0f530bb1cc0fa5 (patch)
treed993c5acd93b7d389673b81edabcbb28c1b54056
parentRewrote the irc connection steps for clarity (diff)
downloadb98-21258ec3e64b5d1d909a0853cb0f530bb1cc0fa5.tar.gz
b98-21258ec3e64b5d1d909a0853cb0f530bb1cc0fa5.tar.bz2
b98-21258ec3e64b5d1d909a0853cb0f530bb1cc0fa5.zip
Wrote a proper IRC parser
There are limitations : currently the parser would loop infinitely if there were no \r\n (but the c wrapper would catch that), or if there were no spaces, and it would miss the cmd and params starting char if they were separated by more than one space. Those caveats aside, it works great! And that's more than enough for now.
-rw-r--r--bot.b9825
1 files changed, 19 insertions, 6 deletions
diff --git a/bot.b98 b/bot.b98
index 3252448..4834fa1 100644
--- a/bot.b98
+++ b/bot.b98
@@ -1,6 +1,19 @@
-<v < > #;>:#,_e-j; "PASS my_secrets"da
- <v < > #;>:#,_e-j; "NICK b98"da
- <v < > #;>:#,_e-j; "USER b98 0 0 b98"da
- <v < > #;>:#,_e-j; "JOIN #test"da
- > >~:'P-#v_~'I-#v_~'N-#v_~'G-#v_ $ ad"uoarg GNOP"ck,v
- ^$ <# < < < <
+< v < > #;>:#,_e-j; "PASS my_secrets"da p300
+ <v < > #;>:#,_e-j; "NICK b98"da
+;v;<; < > #;>:#,_e-j; "USER b98 0 0 b98"da
+#####;len,pos,cmd,params,counter;
+################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
+ v < p300< <
+ v_d03g2-4g-| > 13gv
+ ~ vp320p310< |+1g31g4p31-1:<p30:p31:-1g30 <
+ :-0> ;>3g23pv;# <^ ,kg30<
+ 0a3| 1v < ;
+ 3p3>v_^v_13g33p23g:1+13p4g'0-#v_13g:1+13p4g'0-#v_13g:1+13p4g'1-#v_ad"tset# nioj"bk,^
+ g4p#1- 1-v < < <
+ :p0-3 3 >23g:1+13p4g'P-#v_13g:1+13p4g'I-#v_13g:1+13p4g'N-#v_13g:1+13p4g'G-#v_13g:1+13p4g' -#v_'O14p^
+ 134:g' g' ;v < < < < <
+ +0g':g :g ^<
+ >^>^14 14
+ +p +p
+ 13 13
+ >^ >^