Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
biboumi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
88
Issues
88
List
Boards
Labels
Service Desk
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
louiz’
biboumi
Commits
435a63a0
Commit
435a63a0
authored
Jan 10, 2018
by
Ailin Nemui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change max line length to more conservative constants
parent
70ecb0f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
src/irc/irc_client.cpp
src/irc/irc_client.cpp
+8
-4
No files found.
src/irc/irc_client.cpp
View file @
435a63a0
...
...
@@ -483,12 +483,16 @@ bool IrcClient::send_channel_message(const std::string& chan_name, const std::st
}
// The max size is 512, taking into account the whole message, not just
// the text we send.
// This includes our own nick,
username and host (because this will b
e
// a
dded by the server into our messag
e), in addition to the basic
// components of the message we send (command name, chan name, \r\n et)
// This includes our own nick,
constants for username and host (because thes
e
// a
re notoriously hard to know what the server will us
e), in addition to the basic
// components of the message we send (command name, chan name, \r\n et
c.
)
// : + NICK + ! + USER + @ + HOST + <space> + PRIVMSG + <space> + CHAN + <space> + : + \r\n
// 63 is the maximum hostname length defined by the protocol. 10 seems to be
// the username limit.
constexpr
auto
max_username_size
=
10
;
constexpr
auto
max_hostname_size
=
63
;
const
auto
line_size
=
512
-
this
->
current_nick
.
size
()
-
this
->
username
.
size
()
-
this
->
own_host
.
size
()
-
this
->
current_nick
.
size
()
-
max_username_size
-
max_hostname_size
-
::
strlen
(
":!@ PRIVMSG "
)
-
chan_name
.
length
()
-
::
strlen
(
" :
\r\n
"
);
const
auto
lines
=
cut
(
body
,
line_size
);
for
(
const
auto
&
line
:
lines
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment