-
Notifications
You must be signed in to change notification settings - Fork 9
max message size and header guards #35
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| /* | ||
| * Off-the-Record Messaging (OTR) module for the irssi IRC client | ||
| #ifndef OTR_H | ||
| #define OTR_H | ||
| /* | ||
| * Off-the-Record Messaging (OTR) module for IRC clients | ||
| * *************************************************** | ||
| * Copyright (C) 2008 Uli Meis <[email protected]> | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify | ||
|
|
@@ -54,14 +57,12 @@ void otr_log (IRC_CTX *server, const char *to, | |
| /* own */ | ||
|
|
||
| #include "config.h" | ||
|
|
||
| #include "otr-formats.h" | ||
|
|
||
| /* | ||
| * maybe this should be configurable? | ||
| * I believe bitlbee has something >500. | ||
| */ | ||
| #define OTR_MAX_MSG_SIZE 400 | ||
| /* Most IRC servers limit messages to 512 bytes in length, | ||
| * including trailing whitespace and the CR-LF terminating characters | ||
| * i.e len( bytes(msg) | <0x20> x ... | <0x0D0A> ) <= 512 bytes */ | ||
| #define OTR_MAX_MSG_SIZE 510 //RFC 2812 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not certain this makes sense. The message size often needs to account for the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I'm not totally sure myself. I relied on this and RFC2812 in coming up with that number. IRC seems to have a limit of 512, but hexchat could certainly further reduce this.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The RFC is referring to the entire line. But generally at the layer of users like this message just means the content. So an IRC line is 512 bytes but with protocol overhead user messages can only realistically use 400-500 depending on the users full host.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I can confirm. I just tried sending a line of 561 chars (including spaces) on Libera.chat, and hexchat split it off at 446 chars.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you open |
||
|
|
||
| /* otr protocol id */ | ||
| #define PROTOCOLID "IRC" | ||
|
|
@@ -151,12 +152,12 @@ struct co_info | |
| { | ||
| char *msgqueue; /* holds partially reconstructed base64 | ||
| messages */ | ||
| IRC_CTX *ircctx; /* irssi server object for this peer */ | ||
| IRC_CTX *ircctx; /* IRC server object for this peer */ | ||
| int received_smp_init; /* received SMP init msg */ | ||
| int smp_failed; /* last SMP failed */ | ||
| char better_msg_two[256]; /* what the second line of the "better" | ||
| default query msg should like. Eat it | ||
| up when it comes in */ | ||
| default query msg should like. Eat | ||
| it up when it comes in */ | ||
| int finished; /* true after you've /otr finished */ | ||
| }; | ||
|
|
||
|
|
@@ -190,7 +191,6 @@ struct ctxlist_ | |
| }; | ||
|
|
||
| /* policy list generated from /set otr_policy */ | ||
|
|
||
| struct plistentry | ||
| { | ||
| GPatternSpec *namepat; | ||
|
|
@@ -205,21 +205,18 @@ IRC_CTX *server_find_address (char *address); | |
| void otr_status_change (IRC_CTX *ircctx, const char *nick, int event); | ||
|
|
||
| /* init stuff */ | ||
|
|
||
| int otrlib_init (void); | ||
| void otrlib_deinit (void); | ||
| void otr_initops (void); | ||
| void otr_setpolicies (const char *policies, int known); | ||
|
|
||
| /* basic send/receive/status stuff */ | ||
|
|
||
| char *otr_send (IRC_CTX *server, const char *msg, const char *to); | ||
| char *otr_receive (IRC_CTX *server, const char *msg, const char *from); | ||
| int otr_getstatus(IRC_CTX *ircctx, const char *nick); | ||
| ConnContext *otr_getcontext (const char *accname, const char *nick, int create, void *data); | ||
|
|
||
| /* user interaction */ | ||
|
|
||
| void otr_trust (IRC_CTX *server, char *nick, const char *peername); | ||
| void otr_finish (IRC_CTX *server, char *nick, const char *peername, int inquery); | ||
| void otr_auth (IRC_CTX *server, char *nick, const char *peername, const char *question, const char *secret); | ||
|
|
@@ -229,7 +226,6 @@ struct ctxlist_ *otr_contexts (void); | |
| void otr_finishall (void); | ||
|
|
||
| /* key/fingerprint stuff */ | ||
|
|
||
| void keygen_run (const char *accname); | ||
| void keygen_abort (int ignoreidle); | ||
| void key_load (void); | ||
|
|
@@ -239,3 +235,5 @@ void otr_writefps (void); | |
| /* instance tags */ | ||
| void instag_load (void); | ||
| void otr_writeinstags (void); | ||
|
|
||
| #endif //EOF | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| /* | ||
| * Off-the-Record Messaging (OTR) module for the irssi IRC client | ||
| * Off-the-Record Messaging (OTR) module for IRC clients | ||
| * *************************************************** | ||
| * Copyright (C) 2008 Uli Meis <[email protected]> | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| /* | ||
| * Off-the-Record Messaging (OTR) module for the irssi IRC client | ||
| * Off-the-Record Messaging (OTR) module for IRC clients | ||
| * *************************************************** | ||
| * Copyright (C) 2008 Uli Meis <[email protected]> | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify | ||
|
|
@@ -143,15 +144,12 @@ static void ops_secure (void *opdata, ConnContext *context) | |
| * Let's print out the fingerprints for comparison */ | ||
|
|
||
| otrl_privkey_hash_to_human (peerfp, | ||
| context->active_fingerprint->fingerprint); | ||
| context->active_fingerprint->fingerprint); | ||
|
|
||
| otr_notice (coi->ircctx, context->username, TXT_OPS_FPCOMP, | ||
| otrl_privkey_fingerprint (otr_state, | ||
| ownfp, | ||
| context->accountname, | ||
| PROTOCOLID), | ||
| context->username, | ||
| peerfp); | ||
| otrl_privkey_fingerprint (otr_state, ownfp, | ||
| context->accountname, PROTOCOLID), | ||
| context->username, peerfp); | ||
| } | ||
|
|
||
| /* | ||
|
|
@@ -174,7 +172,7 @@ static void ops_still_secure (void *opdata, ConnContext *context, int is_reply) | |
| context->username, is_reply ? TXT_OPS_STILL_REPLY : TXT_OPS_STILL_NO_REPLY); | ||
| } | ||
|
|
||
| /* | ||
| /* | ||
| * Really critical with IRC. | ||
| * Unfortunately, we can't tell our peer which size to use. | ||
| * (reminds me of MTU determination...) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| /* | ||
| * Off-the-Record Messaging (OTR) module for the irssi IRC client | ||
| * Off-the-Record Messaging (OTR) module for IRC clients | ||
| * *************************************************** | ||
| * Copyright (C) 2008 Uli Meis <[email protected]> | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Odd whitespace changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably it just wasn't lining up right on my editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect @TingPing would prefer white space changes to be in a separate pull request, and not mixed with functional changes.