Changeset 43 for trunk/awkbot/lib/awkbot.awk
- Timestamp:
- 07/12/07 19:08:23 (18 months ago)
- Files:
-
- 1 modified
-
trunk/awkbot/lib/awkbot.awk (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/awkbot/lib/awkbot.awk
r8 r43 77 77 78 78 function irc_handler_privmsg (nick, host, recipient, message, arg \ 79 ,direct,target,address,action, t,q,a) {79 ,direct,target,address,action,c_msg,argc,t,q,a) { 80 80 81 81 if (recipient ~ /^#/) target = recipient 82 82 else target = nick 83 83 84 # Unfortunately, the API doesn't tell me how many arguments are 85 # available...but I need the number of arguments to join. I might want to 86 # fix this some day. 87 argc = 0 88 for (key in arg) argc++ 89 84 90 if (substr(arg[1], 0, length(irc["nickname"])) == irc["nickname"]) { 85 91 direct = 1 86 92 shift(arg) 93 c_msg = join(arg, 0, argc, OFS) 87 94 } 88 95 else { 89 96 direct = (target != recipient) 97 # It's either privmsg, or they're not talking to us, so the clean 98 # message is the whole message. 99 c_msg = message 90 100 } 91 101 … … 102 112 awkbot_db_answer(arg[1], join(arg, 3, sizeof(arg), " ")) 103 113 irc_privmsg(target, address "Okay") 114 } 115 # It's only numbers and stuff 116 else if (c_msg ~ /^[0-9*+\/() -]*$/) { 117 action = "bc -q" 118 print c_msg |& action 119 action |& getline a 120 close(action) 121 irc_privmsg(target, address a) 104 122 } 105 123 else {