|
|
 |
 |
 |
|
 |
| dte96jbn |
| raw ctcp reply - is it possible? |
20 Jun 2003 11:48 PM |
|
dte96jbn
Junior Member
Registered: Sep 2002
Location:
Posts: 15
|
raw ctcp reply - is it possible?
I tried the ctcp reply event, but the Reply parameter was not the raw data I need.
I want the raw data sent in reply to a ctcp ping (which normally should be the same as the raw data _sent_).
I want something like
"PING 1056148764"
where is the ASCII char nr 1 that is used to enclose a ctcp message. is Chr(001) in vbscript.
I also tried to use the raw event, but I could not get it to go off at all.
question: Is it possible to get the raw data?
|
20 Jun 2003 11:48 PM |
|
|
|  |
 |
| tom |
| |
22 Jun 2003 02:04 AM |
|
tom
Klient Author
Registered: Sep 2002
Location: Blacksburg, Virginia, USA
Posts: 1542
|
The raw event is for numeric-type replies sent by the server (privmsg, notice, etc., do not fall into that category). You could use a "Server Data" event, but I wouldn't recommend it because it calls the script code for everything. There are better alternatives.
I would just use the CTCP event. If you need the data in its original form for whatever reason I can't guess, you know how to reconstruct it. For example, in a CTCP event for the PING, you are passed the CTCP and Params. You can reconstruct it with:
Dim OrigData
OrigData = Chr(1) & CTCP & " " & Params & Chr(1)
if you want to make it a little generic and you don't want the extra space in there if Params is empty, you could do something like:
Dim OrigData
OrigData = Chr(1) & CTCP & StrUtils.IfThen(Params <> "", " ", "") & Params & Chr(1)
That will give you the orginal data for any CTCP, regardless if it actually had additional text or not.
__________________
Tom McAlee
|
22 Jun 2003 02:04 AM |
|
|
|  |
 |
| dte96jbn |
| |
22 Jun 2003 03:25 AM |
|
dte96jbn
Junior Member
Registered: Sep 2002
Location:
Posts: 15
|
I tried using the CTCP event as you suggested, but it is not triggered on CTCP replies, only on CTCPs that aren't replies.
My problem still isn't solved, but I noticed some interesting behaviour in Klient:
In a CTCP event, Params behaves like it should.
For example if I send ctcps to myself like this:
window.Command "ctcp myself ping 1"
Params cointains "1"
and if I send
window.Command "ctcp myself ping 1 2"
Params cointains "1 2"
In a CTCP REPLY event if the ctcp ping reply has zero or one arguments (space seperated numbers), the Reply variable contains something like "0 seconds", when I recieve a ctcp reply with 2 or more arguments, the Reply variable contains the arguments seperated by spaces, just like I want them.
If I for example send a ctcp ping like this:
window.Command "ctcp nick ping 0"
Reply contains something like "37794 days 3 hours 52 minutes 15,02 seconds"
(I should have gotten "0", at least if what is in Reply is the actual data sent in the ctcp reply, since that is what I sent in the ctcp)
If I send a ctcp ping like this:
window.Command "ctcp nick ping 1 2"
Reply contains "1 2" (which is what I sent, so that is what I actually got back)
Depending on what you actually wanted Reply to contain, it is either doing what it should for CTCP REPLY events that contain 0-1 arguments but not for 2 or more arguments, or it is doing what it should for 2 or more arguments, but not fore 0-1 arguments.
The CTCP REPLY event does not have the Params param so I can't use that there.
Last edited by dte96jbn on 22 Jun 2003 at 03:37 AM
|
22 Jun 2003 03:25 AM |
|
|
|  |
 |
| tom |
| |
22 Jun 2003 04:01 AM |
|
tom
Klient Author
Registered: Sep 2002
Location: Blacksburg, Virginia, USA
Posts: 1542
|
Sorry, I thought you meant you wanted the info for a CTCP request, not the CTCP reply. While your assessment of the CTCP reply indicates what you're seeing, the explanation is not correct. It has nothing to do with how many parameters there are. The reply is the reply that Klient will show, which varies depending on the CTCP. The Ping example you're using is one of the special cases, where the reply is shown as "6.23 seconds" instead of the number.
But yeah... at that point, Klient has already determined what the reply text should be, which is what it passes to the event. In that case, I guess for now the only thing you can use is the "Server Data" event, although I really recommend avoiding that as much as possible. The best solution would be if I added an additional parameter to the CTCP Reply event to show the data that was originally received. Thats easy enough to add, so I'll do that for the next release.
__________________
Tom McAlee
|
22 Jun 2003 04:01 AM |
|
|
|  |
 |
| dte96jbn |
| |
22 Jun 2003 12:58 PM |
|
dte96jbn
Junior Member
Registered: Sep 2002
Location:
Posts: 15
|
Yes, that would be great. Thanks!
|
22 Jun 2003 12:58 PM |
|
|
|  |
 |
| All times are GMT. The time now is 02:29 PM. |
 |
|
 |
|
|
|  |
|
 |
|
|
|
 |
 |
Forums Engine: vBulletin 2.2.7, Copyright ©2000 - 2002, Jelsoft Enterprises Limited. |
|
 |
 |
Copyright © 1997-2004, by Thomas J. McAlee, Jr. All rights reserved. Terms of Use. |
|
|
|
|