Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTCP PING does not return correct value #519

Closed
stuxamber opened this issue Jan 14, 2024 · 6 comments
Closed

CTCP PING does not return correct value #519

stuxamber opened this issue Jan 14, 2024 · 6 comments
Assignees
Labels
Element: IRC Issues related to TIdIRC and TIdIRCServer Status: Fixed Issue has been fixed, no further work needed Type: Bug Issue is a bug in existing code

Comments

@stuxamber
Copy link

Hello,

When receiving a CTCP ping on the irc client, it returns a value that is very far off than what seems correct.

I thought it was an error, and have tested with multiple irc clients and all leading to the same result.

Thanks.

@stuxamber stuxamber added Status: Reported Issue has been reported for review Type: Bug Issue is a bug in existing code labels Jan 14, 2024
@rlebeau rlebeau added the Element: IRC Issues related to TIdIRC and TIdIRCServer label Jan 15, 2024
@rlebeau
Copy link
Member

rlebeau commented Jan 15, 2024

Can you be more specific? What is the exact problem? And, if multiple IRC clients have the same problem, what would you like Indy to do about it? Sounds like maybe it is a server-side problem.

@rlebeau rlebeau added Status: More Info Needed Issue needs further information to continue progress and removed Status: Reported Issue has been reported for review labels Jan 15, 2024
@stuxamber
Copy link
Author

stuxamber commented Jan 15, 2024

Sorry for not being specific.

When running an irc client under IdIRC.pas, I would use a different irc client such as mIRC to ping the id irc client, but it returns weird values such as PING REPLY 47367hrs 30mins 54secs.

It doesn’t make sense for a ping reply to take that long.

I have tested with different irc clients and all gave the correct response except for IdIRC.

You can test it by running a connection to any irc server using IdIRC, and then use a different irc client to ping it.

@rlebeau
Copy link
Member

rlebeau commented Jan 17, 2024

I think the problem stems from TIdIRC treating a CTCP PING request the same as a CTCP TIME request, ie it sends a human-readable date/time string for the current machine that TIdIRC is running on. But a CTCP PING request is supposed to contain a timestamp that the requesting client chooses, and the target client is supposed to echo that timestamp back to the sender so the difference in times can be calculated relative to the requester's local clock.

Try this - in IdIRC.pas, change line 1579 (in the PING handler of TIdIRC.CommandPRIVMSG()) from this:

CTCPReply(FSenderNick, LCTCP, DateTimeToStr(Now)); {do not localize}

To this instead:

if LData = '' then begin
  LData := DateTimeToStr(Now);
end;
CTCPReply(FSenderNick, LCTCP, LData); {do not localize}

If that works, I will merge it in.

@rlebeau rlebeau self-assigned this Jan 17, 2024
@rlebeau rlebeau added Status: Pending Issue is pending external update or release and removed Status: More Info Needed Issue needs further information to continue progress labels Jan 17, 2024
@stuxamber
Copy link
Author

I tried the change but it doesn’t seems to work, or I am doing it wrongly.

I changed the source directly from the folder and saved it and run my project but it doesn’t seems to reflect the changes.

@rlebeau
Copy link
Member

rlebeau commented Jan 17, 2024

I changed the source directly from the folder and saved it and run my project but it doesn’t seems to reflect the changes.

Are you compiling Indy's source files directly into your project? If not, then you have to recompile+reinstall the Indy libs and link them into your project.

@rlebeau
Copy link
Member

rlebeau commented Feb 20, 2024

Any update?

rlebeau added a commit that referenced this issue Apr 5, 2024
…NG using the sender's data that was received.

Bumping version number.

Adding some TODO comments.
@rlebeau rlebeau added Status: Fixed Issue has been fixed, no further work needed and removed Status: Pending Issue is pending external update or release labels Apr 5, 2024
@rlebeau rlebeau closed this as completed Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Element: IRC Issues related to TIdIRC and TIdIRCServer Status: Fixed Issue has been fixed, no further work needed Type: Bug Issue is a bug in existing code
Projects
None yet
Development

No branches or pull requests

2 participants