From 452284ab9ed546a430cad13aeae4126cfcb616a2 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Fri, 16 Nov 2012 08:50:43 +0000 Subject: Parse PONG more leniently --- src/idle-parser.c | 2 +- tests/twisted/connect/ping.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/idle-parser.c b/src/idle-parser.c index 1699774..159e6cc 100644 --- a/src/idle-parser.c +++ b/src/idle-parser.c @@ -85,7 +85,7 @@ static const MessageSpec message_specs[] = { {"NOTICE", "cIr:", IDLE_PARSER_PREFIXCMD_NOTICE_CHANNEL}, {"NOTICE", "cIc:", IDLE_PARSER_PREFIXCMD_NOTICE_USER}, {"PART", "cIr.", IDLE_PARSER_PREFIXCMD_PART}, - {"PONG", "IIs:", IDLE_PARSER_PREFIXCMD_PONG}, + {"PONG", "IIs.", IDLE_PARSER_PREFIXCMD_PONG}, {"PRIVMSG", "cIr:", IDLE_PARSER_PREFIXCMD_PRIVMSG_CHANNEL}, {"PRIVMSG", "cIc:", IDLE_PARSER_PREFIXCMD_PRIVMSG_USER}, {"QUIT", "cI.", IDLE_PARSER_PREFIXCMD_QUIT}, diff --git a/tests/twisted/connect/ping.py b/tests/twisted/connect/ping.py index 9c1f6ca..09fafbd 100644 --- a/tests/twisted/connect/ping.py +++ b/tests/twisted/connect/ping.py @@ -16,6 +16,12 @@ def test(q, bus, conn, stream): stream.sendMessage('PONG', 'idle.test.server', ':%s' % timestamp, prefix='idle.test.server') + # Apparently bip replies like this: + e = q.expect('stream-PING') + assertLength(1, e.data) + timestamp = e.data[0] + stream.sendMessage('PONG', timestamp, prefix='idle.test.server') + q.expect('stream-PING') # If we don't answer Idle's ping, after some period of time Idle should # give up and close the connection. -- cgit v1.2.3