modernize: Reformat ALL the source... again!
It's been more than six years since we last used an autoformatter
on the codebase. Tooling has progressed, so has the language and
of course our personal preferences.
Use clang-format this time to reformat the whole codebase, following
the rules laid out in .clang-format (which one can use for configuring
an IDE, too, if it supports autoformatting). Overall, the new style
is not too different from what we used before, with one significant
change:
We now attach pointer/reference indicators (*&) to the type rather
than the name, i.e. we left-align. While this is a major deviation
from the Qt style which we use for almost everything else, it aligns
more closely with many other projects, as well as the C++
documentation and STL. It also makes more sense semantically,
because */& are really part of the type.
Other changes include (but are not limited to):
- Use only one blank line between function definitions
- Categorize includes from generic/system to local, sorting each
category alphabetically. The generic-to-local sort order seems to
be more common than the other way round, so we use that.
- In .cpp files, the corresponding header is always included first.
This is a general recommendation, because it makes it harder to
accidentally introduce a reliance on transitive includes in headers.
- Consistently break initializers in ctors before the comma, so the
commas are left-aligned together with the colon.
- Use two spaces between code and trailing comments.
Note that sometimes even clang-format gets things wrong. In a few
places, formatting was manually fixed; however, reviewing a diff of
almost 80k lines is a rather boring task, so we didn't thoroughly
go through all the changes. Wrong formatting can always be fixed
in follow-up commits, anyway.
Note also that we don't intend to re-run clang-format on a regular
basis, nor do we want to religiously follow a hardcoded set of rules
for new code in the future. Where it makes sense, the rules may be
bent in favor of better readability or more pleasing code.

modernize: Use auto where the type is clear from context2018-09-09T20:44:18ZManuel Nickschassputnick@quassel-irc.orgManuel Nickschassputnick@quassel-irc.org2018-09-09T20:44:18Zhttps://git.quassel-irc.org/?p=quassel.git;a=commitdiff;h=e2188dc438be6f3eb0d9cdf47d28821aefe9835e

modernize: Use auto where the type is clear from context
Apply clang-tidy's modernize-use-auto fix, which uses auto where
the type would otherwise be duplicated in the line (e.g. when casting
a type, or creating an instance with 'new').

Finish 64-bit time conversion, modify protocol
Convert the remaining uses of 32-bit quint-based
"[to|from|set]Time_t()" to the modern 64-bit qint64-based
"[to|from|set]MSecsSinceEpoch()", handling the Y2038 problem while
also gaining higher precision in some places.
For places where seconds are needed, e.g. converting incoming time
from the IRC protocol, make use of "[to|set|from]SecsSinceEpoch()"
instead. As this was only added in Qt 5.8, use the "QT_VERSION"
macro for backwards compatibility, manually dividing by 1000 for the
"MSecs" function equivalents.
Beware, all new code should use "[to|from|set]MSecsSinceEpoch()" and
NOT use "[to|from|set]Time_t()", or you'll re-introduce Y2038 bugs!
Modify protocol to rename "LongMessageTime" to "LongTime", and
send/receive all times as "qint64" instead of "quint64" or "quint".
"LongMessageTime" was never in Quassel git master, so renaming it
should have no impact.
Modify Event timing to be 64-bit compatible, too.
"IrcUser::lastAwayMessage()" will be fixed in a follow-up commit.
SQLite millisecond precision will be fixed in a follow-up commit.
See https://doc.qt.io/qt-5/qdatetime.html
And https://doc.qt.io/qt-5/datastreamformat.html
And https://doc.qt.io/qt-5/qdatetime-obsolete.html

Fix ALL the license headers!
Many of our license headers had the wrong date, some of them inconsistent formatting,
all of them the wrong address for the FSF (which apparently moved since 2005), and
also neither the GNU Blank Public License nor the GNU Highlight Public License actually
exist.

Reformat ALL the source!2012-05-25T14:05:34ZManuel Nickschassputnick@quassel-irc.orgManuel Nickschassputnick@quassel-irc.org2012-05-25T14:05:34Zhttps://git.quassel-irc.org/?p=quassel.git;a=commitdiff;h=694f9bfbf7f1af19108461c7e00d133e55082bce

Reformat ALL the source!
Yes, yes. After stubborningly refusing to switch to a more readable coding style for
years, I finally give in. Our old, quite compact, 2-indent style was born from my time
with homecomputers, where every whitespace was a waste. Later (and mostly thanks to EgS),
I did see the light, e.g. changed from one-letter variable names to useful ones, but
still shied away from reformatting the whole source, touching every line, destroying the
historical context as shown by svn and git blame.
However, since I'm now doing Qt-related programming as my day job, and use a proper
(Qt-like) coding style there, it has become increasingly annoying for myself to switch to
another style in those long hacking nights working on Quassel, and so I decided to
Just Do It™. Helps that Git nowadays can ignore whitespace changes when blaming, or
diffing, or patching, so this shouldn't be too much of an annoyance for existing patches.
Feedback from the community was also positive...
So now we use a style that should be pretty close to the Qt Coding Style [1], which not
only covers the indentation, but also things like newline-after-function-head.
Reformatting was done automagically using uncrustify [2], a script and config file is in
scripts/manage/. Please don't run it over the whole codebase again, as there are some
false positives and weird formattings that will have to be manually fixed over time.
You can use it for reformatting existing patches or MRs, though.
[1] http://qt-project.org/wiki/Qt_Coding_Style
[2] http://uncrustify.sourceforge.net/

Provide (de)serialization for all event types
This allows to (de)serialize events to/from QVariantMap (using only primitive
types), a prerequisite for sending events over the wire.
Use the following functions:
void EventManager::createEvent(const QVariantMap &)
QVariantMap Event::toVariantMap()
Note that there is only rudimentary plausibility checking, so for now we assume
that the QVariantMaps are created by Quassel. Before we allow these to go on the wire,
we need to make sure that this can't be tinkered with in annoying ways.

Introducing the first shiny stuff for our new event-based core backend2010-09-05T18:15:45ZManuel Nickschassputnick@quassel-irc.orgManuel Nickschassputnick@quassel-irc.org2010-09-05T18:15:45Zhttps://git.quassel-irc.org/?p=quassel.git;a=commitdiff;h=d3c9d89989df59c073fc33637ba4e8bbdb6ab397

Introducing the first shiny stuff for our new event-based core backend
This adds a (very rudimentary) base class for events, and a (very rudimentary)
EventManager. The manager so far allows registering event handlers (even via explicit
methods, or by providing a QObject. In the latter case, matching slots will be automatically
registered (i.e. a method handleIrcEventJoin() will be registered as handler for
IrcEventJoin).