-
Notifications
You must be signed in to change notification settings - Fork 19
/
0001-psi-disable-messages-correct-behavior.diff
139 lines (125 loc) · 4.32 KB
/
0001-psi-disable-messages-correct-behavior.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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 &);