Skip to content

Commit

Permalink
trivial optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
kazy111 committed Aug 25, 2012
1 parent 701550c commit 9591cdb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions check.php
Expand Up @@ -162,6 +162,9 @@ function update_ustream($pid, $id, $login, $live_st, $title){
$thumb = 'http://static-cdn2.ustream.tv/i/channel/live/1_'.$id.',192x108,b.jpg';
if($live_st || $change_flag)
log_print("<b>name:</b> ".$login." / ".$viewer);

if(mb_strlen($title, 'UTF-8') > 255)
$title = mb_substr($title, 0, 255-1, 'UTF-8').'…';
$manager->update_program($pid, $live_st, $viewer, $change_flag, $thumb, ($live_st?$title:''));
if($change_flag){
if($live_st){
Expand Down
12 changes: 7 additions & 5 deletions classes/ircbot.php
Expand Up @@ -90,12 +90,12 @@ function main($config, $rooms)
{
while(1){
$data = fgets($this->socket, 1024);

//echo nl2br($data);

flush();
//flush();

$this->ex = explode(' ', $data);
$this->ex = explode(' ', $data, 11);

if($this->ex[0] == 'PING') {
$this->send_data('PONG', $this->ex[1]); //Plays ping-pong with the server to stay connected.
Expand All @@ -104,7 +104,7 @@ function main($config, $rooms)
//print($data."\n");
switch($this->ex[1]){
case '322':
if(array_key_exists(strtolower($this->ex[3]), $rooms)){
if(isset($rooms[strtolower($this->ex[3])])){
array_shift($this->ex); array_shift($this->ex); array_shift($this->ex);
$r = strtolower(array_shift($this->ex));
$m = array_shift($this->ex); array_shift($this->ex);
Expand All @@ -120,10 +120,12 @@ function main($config, $rooms)
case '376':
$this->send_data('LIST');
break;
case '433':
case '433': // nick conflict
$config['nick'] .= '_';
$this->send_data('NICK', $config['nick']);
break;
//default:
// print($data."<br>\n");
}
}
}
Expand Down

0 comments on commit 9591cdb

Please sign in to comment.