if (strtolower(substr($msgwithoutident, 0, 4)) == 'join' && $data->host == "unaffiliated/aheartattack/x-000001") { $message = substr($msgwithoutident, 4); global $channels; array_push($channels, $message); if ($message == '') { $irc->message(SMARTIRC_TYPE_CHANNEL, $recip, 'Incorrect usage. Correct usage: \'?join chan\'.'); return; } $irc->join($message); $i = 0; while ($i != count($channels)) { if ($channels[$i] == 'nothing') { $i++; } if ($channels[$i] == $message) { $irc->message(SMARTIRC_TYPE_CHANNEL, $recip, 'I\'m already on that channel.'); return; } $i++; } $valid_function = true; } if (strtolower(substr($msgwithoutident, 0, 4)) == 'part' && $data->host == "unaffiliated/aheartattack/x-000001") { $message = substr($msgwithoutident, 4); if ($message == '') { $message = $recip; } $irc->part($message); $i = 0; global $channels; while ($i < count($channels)) { if ($channels[$i] == $message) { $channels[$i] = 'nothing'; return; } $i++; } $valid_function = true; } if (strtolower(substr($msgwithoutident, 0, 8)) == 'channels') { $msgwithoutcommand = substr($msgwithoutident, 8); global $channels; $i = 0; $channel_string = ''; while ($i < count($channels)) { if ($channels[$i] == 'nothing') { $i++; } if ($i < count($channels)-1) { $channel_string .= $channels[$i].', '; } if ($i == count($channels)-1) { $channel_string .= $channels[$i].'.'; } $i++; } var_dump($channels); $channel_string = implode(",", $channels); $irc->message(SMARTIRC_TYPE_CHANNEL, $recip, $data->nick.': I\'m currently in the following channels: '.$channel_string.'.'); $valid_function = true; }