SOURCES: t0xirc.php - if no message is given in commandline, proce...
glen
glen at pld-linux.org
Mon May 22 18:27:54 CEST 2006
Author: glen Date: Mon May 22 16:27:54 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- if no message is given in commandline, process STDIN
---- Files affected:
SOURCES:
t0xirc.php (1.2 -> 1.3)
---- Diffs:
================================================================
Index: SOURCES/t0xirc.php
diff -u SOURCES/t0xirc.php:1.2 SOURCES/t0xirc.php:1.3
--- SOURCES/t0xirc.php:1.2 Fri Mar 31 23:43:12 2006
+++ SOURCES/t0xirc.php Mon May 22 18:27:49 2006
@@ -13,9 +13,23 @@
$mybot =& new t0xirc_bot($opt['u'], $opt['p'], $opt['h'], $opt['P']);
$mybot->connect() or die("Unable to connect\n");
-$mybot->say($opt['m'], $opt['c']);
printf("Connected to %s default chan %s.\n", $mybot->bot_nick, $mybot->channel['name']);
+
+if ($opt['m']) {
+ $mybot->say($opt['m'], $opt['c']);
+} else {
+ // read from stdin
+ $fp = STDIN;
+ while (!feof($fp)) {
+ $line = fgets($fp, 4096);
+ if (!$line) {
+ break;
+ }
+ $mybot->say($line, $opt['c']);
+ }
+ fclose($fp);
+}
$mybot->disconnect();
================================================================
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/t0xirc.php?r1=1.2&r2=1.3&f=u
More information about the pld-cvs-commit
mailing list