Additions to the IRC protocol File uploads A file uploading procedure consists of following steps: 1. The client sends a command: UPLOAD [channel] 2. The server responds with a token consisting of 32 chars between ASCII characters A - ~ (0x21 - 0x7E) and the HTTP port: ULTOKEN [token] [port] 3. The client establishes a TCP connection to the server's HTTP port and uses HTTP's PUT method to upload the file to the server. The request headers MUST include fields "Content-length" and "Upload-token", where the value of the latter is the token from the server's response from the previous step. The server can change the filename to prevent filename collisions. The token expires after use. 4. After the upload is complete, if the user is still present at the channel, the server sends an ACTION message to everyone in the channel, including the user who uploaded the file. This action message contains a HTTP link to the uploaded file. If the user is not in the channel anymore, the server may silently delete the uploaded file. An example of client-server-communication: [irc] Client: UPLOAD #computers [irc] Server: ULTOKEN ABCDEABCDEABCDEABCDEABCDEABCDEAB 80 [http] Client: PUT /commodore_64.png HTTP/1.1 Content-length: 12835 Upload-token: ABCDEABCDEABCDEABCDEABCDEABCDEAB [png binary data...] [irc] Server: :leet_haxor!~username@isp.connection.com PRIVMSG #computers :\001ACTION uploaded a file: http://this.irc.server:80/upload/FSEKGJAGcommodore_64.png\001 VoIP There are two types of VoIP connections: client-to-client (p2p) VoIP calls and client-to-server calls. Client-to-client call has a shorter latency, but most ISPs nowadays block UDP packets to arbitrary ports of arbitrary hosts, for which reason p2p usually doesn't work over public internet connection. In a client-to- server call the client sends the voice frames to the server, which then forwards the frames to every other client in the same VoIP call. When creating a channel, the name of the channel must begin with a '!' to enable the VoIP functionality. Client-to-server calls A call is established with the following procedure: 1. The client sends a command: SCALL [channel] 2. The server sends a response that tells the UDP port of the VoIP subprotocol and a token that is used later. The token is 250 bytes long and consists of ASCII characters between ' ' and '~'.. VOICEPORT [port] [token] 3. The client sends an UDP packet to the port from the server's response. The payload of the UDP packet is the token. When the server receives this packet, the user is joined to the VoIP call. 4. The server sends the list of other participants in the VoIP call to the user using the IRC socket. The format of the message is: VOIPJOIN [channel] [nickname] 5. The server informs the other VoIP participants that the user has joined the VoIP call using the IRC socket and the same message format as in step 4. 6. When the user speaks, the client sends UDP packets to the server using the same port numbers as in step 3. The payload of the UDP packet is the raw OPUS- encoded data of the voice sample. The server then builds an UDP packet that has the following payload: [user's nickname\0] [voice frame] The packet consisting of the ASCIIZ string of the user's nickname and the OPUS frame is then sent to every other participant in the VoIP call. The destination ports used are the same ports that were used by each client as the source port in step 3. The voice frame starts after the first NULL byte. 7. When the user wants to end the call, the client sends the following command using the IRC socket: HANGUP The server then sends the following message to every client in the VoIP call, including the user: HANGUP [channel] [nickname] An user may also be forcefully removed from the call by a channel operator. In that case the above message is also sent. Client-to-client calls A call is established with a following procedure. 1. The client sends a command: PCALL [channel] 2, 3. These steps are the same as with client-to-server calls. 4. The server sends the IP addresses and UDP ports of other VoIP participants to the user using the IRC socket. The format of the message is: VOIPUDP [nickname] [ip address] [udp port] 5. The server informs the other VoIP participants that the user has joined the VoIP call using the IRC socket and the same message format as in step 4. 6. When the user speaks, the client sends UDP packets directly to the other VoIP participants using the destination ports from step 4. The payload of the UDP packet is the raw OPUS-encoded data of the voice sample. The source port is the same as in step 3. 7. When the user wants to end the call, the client sends the following command using the IRC socket: HANGUP The server then sends the following message to every client in the VoIP call, including the user: HANGUP [nickname]