summaryrefslogtreecommitdiffstats
path: root/cholerab/IRC-RPC
blob: a535053498c04ec0c46afcb8006b125e78b6b8c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Krebs IRC RPC

    on :<from> PRIVMSG <target> :<handle>: <command> <argument>
    
      if <handle> ∈ { nickname, "ALL" }
        if <command> is a public command
    
          path = $__public_command_directory/<command>
          argv = []
          envp = { from: <from>, argument: <argument> }
    
          <code> = execve(path, argv, envp) → <stdout>, <stderr>
    
          if <code> = 0
            if <target> is channel
              PRIVMSG <target> :<from>: <stdout>
              PRIVMSG <from> :<stderr>
            else
              ; TODO assert <target> = <from>
              PRIVMSG <from> :<stdout>
              PRIVMSG <from> :Error: <stderr>
          else

            send all <.*> to the Ministerium
    
            if <target> is channel
              PRIVMSG <target> :<from>: <command> is broken ATM
            else
              PRIVMSG <target> :Error: <command> is broken ATM
    
        else
          PRIVMSG <target> :<from>: you are made of stupid