From d97fa2b967bff2943e81f66fe1c97bdf25a34634 Mon Sep 17 00:00:00 2001 From: liuch Date: Mon, 17 Feb 2014 20:27:49 +0400 Subject: [PATCH] added psi-disable-messages-correct-behavior patch --- ...psi-disable-messages-correct-behavior.diff | 139 ++++++++++++++++++ patches/2090-psi-muc-highlight-events.diff | 8 +- .../8000-psi-extend-plugins-interface.diff | 4 +- 3 files changed, 144 insertions(+), 7 deletions(-) create mode 100644 patches/0001-psi-disable-messages-correct-behavior.diff diff --git a/patches/0001-psi-disable-messages-correct-behavior.diff b/patches/0001-psi-disable-messages-correct-behavior.diff new file mode 100644 index 0000000..538201d --- /dev/null +++ b/patches/0001-psi-disable-messages-correct-behavior.diff @@ -0,0 +1,139 @@ +--- psi.orig/src/psiaccount.cpp ++++ psi/src/psiaccount.cpp +@@ -2648,10 +2648,7 @@ void PsiAccount::processIncomingMessage( + } + + // change the type? +- if (!EventDlg::messagingEnabled()) { +- m.setType("chat"); +- } +- else if (m.type() != "headline" && m.invite().isEmpty() && m.mucInvites().isEmpty()) { ++ if (m.type() != "headline" && m.invite().isEmpty() && m.mucInvites().isEmpty()) { + const QString type = PsiOptions::instance()->getOption("options.messages.force-incoming-message-type").toString(); + if (type == "message") + m.setType(""); +@@ -3543,7 +3540,7 @@ void PsiAccount::cpUpdate(const UserList + EventDlg *PsiAccount::ensureEventDlg(const Jid &j) + { + EventDlg *w = findDialog(j); +- if (!w && EventDlg::messagingEnabled()) ++ if (!w) + w = new EventDlg(j, this, true); + + if (w) { +@@ -3793,7 +3790,7 @@ void PsiAccount::actionRecvRosterExchang + + void PsiAccount::actionSendMessage(const Jid &j) + { +- EventDlg *w = d->psi->createEventDlg(j.full(), this); ++ EventDlg *w = d->psi->createMessageDlg(j.full(), this); + if (!w) + return; + w->show(); +@@ -3811,7 +3808,7 @@ void PsiAccount::actionSendMessage(const + str += (*it).full(); + } + +- EventDlg *w = d->psi->createEventDlg(str, this); ++ EventDlg *w = d->psi->createMessageDlg(str, this); + if (!w) + return; + w->show(); +@@ -3819,7 +3816,7 @@ void PsiAccount::actionSendMessage(const + + void PsiAccount::actionSendUrl(const Jid &j) + { +- EventDlg *w = d->psi->createEventDlg(j.full(), this); ++ EventDlg *w = d->psi->createMessageDlg(j.full(), this); + if (!w) + return; + w->setUrlOnShow(); +@@ -4321,7 +4318,7 @@ void PsiAccount::dj_sendMessage(const Me + + void PsiAccount::dj_newMessage(const Jid &jid, const QString &body, const QString &subject, const QString &thread) + { +- EventDlg *w = d->psi->createEventDlg(jid.full(), this); ++ EventDlg *w = d->psi->createMessageDlg(jid.full(), this); + if (!w) + return; + +@@ -5002,8 +4999,6 @@ void PsiAccount::queueEvent(PsiEvent* e, + else if (e->type() == PsiEvent::File) { + doPopup = PsiOptions::instance()->getOption("options.ui.file-transfer.auto-popup").toBool(); + } +- else if (e->type() == PsiEvent::Auth && !EventDlg::messagingEnabled()) +- doPopup = false; + else { + doPopup = PsiOptions::instance()->getOption("options.ui.message.auto-popup").toBool(); + } +--- psi.orig/src/psicon.cpp ++++ psi/src/psicon.cpp +@@ -886,20 +886,25 @@ void PsiCon::doNewBlankMessage() + if(!account) + return; + +- EventDlg *w = createEventDlg("", account); ++ EventDlg *w = createMessageDlg("", account); + if (!w) + return; + + w->show(); + } + +-// FIXME: smells fishy. Refactor! Probably create a common class for all dialogs and +-// call optionsUpdate() automatically. +-EventDlg *PsiCon::createEventDlg(const QString &to, PsiAccount *pa) ++EventDlg *PsiCon::createMessageDlg(const QString &to, PsiAccount *pa) + { + if (!EventDlg::messagingEnabled()) + return 0; + ++ return createEventDlg(to, pa); ++} ++ ++// FIXME: smells fishy. Refactor! Probably create a common class for all dialogs and ++// call optionsUpdate() automatically. ++EventDlg *PsiCon::createEventDlg(const QString &to, PsiAccount *pa) ++{ + EventDlg *w = new EventDlg(to, this, pa); + connect(this, SIGNAL(emitOptionsUpdate()), w, SLOT(optionsUpdate())); + return w; +@@ -1609,27+1614,12 @@ void PsiCon::processEvent(PsiEvent *e, A + const Message &m = me->message(); + bool emptyForm = m.getForm().fields().empty(); + // FIXME: Refactor this, PsiAccount and PsiEvent out +- if ((m.type() == "chat" && emptyForm) +- || !EventDlg::messagingEnabled()) { ++ if (m.type() == "chat" && emptyForm) { + isChat = true; + sentToChatWindow = me->sentToChatWindow(); + } + } + +- if (e->type() == PsiEvent::Auth && !EventDlg::messagingEnabled()) { +- if (static_cast(e)->authType() == "subscribe") { +-#ifdef YAPSI +- bringToFront(d->mainwin); +- return; +-#else +- e->account()->dj_addAuth(e->jid()); +-#endif +- } +- e->account()->eventQueue()->dequeue(e); +- delete e; +- return; +- } +- + if ( isChat ) { + PsiAccount* account = e->account(); + XMPP::Jid from = e->from(); +--- psi.orig/src/psicon.h ++++ psi/src/psicon.h +@@ -111,6 +111,7 @@ public: + const QStringList & recentNodeList() const; + void recentNodeAdd(const QString &); + ++ EventDlg *createMessageDlg(const QString &, PsiAccount*); + EventDlg *createEventDlg(const QString &, PsiAccount*); + void updateContactGlobal(PsiAccount *, const Jid &); + diff --git a/patches/2090-psi-muc-highlight-events.diff b/patches/2090-psi-muc-highlight-events.diff index 339e95f..ed91c1b 100644 --- a/patches/2090-psi-muc-highlight-events.diff +++ b/patches/2090-psi-muc-highlight-events.diff @@ -282,7 +282,7 @@ #include "spellchecker/aspellchecker.h" #ifdef WEBKIT #include "avatars.h" -@@ -1746,17 +1749,29 @@ void PsiCon::processEvent(PsiEvent *e, A +@@ -1746,16 +1749,28 @@ void PsiCon::processEvent(PsiEvent *e, A } bool isChat = false; @@ -295,8 +295,7 @@ const Message &m = me->message(); - bool emptyForm = m.getForm().fields().empty(); - // FIXME: Refactor this, PsiAccount and PsiEvent out -- if ((m.type() == "chat" && emptyForm) -- || !EventDlg::messagingEnabled()) { +- if (m.type() == "chat" && emptyForm) { - isChat = true; - sentToChatWindow = me->sentToChatWindow(); +#ifdef GROUPCHAT @@ -307,8 +306,7 @@ +#endif + bool emptyForm = m.getForm().fields().empty(); + // FIXME: Refactor this, PsiAccount and PsiEvent out -+ if ((m.type() == "chat" && emptyForm) -+ || !EventDlg::messagingEnabled()) { ++ if (m.type() == "chat" && emptyForm) { + isChat = true; + sentToChatWindow = me->sentToChatWindow(); + } diff --git a/patches/8000-psi-extend-plugins-interface.diff b/patches/8000-psi-extend-plugins-interface.diff index da1a800..2f2dbe2 100644 --- a/patches/8000-psi-extend-plugins-interface.diff +++ b/patches/8000-psi-extend-plugins-interface.diff @@ -4150,9 +4150,9 @@ index 2fbe092..07b2e63 100644 emit startBounce(); } @@ -5440,6 +5495,10 @@ void PsiAccount::queueEvent(PsiEvent* e, ActivationType activationType) + else if (e->type() == PsiEvent::File) { + doPopup = PsiOptions::instance()->getOption("options.ui.file-transfer.auto-popup").toBool(); } - else if (e->type() == PsiEvent::Auth && !EventDlg::messagingEnabled()) - doPopup = false; +#ifdef PSI_PLUGINS + else if (e->type() == PsiEvent::Plugin) + doPopup = false;