Skip to content

Commit

Permalink
whatever i changed
Browse files Browse the repository at this point in the history
  • Loading branch information
crutchy- committed Apr 2, 2015
1 parent afc8aa1 commit dd71d4f
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 41 deletions.
22 changes: 6 additions & 16 deletions cmd/cmd_join.php
Expand Up @@ -35,24 +35,14 @@ function cmd_join($client_index,$items)
}
$channels[$chan]["nicks"][]=$nick;
$prefix=$nicks[$nick]["prefix"];
$msg=":".$prefix." JOIN ".$chan;
#$msg="*** JOIN MESSAGE RECEIVED FROM $addr";
#do_reply($client_index,$msg);
#broadcast($msg);
$msg1=":".SERVER_HOSTNAME." 353 $nick = $chan :".implode(" ",$channels[$chan]["nicks"]);
$msg2=":".SERVER_HOSTNAME." 366 $nick $chan :End of /NAMES list.";
$msg3=":".SERVER_HOSTNAME." 324 $nick $chan +nt";
$msg4=":".SERVER_HOSTNAME." 329 $nick $chan ".time();
$c=count($nicks[$nick]["connection"]);
for ($i=0;$i<$c;$i++)
for ($i=0;$i<count($channels[$chan]["nicks"]);$i++)
{
$conn=$nicks[$nick]["connection"][$i];
do_reply($conn["client_index"],$msg);
do_reply($conn["client_index"],$msg1);
do_reply($conn["client_index"],$msg2);
do_reply($conn["client_index"],$msg3);
do_reply($conn["client_index"],$msg4);
do_reply_nick($channels[$chan]["nicks"][$i],":".$prefix." JOIN ".$chan);
}
do_reply_nick($nick,":".SERVER_HOSTNAME." 353 $nick = $chan :".implode(" ",$channels[$chan]["nicks"]));
do_reply_nick($nick,":".SERVER_HOSTNAME." 366 $nick $chan :End of /NAMES list.");
do_reply_nick($nick,":".SERVER_HOSTNAME." 324 $nick $chan +nt");
do_reply_nick($nick,":".SERVER_HOSTNAME." 329 $nick $chan ".time());
}

#####################################################################################################
Expand Down
15 changes: 2 additions & 13 deletions cmd/cmd_privmsg.php
Expand Up @@ -16,22 +16,11 @@ function cmd_privmsg($client_index,$items)
$trailing=$items["trailing"];
if (isset($channels[$chan]["nicks"])==True)
{
$msg=construct_message($nick,"PRIVMSG",$chan,$trailing);
$n=count($channels[$chan]["nicks"]);
for ($i=0;$i<$n;$i++)
{
$c=count($nicks[$nick]["connection"]);
for ($j=0;$j<$c;$j++)
{
$conn=$nicks[$nick]["connection"][$j];
if ($conn["client_index"]<>$client_index)
{
$msg=construct_message($nick,"PRIVMSG",$chan,$trailing);
if ($msg!==False)
{
do_reply($conn["client_index"],$msg);
}
}
}
do_reply_nick($channels[$chan]["nicks"][$i],$msg,$client_index);
}
}
}
Expand Down
13 changes: 3 additions & 10 deletions cmd/cmd_who.php
Expand Up @@ -26,18 +26,11 @@ function cmd_who($client_index,$items)
$hostname=$nicks[$chan_nick]["hostname"];
$realname=$nicks[$chan_nick]["realname"];
$ident_prefix=$nicks[$chan_nick]["connection"][0]["ident_prefix"];
$c=count($nicks[$nick]["connection"]);
for ($j=0;$j<$c;$j++)
{
$conn=$nicks[$nick]["connection"][$j];
$msg=":".SERVER_HOSTNAME." 352 $nick $chan $ident_prefix"."$username $hostname ".SERVER_HOSTNAME." $chan_nick H@ :0 $realname";
do_reply($conn["client_index"],$msg);
}
do_reply($client_index,":".SERVER_HOSTNAME." 352 $nick $chan $ident_prefix"."$username $hostname ".SERVER_HOSTNAME." $chan_nick H@ :0 $realname");
}
# :irc.sylnt.us 315 crutchy #stuff :End of /WHO list.
do_reply($client_index,":".SERVER_HOSTNAME." 315 $nick $chan :End of /WHO list.");
}
# :irc.sylnt.us 315 crutchy #stuff :End of /WHO list.
$msg=":".SERVER_HOSTNAME." 315 $nick $chan :End of /WHO list.";
do_reply($client_index,$msg);
}

#####################################################################################################
Expand Down
3 changes: 1 addition & 2 deletions ircd.php
Expand Up @@ -9,7 +9,7 @@
*/

#define("LISTEN_ADDRESS","192.168.0.21");
define("LISTEN_ADDRESS","192.168.1.197");
define("LISTEN_ADDRESS","192.168.1.22");
define("LISTEN_PORT",6667);
define("CLIENT_TIMEOUT",60); # seconds

Expand Down Expand Up @@ -126,7 +126,6 @@
}
$addr="";
socket_getpeername($read_client,$addr);
#broadcast("$addr: $data");
on_msg($client_index,$data);
}
}
Expand Down
20 changes: 20 additions & 0 deletions ircd_lib.php
Expand Up @@ -120,6 +120,26 @@ function do_reply($client_index,$msg)

#####################################################################################################

function do_reply_nick($nick,$msg,$client_index=False)
{
global $nicks;
$c=count($nicks[$nick]["connection"]);
for ($i=0;$i<$c;$i++)
{
$conn=$nicks[$nick]["connection"][$i];
if ($client_index!==False)
{
if ($conn["client_index"]==$client_index)
{
continue;
}
}
do_reply($conn["client_index"],$msg);
}
}

#####################################################################################################

function construct_message($nick,$cmd,$params,$trailing)
{
global $nicks;
Expand Down
9 changes: 9 additions & 0 deletions sh/up.sh
@@ -0,0 +1,9 @@
#!/bin/bash

git add *
git commit -a -m "whatever i changed"
git push

rsync -av /home/jared/git/ircd/ jared@192.168.0.21:/home/jared/git/ircd/

exit 0

0 comments on commit dd71d4f

Please sign in to comment.