about summary refs log tree commit diff stats
path: root/src/command
Commit message (Expand)AuthorAgeFilesLines
* Close all windows on /disconnectJames Booth2016-01-031-0/+1
* Added /roster show|hide roomsJames Booth2016-01-022-2/+19
* Added autoping timeout preferenceJames Booth2016-01-012-17/+49
* Added /console commandJames Booth2015-12-293-1/+73
* Fixed /charset helpJames Booth2015-12-201-1/+1
* Added /charset commandJames Booth2015-12-193-0/+34
* Show PGP error stringsJames Booth2015-12-151-4/+9
* Fix spelling and grammatical mistakes in command help textSteven Erenst2015-12-061-7/+7
* Added /wins unreadJames Booth2015-11-302-1/+7
* Tidied output for /notify commandJames Booth2015-11-291-55/+75
* Renamed /notify message -> /notify chatJames Booth2015-11-292-65/+63
* Added /notify reset to autocompletionJames Booth2015-11-281-0/+2
* Removed regular chat message triggersJames Booth2015-11-282-67/+2
* Added room specific notify settingsJames Booth2015-11-282-61/+189
* Merge branch 'master' into notificationsJames Booth2015-11-271-1/+1
|\
| * Fix typoAlex Jordan2015-11-271-1/+1
* | Finished basic /notify triggersJames Booth2015-11-252-9/+23
* | Merge branch 'master' into notificationsJames Booth2015-11-253-0/+110
|\|
| * Merge remote-tracking branch 'incertia/export-command'James Booth2015-11-253-0/+110
| |\
| | * add spaces after constructs such as if/for/whileWill Song2015-11-241-13/+13
| | * free fname as soon as we are done with it (also prevents a memory leak)Will Song2015-11-241-1/+1
| | * remove NULL check because parse_args will fail before calling cmd_exportWill Song2015-11-241-3/+1
| | * add some code to deal with a common $HOME conventionWill Song2015-11-241-1/+13
| | * show different message when one is not connectedWill Song2015-11-241-3/+9
| | * move brace to newline to follow conventionsWill Song2015-11-241-1/+2
| | * styling changes and remove temporary commentWill Song2015-11-241-7/+5
| | * actually check the return value of write for rare fail conditionsWill Song2015-11-231-13/+21
| | * ignore another return value and move initial loop declaration outside of loopWill Song2015-11-231-4/+5
| | * mark return value of sys_write as unused to fix testsWill Song2015-11-231-4/+7
| | * since we keep track of length correctly, we don't need to add a null terminat...Will Song2015-11-231-1/+1
| | * fix typoWill Song2015-11-231-1/+1
| | * decrease the amount of sys_writes used and add a useful error messageWill Song2015-11-231-8/+22
| | * add feature in issue #585Will Song2015-11-233-0/+69
| |/
* | Added autocompleters for notify trigger removalJames Booth2015-11-241-0/+12
* | Added functions to manage custom notification triggersJames Booth2015-11-241-10/+52
* | Added notify triggers WIPJames Booth2015-11-232-12/+98
|/
* Show summary of trusted certificates, add /tls cert <fingerprint>James Booth2015-11-222-18/+35
* Tidied roster commandsJames Booth2015-11-222-95/+115
* Added /roster resource joinJames Booth2015-11-222-0/+28
* Added /roster char resourceJames Booth2015-11-222-0/+20
* Updated helpJames Booth2015-11-221-3/+3
* Added word wrap to roster panelJames Booth2015-11-222-0/+18
* Option to show presence information on single line in rosterJames Booth2015-11-221-1/+1
* Added /roster indent presenceJames Booth2015-11-212-1/+20
* Added /roster indent resourceJames Booth2015-11-212-0/+19
* Free pref stringsJames Booth2015-11-211-8/+24
* Added /roster indent contactJames Booth2015-11-212-32/+68
* Removed unused priority settingsJames Booth2015-11-201-1/+1
* Added /roster char contactJames Booth2015-11-202-0/+20
* Added /roster char headerJames Booth2015-11-192-0/+43
4325'>^
07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
94bcf188 ^
1cc33cc4 ^
07308673 ^
94bcf188 ^

07308673 ^
3a22719b ^
8bdab23e ^
3a22719b ^
07308673 ^
3a22719b ^

07308673 ^
3a22719b ^
8bdab23e ^
3a22719b ^
07308673 ^
3a22719b ^

07308673 ^
d239a127 ^


07308673 ^




d239a127 ^

07308673 ^
d239a127 ^


07308673 ^




d239a127 ^

07308673 ^
d239a127 ^


07308673 ^




d239a127 ^

07308673 ^
d239a127 ^


07308673 ^




94bcf188 ^
e263e00a ^
















1c5efaeb ^
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



                   
                   
 
                     
 
                                                    
 
                                   
                        

 
                                                            
 
                                 
                        

 
                                                    
 
                                                       
                                                                   

 
                                                    
 
                                                       
                                                            

 
                                                            
 
                                                       
                                                        

 
                                                         
 
                                                       
                                                     

 
                                                          
 
                                                       
                                                        

 
                                                            
 
                                                
                                                            

 
                                                            
 
                                                
                                                     

 
                                                                    
 
                                                
                                                        

 
                                                                  
 
                                                
                                                        

 
                                                                      
 
                                                
                                   

 
                                                         
 
                                                
                                 

 
                                                             
 
                                                
                                      

 
                                                    
 
                                                
                                                            

 
                                                         
 
                                                
                                                     

 
                                                          
 
                                                
                                                        

 
                                               
 
                                                                                            
 
                                                                       

 
                                               
 
                                                                                            
 
                                                        

 
                                                


                                                                   




                                                                               

 
                                             


                                                                   




                                                                               

 
                                                       


                                                                             




                                                                                         

 
                                                  


                                                                 




                                                                             
 
















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

