2 /******************************* PHP-P10 v2 *****************************
3 * Copyright (C) 2011 Philipp Kreil (pk910) *
5 * This program is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 3 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 ************************************************************************
20 * Uplink/P10Formatter.class.php
22 * This file contains the command formatter.
28 private static $commands = array(
30 "SERVER" => "SERVER %s 1 %s %s J10 %s]]] +s6 :%s",
31 "ERROR" => "ERROR :%s",
33 "N" => "{num} N %s 1 %s %s %s %s %s %s :%s",
36 "B" => "{num} B %s %s %s",
38 "D" => "{num} D %s :%s (%s)",
39 "J" => "%s J %s %s %s",
40 "K" => "%s K %s %s :%s",
45 "SM" => "%s SM %s %s",
46 "OM" => "%s OM %s %s",
47 "311" => "{num} 311 %s %s %s %s * :%s",
48 "319" => "{num} 319 %s %s :%s",
49 "312" => "{num} 312 %s %s %s :%s",
50 "313" => "{num} 313 %s %s :%s",
51 "330" => "{num} 330 %s %s %s :is logged in as",
52 "318" => "{num} 318 %s %s :End of /WHOIS list.",
53 "401" => "{num} 401 %s %s :No such nick",
54 "SQ" => "{num} SQ :%s",
58 public static function formatCMD($numeric, $command, $args) {
59 if(array_key_exists($command, self::$commands)) {
60 $command = self::$commands[$command];
61 $command = vsprintf($command, $args);
63 $command = vsprintf($command, $args);
65 return str_replace("{num}", $numeric, $command);