Skip to content

Commit

Permalink
added psi-disable-messages-correct-behavior patch
Browse files Browse the repository at this point in the history
  • Loading branch information
liuch committed Feb 17, 2014
1 parent 542af7b commit d97fa2b
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 7 deletions.
139 changes: 139 additions & 0 deletions 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<EventDlg*>(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<AuthEvent*>(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 &);

8 changes: 3 additions & 5 deletions patches/2090-psi-muc-highlight-events.diff
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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();
+ }
Expand Down
4 changes: 2 additions & 2 deletions patches/8000-psi-extend-plugins-interface.diff
Expand Up @@ -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;
Expand Down

1 comment on commit d97fa2b

@liuch
Copy link
Member Author

@liuch liuch commented on d97fa2b Feb 17, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Патч меняет поведение опции options.message.enabled
В результате при включенной опции входящие сообщения и другие события отображаются в диалоге, события не "зависают". Исходящие сообщения запрещены и отключены в меню.
Заодно исправлен баг 560.

Please sign in to comment.