#include "xmpp/jid.h"

void create_jid_from_null_returns_null(void **state)
{
    Jid *result = jid_create(NULL);
    assert_null(result);
}

void create_jid_from_empty_string_returns_null(void **state)
{
    Jid *result = jid_create("");
    assert_null(result);
}

void create_jid_from_full_returns_full(void **state)
{
    Jid *result = jid_create("myuser@mydomain/laptop");
    assert_string_equal("myuser@mydomain/laptop", result->fulljid);
}

void create_jid_from_full_returns_bare(void **state)
{
    Jid *result = jid_create("myuser@mydomain/laptop");
    assert_string_equal("myuser@mydomain", result->barejid);
}

void create_jid_from_full_returns_resourcepart(void **state)
{
    Jid *result = jid_create("myuser@mydomain/laptop");
    assert_string_equal("laptop", result->resourcepart);
}

void create_jid_from_full_returns_localpart(void **state)
{
    Jid *result = jid_create("myuser@mydomain/laptop");
    assert_string_equal("myuser", result->localpart);
}

void create_jid_from_full_returns_domainpart(void **state)
{
    Jid *result = jid_create("myuser@mydomain/laptop");
    assert_string_equal("mydomain", result->domainpart);
}

void create_jid_from_full_nolocal_returns_full(void **state)
{
    Jid *result = jid_create("mydomain/laptop");
    assert_string_equal("mydomain/laptop", result->fulljid);
}

void create_jid_from_full_nolocal_returns_bare(void **state)
{
    Jid *result = jid_create("mydomain/laptop");
    assert_string_equal("mydomain", result->barejid);
}

void create_jid_from_full_nolocal_returns_resourcepart(void **state)
{
    Jid *result = jid_create("mydomain/laptop");
    assert_string_equal("laptop", result->resourcepart);
}

void create_jid_from_full_nolocal_returns_domainpart(void **state)
{
    Jid *result = jid_create("mydomain/laptop");
    assert_string_equal("mydomain", result->domainpart);
}

void create_jid_from_full_nolocal_returns_null_localpart(void **state)
{
    Jid *result = jid_create("mydomain/laptop");
    assert_null(result->localpart);
}

void create_jid_from_bare_returns_null_full(void **state)
{
    Jid *result = jid_create("myuser@mydomain");
    assert_null(result->fulljid);
}

void create_jid_from_bare_returns_null_resource(void **state)
{
    Jid *result = jid_create("myuser@mydomain");
    assert_null(result->resourcepart);
}

void create_jid_from_bare_returns_bare(void **state)
{
    Jid *result = jid_create("myuser@mydomain");
    assert_string_equal("myuser@mydomain", result->barejid);
}

void create_jid_from_bare_returns_localpart(void **state)
{
    Jid *result = jid_create("myuser@mydomain");
    assert_string_equal("myuser", result->localpart);
}

void create_jid_from_bare_returns_domainpart(void **state)
{
    Jid *result = jid_create("myuser@mydomain");
    assert_string_equal("mydomain", result->domainpart);
}

void create_room_jid_returns_room(void **state)
{
    Jid *result = jid_create_from_bare_and_resource("room@conference.domain.org", "myname");

    assert_string_equal("room@conference.domain.org", result->barejid);
}

void create_room_jid_returns_nick(void **state)
{
    Jid *result = jid_create_from_bare_and_resource("room@conference.domain.org", "myname");

    assert_string_equal("myname", result->resourcepart);
}

void create_with_slash_in_resource(void **state)
{
    Jid *result = jid_create("room@conference.domain.org/my/nick");

    assert_string_equal("room", result->localpart);
    assert_string_equal("conference.domain.org", result->domainpart);
    assert_string_equal("my/nick", result->resourcepart);
    assert_string_equal("room@conference.domain.org", result->barejid);
    assert_string_equal("room@conference.domain.org/my/nick", result->fulljid);
}

void create_with_at_in_resource(void **state)
{
    Jid *result = jid_create("room@conference.domain.org/my@nick");

    assert_string_equal("room", result->localpart);
    assert_string_equal("conference.domain.org", result->domainpart);
    assert_string_equal("my@nick", result->resourcepart);
    assert_string_equal("room@conference.domain.org", result->barejid);
    assert_string_equal("room@conference.domain.org/my@nick", result->fulljid);
}

void create_with_at_and_slash_in_resource(void **state)
{
    Jid *result = jid_create("room@conference.domain.org/my@nick/something");

    assert_string_equal("room", result->localpart);
    assert_string_equal("conference.domain.org", result->domainpart);
    assert_string_equal("my@nick/something", result->resourcepart);
    assert_string_equal("room@conference.domain.org", result->barejid);
    assert_string_equal("room@conference.domain.org/my@nick/something", result->fulljid);
}

void create_full_with_trailing_slash(void **state)
{
    Jid *result = jid_create("room@conference.domain.org/nick/");

    assert_string_equal("room", result->localpart);
    assert_string_equal("conference.domain.org", result->domainpart);
    assert_string_equal("nick/", result->resourcepart);
    assert_string_equal("room@conference.domain.org", result->barejid);
    assert_string_equal("room@conference.domain.org/nick/", result->fulljid);
}

void returns_fulljid_when_exists(void **state)
{
    Jid *jid = jid_create("localpart@domainpart/resourcepart");

    char *result = jid_fulljid_or_barejid(jid);

    assert_string_equal("localpart@domainpart/resourcepart", result);
}

void returns_barejid_when_fulljid_not_exists(void **state)
{
    Jid *jid = jid_create("localpart@domainpart");

    char *result = jid_fulljid_or_barejid(jid);

    assert_string_equal("localpart@domainpart", result);
}