WU: Bot

Events happening in the community are now at Drupal community events on www.drupal.org.
snufkin's picture

Another week, some progress. After I learned how the socket communication behaves in my tests I was working on integrating the PHP IRCd into the test itself, so it would fire up a minimalistic, but functional PHP IRC server. Unfortunately I am at a standstill for days now, although the connection from the bot does get established, my server doesn't receive the first USER command from it, and the bot disconnects because it thinks the connection is refused. To debug this I have stripped down the IRC server into a light simple_server.php (found in the tests folder of my project). Removing code piece by piece i am learning its effect on the communication via the sockets.

You can try the server by
a) setting the bot to use port 6662,
b) start the server: php simple_server.php
c) start the bot as usual

The server will print debug information whenever there are messages coming or being sent.

To see my problem with the test just check out the tests and run the simpletest script:
php scripts/run-tests.sh --color --concurrency 2 --url http://d/Sites/botsite Bot

The output will look somewhat like this:

Drupal test run
---------------

Tests to be run:
 - Bot base testclass. (BotTestCase)
 - IRC server base test class (IrcServerTestCase)

Test run started: Tue, 06/30/2009 - 22:37

Test summary:
-------------

Jun 30 22:37:57 SmartIRC.php(830) DEBUG_CONNECTION: connecting
Jun 30 22:37:57 SmartIRC.php(835) DEBUG_SOCKET: using real sockets

Client at Resource id #605 has connected

Jun 30 22:37:57 SmartIRC.php(864) DEBUG_CONNECTION: connected
Jun 30 22:37:57 SmartIRC.php(983) DEBUG_CONNECTION: logging in
Jun 30 22:37:57 SmartIRC.php(1520) DEBUG_IRCMESSAGES: sent: "NICK testbot"
Jun 30 22:37:57 SmartIRC.php(1520) DEBUG_IRCMESSAGES: sent: "USER testbot 8 * :testbot :http://drupal.org/project/bot"

Client: Ahoj!

Jun 30 22:37:57 SmartIRC.php(1520) DEBUG_IRCMESSAGES: sent: "QUIT"

INITIAL_NICK says NICK testbot

Jun 30 22:37:58 SmartIRC.php(912) DEBUG_CONNECTION: disconnected

Bot base testclass. 0 passes, 0 fails, and 0 exceptions

Its clear that the bot sends the USER message, but the server only notices the NICK message. Note, since these two threads run parallel the order of the messages from the two threads might be misleading printed like this.

SoC 2009

Group categories

Admin Tags

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week