src: Yearly copyright bump This time on time!
src: Yearly copyright bump Let's welcome 2020.
core: Replace QList by std::vector in the storage API QList is inefficient and deprecated; also Qt containers have issues with ranged-for and STL algorithms. Use std::vector instead in the storage API and fix affected code. Modernize some affected bits by replacing weird loops with STL algorithms.
Remove debug console and QtScript, which was deprecated with Qt5 - reduces dependencies, allows building quasselcore on most distros without pulling in X11 - removes unused code and dependencies, reduces size
Implement a metrics daemon to expose Prometheus metrics - logs IRC and client sessions, IRC traffic in/out, login attempts per user - logs certificate expiry time
Implement IRCv3 Server-Time
Cleanup allowing for tags to be available at later points, adds TAGMSG
Minor cleanup of messages handling
src: Yearly copyright bump ... and it's still January!
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: Replace most remaining old-style connects by PMF ones Manually replace old-style connects (using the SIGNAL/SLOT macros) by the much more efficient and typesafe pointer-to-member-function- based ones. This fixes the cases where clazy could not auto-migrate to the new syntax for a variety of reasons. In most of the cases, we need to remove overloads or explicitly select the desired one, because the plain syntax cannot deal with overloads. Another issue is trying to connect to signals in a baseclass that are only declared in a derived class (which works with the old-style runtime connection handling, but obviously no longer with the compile-time version). Also do some selected cleanups in places.
modernize: Pass arguments by value and move in constructors If a method (or constructor) wants to store an argument in a local variable or attribute, one should prefer passing it in by value and moving it into the final location, rather than taking a const reference and copying it over. In the best case, this saves one copy, if the method is called with an rvalue. This pattern is most frequent in constructors initializing class members, so let clang-tidy fix this for argument types that have move constructors.
modernize: Use override instead of virtual Let clang-tidy fix all occurrences where override should be used instead of virtual. Also, let it annotate member functions where virtual was missing in the first place.
modernize: Use nullptr Let clang-tidy fix all occurrences where nullptr should be used instead of 0.
core: Fix quitting from networks on shutdown The previous implementation relied on processEvents() to let the QUIT command be sent to the IRC server. However, processEvents() does not guarantee that it processes all events (also in other threads), and indeed, the previous approach was not reliable. Fix this by waiting for the networks to emit the disconnected() signal after requesting the quit. There already is a 10 second timeout in case the IRC server does not close the socket within a reasonable time, so rely on that. Also ensure that connect requests are ignored during shutdown. With the CoreSession requesting a clean shutdown, we no longer need a similar handling in CoreNetwork's dtor, so remove this. See also GH-203 and GH-207, which were previous attempts on getting this right.
core: Allow clean shutdown of the core Relying on things to happen while the core is being destroyed is fragile (and does not work in practice), because events are no longer delivered to objects that are scheduled for deletion. Add an explicit call for shutting down the core, its sessions and their networks. Wait for everything to be cleaned up properly before quitting the session threads, and ultimately shutting down the main event loop. While we're at it, refactor SessionThread to follow the worker pattern, rather than inheriting from QThread. This avoids accidentally calling slots in the wrong thread. Ensure that all cross-thread communication happens through queued signals. Simplify the API, too.
Rename strict-ident, apply to non-identd response Rename "--oidentd-strict" to "--strict-ident", better representing what it now does - makes all ident replies strict. Apply strict ident matching to normal (non-identd-enabled) ident, too. This allows strict ident to be enforced on IRC networks that do not check identd responses. (Yes, some IRC networks behave this way, expecting your shared user bouncer to enforce ident. ZNC allows this, so Quassel probably should too. No need to run an ident server for those networks.) Clean up functions, making them a little more generic. This also sets the stage for exposing the strict ident mode to the client later on.
Automatically synchronize CoreInfo when on connect and disconnect This refactors CoreInfo to be a single common class rather than separate classes for the core and client, adjusts it to properly use the SyncableObject infrastructure, and adds support for dynamically updating the list on both the client and core when a client connects or disconnects, keeping the list up-to-date at all times. Forwards and backwards compatibility is maintained, though the updated client is required in order for the automatic updating to work. Signed-off-by: Janne Koschinski <janne@kuschku.de> Co-authored-by: Janne Koschinski <janne@kuschku.de> Co-authored-by: Michael Marley <michael@michaelmarley.com>
Implement sender realname/avatarurl storage - Store sender realname and avatarurl in database - Guard protocol changes behind feature flag 'RichMessages' - Avatar URLs are not actually stored yet, as we do not implement METADATA yet. This is not yet used in Quassel itself, but third-party clients including QuasselDroid use this to provide more context in messages and allow for realname-based fallback avatar fetching to work in the chat message backlog. Incorporates suggestions from @mamarley. Closes GH-351.
Persist Blowfish keys in the database Add a new text field called "cipher" and store the hex-encoded cipher key there whenever a new key is set or exchanged. Also, when each network is initialized, load the ciphers out of the database and initialize the in-memory hashmap. Then, the existing behavior of each CoreIrcNetwork automatically using these keys upon construction occurs. Additionally, this makes PM buffer ciphers persistent both across destruction/construction and across core restarts. Note that the existing "key" field in the database is confusingly named. It does not contain any sort of cryptographic key but instead holds channel passwords. Closes #1473 Closes GH-332.