From dd71d4f9eca5f6cb366899f2935d0a7b65cb4a3f Mon Sep 17 00:00:00 2001 From: crutchy- Date: Thu, 2 Apr 2015 23:28:54 +1100 Subject: [PATCH] whatever i changed --- cmd/cmd_join.php | 22 ++++++---------------- cmd/cmd_privmsg.php | 15 ++------------- cmd/cmd_who.php | 13 +++---------- ircd.php | 3 +-- ircd_lib.php | 20 ++++++++++++++++++++ sh/up.sh | 9 +++++++++ 6 files changed, 41 insertions(+), 41 deletions(-) create mode 100644 sh/up.sh diff --git a/cmd/cmd_join.php b/cmd/cmd_join.php index 697e151..345bd30 100644 --- a/cmd/cmd_join.php +++ b/cmd/cmd_join.php @@ -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$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); } } } diff --git a/cmd/cmd_who.php b/cmd/cmd_who.php index ea744cc..f046e05 100644 --- a/cmd/cmd_who.php +++ b/cmd/cmd_who.php @@ -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); } ##################################################################################################### diff --git a/ircd.php b/ircd.php index 0b86b15..1ee2a75 100644 --- a/ircd.php +++ b/ircd.php @@ -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 @@ -126,7 +126,6 @@ } $addr=""; socket_getpeername($read_client,$addr); - #broadcast("$addr: $data"); on_msg($client_index,$data); } } diff --git a/ircd_lib.php b/ircd_lib.php index 951dab2..39ea14b 100644 --- a/ircd_lib.php +++ b/ircd_lib.php @@ -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; diff --git a/sh/up.sh b/sh/up.sh new file mode 100644 index 0000000..3c07f2f --- /dev/null +++ b/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