+
+ if (!net->isChannelName(target)) {
+ // For self-messages, keep the target, don't set it to the sender prefix
+ if (!isSelfMessage) {
+ target = nickFromMask(prefix);
+ }
+
+ if (!updatedFromPrefix) {
+ // Don't repeat this within the loop, the prefix doesn't change
+ updatedFromPrefix = true;
+
+ // Fetch/create the relevant IrcUser, and store it for later updates
+ IrcUser* ircuser = net->updateNickFromMask(prefix);
+
+ // Handle account-tag
+ if (ircuser && net->capEnabled(IrcCap::ACCOUNT_TAG)) {
+ if (tags.contains(IrcTags::ACCOUNT)) {
+ // Account tag available, set account.
+ // This duplicates the generic account-tag handling in case a
+ // new IrcUser object was just created.
+ ircuser->setAccount(tags[IrcTags::ACCOUNT]);
+ }
+ else {
+ // NOTICE is user sent; it's safe to assume the user has
+ // logged out. "*" is used to represent logged-out.
+ ircuser->setAccount("*");
+ }
+ }
+ }
+ }
+ }
+
+#ifdef HAVE_QCA2
+ // Handle DH1080 key exchange
+ // Don't allow key exchange in channels, and don't allow it for self-messages.
+ bool keyExchangeAllowed = (!net->isChannelName(target) && !isSelfMessage);
+ if (params[1].startsWith("DH1080_INIT") && keyExchangeAllowed) {
+ events << new KeyEvent(EventManager::KeyEvent, net, tags, prefix, target, KeyEvent::Init, params[1].mid(12));
+ }
+ else if (params[1].startsWith("DH1080_FINISH") && keyExchangeAllowed) {
+ events << new KeyEvent(EventManager::KeyEvent, net, tags, prefix, target, KeyEvent::Finish, params[1].mid(14));
+ }
+ else
+#endif
+ {
+ IrcEventRawMessage* rawMessage = new IrcEventRawMessage(EventManager::IrcEventRawNotice,
+ net,
+ tags,
+ params[1],
+ prefix,
+ target,
+ e->timestamp());
+ if (isSelfMessage) {
+ // Self-messages need processed differently, tag as such via flag.
+ rawMessage->setFlag(EventManager::Self);
+ }
+ events << rawMessage;