All pastes #342305 Raw Edit

Rick

public text v1 · immutable
·published 2007-02-06 06:09 UTC
rendered paste body
#100:dispatch   this none this
 1:  line = args[1];
 2:  if (length(line) == 0)
 3:    return;
 4:  endif
 5:  rawline = line;
 6:  if (line[1] == ":")
 7:    {prefix, line} = this:token(line);
 8:    prefix = prefix[2..$];
 9:  else
10:    prefix = "";
11:  endif
12:  {command, line} = this:token(line);
13:  params = {};
14:  while (length(line) > 0)
15:    if (line[1] == ":")
16:      params = listappend(params, line[2..$]);
17:      break;
18:    endif
19:    {param, line} = this:token(line);
20:    params = listappend(params, param);
21:  endwhile
22:  command = $su:lowercase(command);
23:  handler = "handle_" + command;
24:  result = `this:(handler)(prefix, params) ! E_VERBNF => 0';
25:  if (result == 0)
26:    #97:tell("IRC unhandled: ", toliteral({command, prefix, params}));
27:  endif