about summary refs log tree commit diff stats
path: root/src/ui/chatwin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/chatwin.c')
-rw-r--r--src/ui/chatwin.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c
index 1c04432c..22992ecd 100644
--- a/src/ui/chatwin.c
+++ b/src/ui/chatwin.c
@@ -57,7 +57,7 @@
 #include "omemo/omemo.h"
 #endif
 
-/*static void _chatwin_history(ProfChatWin *chatwin, const char *const contact_barejid);*/
+static void _chatwin_history(ProfChatWin *chatwin, const char *const contact_barejid);
 static void _chatwin_set_last_message(ProfChatWin *chatwin, const char *const id, const char *const message);
 
 ProfChatWin*
@@ -66,8 +66,8 @@ chatwin_new(const char *const barejid)
     ProfWin *window = wins_new_chat(barejid);
     ProfChatWin *chatwin = (ProfChatWin *)window;
 
-    if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
-        //_chatwin_history(chatwin, barejid);
+    if (!prefs_get_boolean(PREF_MAM) && prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
+        _chatwin_history(chatwin, barejid);
     }
 
     // if the contact is offline, show a message
@@ -87,7 +87,9 @@ chatwin_new(const char *const barejid)
     }
 #endif
 
-    iq_mam_request(chatwin);
+    if (prefs_get_boolean(PREF_MAM)) {
+        iq_mam_request(chatwin);
+    }
     return chatwin;
 }
 
@@ -285,8 +287,13 @@ chatwin_incoming_msg(ProfChatWin *chatwin, ProfMessage *message, gboolean win_cr
 
         chatwin->unread++;
 
-        if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
-//            _chatwin_history(chatwin, chatwin->barejid);
+        //TODO: so far we don't ask for MAM when incoming message occurs.
+        //Need to figure out:
+        //1) only send IQ once
+        //2) sort incoming messages on timestamp
+        //for now if experimental MAM is enabled we dont show no history from sql either
+        if (!prefs_get_boolean(PREF_MAM) && prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
+            _chatwin_history(chatwin, chatwin->barejid);
         }
 
         // show users status first, when receiving message via delayed delivery
@@ -485,7 +492,6 @@ chatwin_unset_outgoing_char(ProfChatWin *chatwin)
     }
 }
 
-/*
 static void
 _chatwin_history(ProfChatWin *chatwin, const char *const contact_barejid)
 {
@@ -503,7 +509,6 @@ _chatwin_history(ProfChatWin *chatwin, const char *const contact_barejid)
         g_slist_free_full(history, (GDestroyNotify)message_free);
     }
 }
-*/
 
 static void
 _chatwin_set_last_message(ProfChatWin *chatwin, const char *const id, const char *const message)
Booth <boothj5@gmail.com> 2014-12-25 00:46:15 +0000 Added server_event tests' href='/danisanti/profani-tty/commit/tests/test_server_events.c?id=7a104431645af3a37b3626748a0290dda3d0cee4'>7a104431 ^
0e2fbeb3 ^
a7a28506 ^
0e2fbeb3 ^
a7a28506 ^




a7a28506 ^


ae08e820 ^
a7a28506 ^

7a104431 ^


0e2fbeb3 ^
a7a28506 ^
0e2fbeb3 ^
a7a28506 ^




a7a28506 ^


ae08e820 ^
0e2fbeb3 ^
a7a28506 ^






a7a28506 ^


ae08e820 ^
0e2fbeb3 ^
a7a28506 ^






a7a28506 ^


ae08e820 ^
a7a28506 ^

7a104431 ^


0e2fbeb3 ^
a7a28506 ^
0e2fbeb3 ^
a7a28506 ^

5afb296e ^
0338d136 ^
5afb296e ^

0338d136 ^

571665ee ^
7a104431 ^
5afb296e ^
0338d136 ^
5afb296e ^
571665ee ^
0338d136 ^
571665ee ^


0338d136 ^

571665ee ^


0338d136 ^
571665ee ^

0338d136 ^
571665ee ^

9bd2315d ^
42a5c431 ^
0338d136 ^

571665ee ^

51bd4ed3 ^
571665ee ^
9bd2315d ^

571665ee ^
9bd2315d ^
571665ee ^


0338d136 ^





7a104431 ^

0338d136 ^









7a104431 ^
0338d136 ^



2c15aba9 ^
571665ee ^


0338d136 ^
571665ee ^
7a104431 ^

571665ee ^
0338d136 ^
571665ee ^
95ad5643 ^









51bd4ed3 ^
95ad5643 ^
9bd2315d ^
95ad5643 ^
9bd2315d ^
95ad5643 ^



f180925c ^



51bd4ed3 ^

f180925c ^








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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212