about summary refs log tree commit diff stats
path: root/html/tmux-vim-sandbox.png
Commit message (Expand)AuthorAgeFilesLines
* 2187Kartik K. Agaram2015-09-121-0/+0
ni-tty/commit/src/config/account.c?id=b3be26a21406b549426f6c94c91e8b2a6bf32701'>b3be26a2 ^
21ab1821 ^















f9737251 ^











21ab1821 ^



bc9e6b79 ^
21ab1821 ^




b3d49f2a ^
bc9e6b79 ^
21ab1821 ^

13ae9252 ^



21ab1821 ^
13ae9252 ^


6640a089 ^
21ab1821 ^




47549452 ^
21ab1821 ^




47549452 ^
21ab1821 ^




47549452 ^
401835f3 ^




21ab1821 ^

47549452 ^
21ab1821 ^




47549452 ^
21ab1821 ^

















































47549452 ^
95ff1313 ^




9dda7036 ^



475dfebd ^





904a5a81 ^





6640a089 ^





21ab1821 ^


13ae9252 ^
21ab1821 ^

47549452 ^
21ab1821 ^





bc9e6b79 ^





































21ab1821 ^


47549452 ^
21ab1821 ^


a932998f ^
21ab1821 ^





95ff1313 ^
475dfebd ^
904a5a81 ^
6640a089 ^
9dda7036 ^


21ab1821 ^
21ab1821 ^
401835f3 ^
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240


            
                                                            















                                                                       











                                                                                



                   
                   




                           
                   
                

            



                                                                                                         
                                                         


                                                                                   
                      




                                                           
              




                                        
                   




                                                 
                        




                                                           

                                   
                 




                                             
                   

















































                                                                                  
                     




                                                     



                                                       





                                                   





                                                       





                                                     


                       
     

                                             
                            





                                                               





































                                                                                                   


                                  
                  


                                
                                     





                                      
                                  
                                 
                                   
                                  


                                                             
                      
     
 
0

Added tests for clearing chat sessions on lost connection' href='/danisanti/profani-tty/commit/tests/test_server_events.c?id=f180925c3b4c28d3839efe5526596506c781a9ec'>f180925c ^
51bd4ed3 ^

f180925c ^

8aba52f4 ^
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







                   
                                
                      
                             
                              

                               
                       
                     

                            
 

                                                                
                                                      
                   
                    
                                      

                                                    
                                                                             
 


                                                                           
 
                                                        
 
                     
                       



                                                             
                                                   
                   
                    
                                      

                                                    
                                                                             
 


                                                                           
 
                                                        
 
                     
                       



                                                          
                                                   
                   
                    
                                      

                                                    
                                                                             
 


                                                                           
 
                                                        
 
                     
                       
 
 

                                                      
                   
                    
                                      


                                             


                                                                            
                                                            


                                                             
                                                   
                                                     
 
                         
 
                     
                          
                       
 


                                                       
                    
                                      
                         

                                                                       

                                 
                            





                                                                 
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>

#include "event/server_events.h"
#include "xmpp/xmpp.h"
#include "xmpp/roster_list.h"
#include "xmpp/chat_session.h"
#include "config/preferences.h"
#include "ui/ui.h"
#include "ui/stub_ui.h"
#include "xmpp/muc.h"
#include "plugins/plugins.h"
#include "ui/window_list.h"

void console_shows_online_presence_when_set_online(void **state)
{
    prefs_set_string(PREF_STATUSES_CONSOLE, "online");
    plugins_init();
    roster_create();
    roster_process_pending_presence();
    char *barejid = "test1@server";
    roster_add(barejid, "bob", NULL, "both", FALSE);
    Resource *resource = resource_new("resource", RESOURCE_ONLINE, NULL, 10);

    expect_memory(ui_contact_online, barejid, barejid, sizeof(barejid));
    expect_memory(ui_contact_online, resource, resource, sizeof(resource));
    expect_value(ui_contact_online, last_activity, NULL);

    sv_ev_contact_online(barejid, resource, NULL, NULL);

    roster_destroy();
    plugins_shutdown();
}

void console_shows_online_presence_when_set_all(void **state)
{
    prefs_set_string(PREF_STATUSES_CONSOLE, "all");
    plugins_init();
    roster_create();
    roster_process_pending_presence();
    char *barejid = "test1@server";
    roster_add(barejid, "bob", NULL, "both", FALSE);
    Resource *resource = resource_new("resource", RESOURCE_ONLINE, NULL, 10);

    expect_memory(ui_contact_online, barejid, barejid, sizeof(barejid));
    expect_memory(ui_contact_online, resource, resource, sizeof(resource));
    expect_value(ui_contact_online, last_activity, NULL);

    sv_ev_contact_online(barejid, resource, NULL, NULL);

    roster_destroy();
    plugins_shutdown();
}

void console_shows_dnd_presence_when_set_all(void **state)
{
    prefs_set_string(PREF_STATUSES_CONSOLE, "all");
    plugins_init();
    roster_create();
    roster_process_pending_presence();
    char *barejid = "test1@server";
    roster_add(barejid, "bob", NULL, "both", FALSE);
    Resource *resource = resource_new("resource", RESOURCE_ONLINE, NULL, 10);

    expect_memory(ui_contact_online, barejid, barejid, sizeof(barejid));
    expect_memory(ui_contact_online, resource, resource, sizeof(resource));
    expect_value(ui_contact_online, last_activity, NULL);

    sv_ev_contact_online(barejid, resource, NULL, NULL);

    roster_destroy();
    plugins_shutdown();
}

void handle_offline_removes_chat_session(void **state)
{
    plugins_init();
    roster_create();
    roster_process_pending_presence();
    chat_sessions_init();
    char *barejid = "friend@server.chat.com";
    char *resource = "home";
    roster_add(barejid, "bob", NULL, "both", FALSE);
    Resource *resourcep = resource_new(resource, RESOURCE_ONLINE, NULL, 10);
    roster_update_presence(barejid, resourcep, NULL);
    chat_session_recipient_active(barejid, resource, FALSE);
    ProfConsoleWin *console = malloc(sizeof(ProfConsoleWin));
    will_return(win_create_console, &console->window);
    wins_init();
    sv_ev_contact_offline(barejid, resource, NULL);
    ChatSession *session = chat_session_get(barejid);

    assert_null(session);

    roster_destroy();
    chat_sessions_clear();
    plugins_shutdown();
}

void lost_connection_clears_chat_sessions(void **state)
{
    roster_create();
    roster_process_pending_presence();
    chat_sessions_init();
    chat_session_recipient_active("bob@server.org", "laptop", FALSE);
    chat_session_recipient_active("steve@server.org", "mobile", FALSE);
    expect_any_cons_show_error();

    sv_ev_lost_connection();

    ChatSession *session1 = chat_session_get("bob@server.org");
    ChatSession *session2 = chat_session_get("steve@server.org");
    assert_null(session1);
    assert_null(session2);
}