Opened 9 years ago

Last modified 7 years ago

#1335 defect new

Accept current reality of CTCP protocol.

Reported by: gnuk Owned by: nullie
Priority: high Milestone:
Component: words Keywords:
Cc: exarkun, gnuk Branch:
Author: Launchpad Bug:

Description


Attachments (3)

test_BUG_ircClient.py (1.7 KB) - added by gnuk 9 years ago.
twisted-words-ctcp-quoting.diff (2.4 KB) - added by nullie 7 years ago.
twisted-words-ctcp-quoting.2.diff (8.0 KB) - added by nullie 7 years ago.
New view on this.

Download all attachments as: .zip

Change History (11)

Changed 9 years ago by gnuk

comment:1 Changed 9 years ago by gnuk

Hello,
I use twisted.words for an irc log bot.
I join a peace of code whose get mistake meet error,
based on example ircLogBot.py 
(http://twistedmatrix.com/projects/words/documentation/examples/ircLogBot.py).

Bot connect to server and join a channel, and when an user say :
"foobar \o/", log's bot indicate :
"2005/11/12 20:23 CET [LogBot,client] raw data from privmsg :  foobar \o/",

but when an user say : 
"/me foobar \o/", an action, log's bot indicate :
"2005/11/12 20:23 CET [LogBot,client] raw data from action :  foobar o/",
escape character « \ » (in python) disapear.

If an user say :
"/me foobar \\o/", always an action, but with additional escape character,
log's bot indicate : 
"2005/11/12 20:23 CET [LogBot,client] raw data from action :  foobar \o/".

I think it's just an error with escape characters in basic.LineReceiver, but I
don't find
any mistake in source.

Thanks,
Sorry for my poor english.

comment:2 Changed 7 years ago by nullie

  • Summary changed from bad interpretation with escape characters in twisted.words (IRC) to IRC clients not following CTCP protocol specification.

Ok. I've figured out that this due to ctcp quoting and dequoting.
According to http://www.irchelp.org/irchelp/rfc/ctcpspec.html, extended messages (and ACTION is extended message), must be quoted, using backslash ("\") as escape character.
And Twisted respects this in both directions (quoting and dequoting). But most (all? I tried X-Chat, epic4, inettool (mobile client)) conventional IRC clients don't quote and dequote ACTION ctcp messages.

Should we add special handling for ACTION ctcp message?

Changed 7 years ago by nullie

comment:3 Changed 7 years ago by nullie

  • Keywords review added
  • Summary changed from IRC clients not following CTCP protocol specification. to Accept current reality of CTCP protocol.

I've attached a patch with a test case. Waiting for review.

comment:4 Changed 7 years ago by nullie

http://www.irchelp.org/irchelp/rfc/index.html says that more current ctcp specification, adopted by major irc client is at: http://www.invlogic.com/irc/ctcp.html
But that document is confusing on subject of CTCP high-level quoting. Maybe we should consider quoting only X-DELIM to be safe.

comment:5 Changed 7 years ago by nullie

comment:6 Changed 7 years ago by nullie

http://www.kvirc.de/docu/doc_ctcp_handling.html has a nice view. Current implementation in Twisted incorporates part of that approach.

We may assume there is only one CTCP extended message in IRC message and forget about CTCP quoting, only adopting practices of current clients to be compatible with them.

Changed 7 years ago by nullie

New view on this.

comment:7 Changed 7 years ago by exarkun

  • Keywords review removed
  • Owner changed from exarkun to nullie

This seems like it might be a good improvement to make. The change should be backwards compatible, though. That means deleting all those functions shouldn't happen and the signature change should be avoided. There's also a problem with communicating with freenode with this patch -- parsing the message into two parts in ctcpParse sometimes fails with a TypeError.

comment:8 Changed 7 years ago by chewy

Also, you probably want to run the included test in twisted/doc/words/examples/ircLogBot.py against the patched sources. With the last patch, I got a tuple unpack error in ctcpParse

Note: See TracTickets for help on using tickets.