All pastes #244622 Raw Edit

Something

public text v1 · immutable
#244622 ·published 2006-11-10 00:01 UTC
rendered paste body
                if (strtolower(substr($msgwithoutident, 0, 4)) == 'join' && $data->host == "unaffiliated/aheartattack/x-000001")
                {
                        $message = substr($msgwithoutident, 4, strlen($msgwithoutident)-4);
			global $channels;
			array_push($channels, $message);
			if ($message == '')
			{
				$irc->message(SMARTIRC_TYPE_CHANNEL, $recip, 'Incorrect usage. Correct usage: \'?join chan\'.');
				return;
			}
			$i = 0;
			global $channels;
			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++;
			}
			$irc->join($message);
			$valid_function = true;
                }

		if (strtolower(substr($msgwithoutident, 0, 4)) == 'part' && $data->host == "unaffiliated/aheartattack/x-000001") 
		{
			$message = substr($msgwithoutident, 4, strlen($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, strlen($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;
		}