src: Yearly copyright bump This time on time!
[Followup PR-495] Fixes backwards compatibility issues - Moves functionality to an internal function - Restores original sync slots
src: Yearly copyright bump Let's welcome 2020.
Fix protocol spam on part/quit/disconnect
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: Use '= default' instead of empty ctor/dtor bodies Also remove lots of unnecessary, empty ctors and dtors.
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.
src: Mark symbols to be exported where needed Generate export headers for the Quassel modules, and mark all relevant classes and function to be exported so that shared libraries can be linked against without globally exporting all symbols. This is a hard requirement for Windows DLLs, and more efficient on other platforms, too. For now, this was done incrementally until everything linked properly. In the future, we may consider explicitly defining the public interfaces for each module, and trying to minimize the linker interface e.g. by PIMPLing.
common: Simplify SyncableObject macros and usage Since the C++11 standard defines "__func__", and modern versions of MSVC support this, we can remove the workaround for MSVC from the SyncableObject macros. It is no longer necessary to derive the function name from MSVC's __FUNCTION__ (which contains the enclosing class name), and thus the _classNameOffset__ function declared by the SYNCABLE_OBJECT macro is no longer needed. Repurpose the macro to define the syncMetaObject() member function instead, and remove the no-longer needed INIT_SYNCABLE_OBJECT macro. The syncMetaObject() function is used by the signal proxy for accessing the metaObject() of the base class in case there are client- or core-specific specializations of a syncable object; i.e. if you have Foo directly inheriting from SyncableObject, and ClientFoo derived from Foo, the function must only be declared in Foo, otherwise syncing won't work. Thus, the SYNCABLE_OBJECT macro declares the function as final, so it can't be accidentally overridden. While we're at it, replace include guards with #pragma once in files we touched.
ircuser: Fix setting of away message time by pre-0.13 cores IrcUser::setLastAwayMessage() is called by pre-0.13 cores (newer cores call setLastAwayMessageTime() instead). Fix wrong use of QDateTime::from[M]SecsSinceEpoch(), which is a static method returning a new QDateTime instance rather than a modifying setter. Also fix signatures passing primitive types as const refs.
core: Limit "User is away" to 1hr or when changed Increase the "* User is away" silencing to one hour, and add tracking for changes in away state. Only print the "* User is away" if away state has changed since last away message (including removing and applying the same away message), or if 1 hour has elapsed. This reduces the spamming of "* User is away" when one often knows that, yes, the user is away. Any change in away state or message will still be shown.
common: Remove the lastAwayMessage Q_PROPERTY declaration Since this property is only synced by pre-0.13 cores, and not used by any released clients, it doesn't need to be marked as a Q_PROPERTY. Also avoids a warning for the property not having a getter.
IrcUser: Rename lastAwayMessage to lastAwayMessageTime This will make it easier for clients to implement both at the same time. Also, add a backwards-compatibility function to allow old cores to set the lastAwayMessageTime. There is still no forwards- compatibility (support for old clients on new cores) since no existing clients do anything with lastAwayMessage.
IrcUser: Use QDateTime for lastAwayMessage, not int This converts the lastAwayTime to a 64-bit time. Backwards- compatibility is also included in Network to convert back and forth between the old 32-bit type for legacy peers. No backwards- compatibility is provided for the SYNC call because the value is never actually used in any existing clients. New clients that want to implement this functionality would need to implement the LongTime feature.
Semi-yearly copyright bump It's no longer 2016.
Sync IrcUser account, add WHOX for account-notify Add 'account' field to IrcUser, tracking logged-in account, e.g. NickServ/SASL. In testing, this works fine with older/newer cores/servers. Implement support for WHOX as in IRCv3 specifications, determining logged-in accounts on first join to channels. Mimics HexChat's ordering of fields, reusing any testing they've done. Display WHOX replies as [WhoX]. As fields are user-specified, more processing would be difficult to manage. WHO replies are unchanged. Unify WHO reply processing in a common function. Preliminary test results on Ubuntu: > New core, new client - works fine > New core, old client - client prints warnings to console but works (Complains of no matching slot for sync call. Old client doesn't use the new information, though.) > New client, old core - works fine, assumes unknown account state > New core, Quasseldroid alpha - works fine, warnings in debug log See http://faerion.sourceforge.net/doc/irc/whox.var And https://github.com/hexchat/hexchat/blob/c874a9525c9b66f1d5ddcf6c4107d046eba7e2c5/src/common/proto-irc.c#L750
Bring copyright headers into 2016 That took some time...
Performance tweak: rem. pointless recursive calls For some reason there was an extra call to IrcChannel::joinIrcUser from IrcUser::joinIrcChannel. That means that in past we did: * Call to IrcChannel::joinIrcUsers(...) * From there we call IrcUser::joinIrcChannel(this) * And from there we called IrcChannel::joinIrcUser(this) * Which again called IrcChannel::joinIrcUsers(list that contained only this 1 user) * Which figured out this user is already in this channel and exits That is a pointless overhead, so now we call the second function with extra parameter that tells it not to call joinIrcUser because we know this user doesn't need to be added there, thus saves few thousands of pointless function calls and user list contructions, especially while joining large channels.
Happy New Year!