about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command/command.c20
-rw-r--r--src/command/commands.c25
-rw-r--r--src/config/accounts.c20
-rw-r--r--src/config/accounts.h2
-rw-r--r--src/tools/p_sha1.c18
-rw-r--r--src/ui/core.c13
-rw-r--r--src/xmpp/iq.c4
-rw-r--r--src/xmpp/xmpp.h2
8 files changed, 76 insertions, 28 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 5726b49f..178e90b1 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -207,11 +207,14 @@ static struct cmd_t command_defs[] =
 
     { "/info",
         cmd_info, parse_args, 0, 1, NULL,
-        { "/info [contact|nick]", "Show basic information about a contact, or room member.",
+        { "/info [contact|nick]", "Show basic information about a contact, room, or room member.",
         { "/info [contact|nick]",
           "--------------------",
-          "Show information including current subscription status and summary information for each connected resource.",
+          "Show basic information about a contact, room, or room member.",
+          "If in the console, a contact must be specified.",
           "If in a chat window the parameter is not required, the current recipient will be used.",
+          "If in a chat room, providing no arguments will display information about the room.",
+          "If in a chat room, supplying a nick will show information about the occupant.",
           "",
           "Example : /info mybuddy@chat.server.org",
           "Example : /info kai",
@@ -381,9 +384,9 @@ static struct cmd_t command_defs[] =
 
     { "/form",
         cmd_form, parse_args, 1, 2, NULL,
-        { "/form show|submit|cancel|help", "Form handling.",
-        { "/form show|submit|cancel|help",
-          "-----------------------------",
+        { "/form show|submit|cancel|help [tag]", "Form handling.",
+        { "/form show|submit|cancel|help [tag]",
+          "-----------------------------------",
           "show             - Show the current form.",
           "submit           - Submit the current form.",
           "cancel           - Cancel changes to the current form.",
@@ -551,10 +554,7 @@ static struct cmd_t command_defs[] =
         { "/privileges on|off", "Show occupant privileges in chat rooms.",
         { "/privileges on|off",
           "---------------------------",
-          "If enabled:",
-          "The room roster will be broken down my role.",
-          "An occupants role and affiliation will be shown when they join a room.",
-          "Changes to occupant privileges will be shown in the chat room.",
+          "If enabled the room roster will be broken down my role, and role information will be showin in the room.",
           NULL } } },
 
     { "/beep",
@@ -1194,6 +1194,8 @@ cmd_init(void)
 
     account_clear_ac = autocomplete_new();
     autocomplete_add(account_clear_ac, "password");
+    autocomplete_add(account_clear_ac, "server");
+    autocomplete_add(account_clear_ac, "port");
     autocomplete_add(account_clear_ac, "otr");
 
     close_ac = autocomplete_new();
diff --git a/src/command/commands.c b/src/command/commands.c
index 40640485..0dc26fff 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -362,6 +362,14 @@ cmd_account(gchar **args, struct cmd_help_t help)
                     accounts_clear_password(account_name);
                     cons_show("Removed password for account %s", account_name);
                     cons_show("");
+                } else if (strcmp(property, "server") == 0) {
+                    accounts_clear_server(account_name);
+                    cons_show("Removed server for account %s", account_name);
+                    cons_show("");
+                } else if (strcmp(property, "port") == 0) {
+                    accounts_clear_port(account_name);
+                    cons_show("Removed port for account %s", account_name);
+                    cons_show("");
                 } else if (strcmp(property, "otr") == 0) {
                     accounts_clear_otr(account_name);
                     cons_show("OTR policy removed for account %s", account_name);
@@ -1827,6 +1835,7 @@ cmd_form_field(char *tag, gchar **args)
             } else {
                 ui_current_print_line("Invalid command, usage:");
                 ui_show_form_field_help(current, form, tag);
+                ui_current_print_line("");
             }
             break;
 
@@ -1837,6 +1846,7 @@ cmd_form_field(char *tag, gchar **args)
             if (value == NULL) {
                 ui_current_print_line("Invalid command, usage:");
                 ui_show_form_field_help(current, form, tag);
+                ui_current_print_line("");
             } else {
                 form_set_value(form, tag, value);
                 ui_current_print_line("Field updated...");
@@ -1848,6 +1858,7 @@ cmd_form_field(char *tag, gchar **args)
             if ((value == NULL) || !form_field_contains_option(form, tag, value)) {
                 ui_current_print_line("Invalid command, usage:");
                 ui_show_form_field_help(current, form, tag);
+                ui_current_print_line("");
             } else {
                 form_set_value(form, tag, value);
                 ui_current_print_line("Field updated...");
@@ -1863,11 +1874,13 @@ cmd_form_field(char *tag, gchar **args)
             if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) {
                 ui_current_print_line("Invalid command, usage:");
                 ui_show_form_field_help(current, form, tag);
+                ui_current_print_line("");
                 break;
             }
             if (value == NULL) {
                 ui_current_print_line("Invalid command, usage:");
                 ui_show_form_field_help(current, form, tag);
+                ui_current_print_line("");
                 break;
             }
             if (g_strcmp0(cmd, "add") == 0) {
@@ -1880,11 +1893,13 @@ cmd_form_field(char *tag, gchar **args)
                 if (!g_str_has_prefix(value, "val")) {
                     ui_current_print_line("Invalid command, usage:");
                     ui_show_form_field_help(current, form, tag);
+                    ui_current_print_line("");
                     break;
                 }
                 if (strlen(value) < 4) {
                     ui_current_print_line("Invalid command, usage:");
                     ui_show_form_field_help(current, form, tag);
+                    ui_current_print_line("");
                     break;
                 }
 
@@ -1892,6 +1907,7 @@ cmd_form_field(char *tag, gchar **args)
                 if ((index < 1) || (index > form_get_value_count(form, tag))) {
                     ui_current_print_line("Invalid command, usage:");
                     ui_show_form_field_help(current, form, tag);
+                    ui_current_print_line("");
                     break;
                 }
 
@@ -1912,11 +1928,13 @@ cmd_form_field(char *tag, gchar **args)
             if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) {
                 ui_current_print_line("Invalid command, usage:");
                 ui_show_form_field_help(current, form, tag);
+                ui_current_print_line("");
                 break;
             }
             if (value == NULL) {
                 ui_current_print_line("Invalid command, usage:");
                 ui_show_form_field_help(current, form, tag);
+                ui_current_print_line("");
                 break;
             }
             if (g_strcmp0(args[0], "add") == 0) {
@@ -1932,6 +1950,7 @@ cmd_form_field(char *tag, gchar **args)
                 } else {
                     ui_current_print_line("Invalid command, usage:");
                     ui_show_form_field_help(current, form, tag);
+                    ui_current_print_line("");
                 }
                 break;
             }
@@ -1948,6 +1967,7 @@ cmd_form_field(char *tag, gchar **args)
                 } else {
                     ui_current_print_line("Invalid command, usage:");
                     ui_show_form_field_help(current, form, tag);
+                    ui_current_print_line("");
                 }
             }
             break;
@@ -1959,11 +1979,13 @@ cmd_form_field(char *tag, gchar **args)
             if ((g_strcmp0(cmd, "add") != 0) && (g_strcmp0(cmd, "remove"))) {
                 ui_current_print_line("Invalid command, usage:");
                 ui_show_form_field_help(current, form, tag);
+                ui_current_print_line("");
                 break;
             }
             if (value == NULL) {
                 ui_current_print_line("Invalid command, usage:");
                 ui_show_form_field_help(current, form, tag);
+                ui_current_print_line("");
                 break;
             }
             if (g_strcmp0(args[0], "add") == 0) {
@@ -2369,13 +2391,12 @@ cmd_room(gchar **args, struct cmd_help_t help)
             iq_confirm_instant_room(room);
             muc_set_requires_config(room, FALSE);
             win_save_print(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Room unlocked.");
-            cons_show("Room unlocked: %s (%d)", room, ui_index);
             return TRUE;
         }
     }
 
     if (g_strcmp0(args[0], "destroy") == 0) {
-        iq_destroy_instant_room(room);
+        iq_destroy_room(room);
         return TRUE;
     }
 
diff --git a/src/config/accounts.c b/src/config/accounts.c
index b5e27127..175cac5f 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -441,6 +441,24 @@ _accounts_clear_password(const char * const account_name)
 }
 
 static void
+_accounts_clear_server(const char * const account_name)
+{
+    if (accounts_account_exists(account_name)) {
+        g_key_file_remove_key(accounts, account_name, "server", NULL);
+        _save_accounts();
+    }
+}
+
+static void
+_accounts_clear_port(const char * const account_name)
+{
+    if (accounts_account_exists(account_name)) {
+        g_key_file_remove_key(accounts, account_name, "port", NULL);
+        _save_accounts();
+    }
+}
+
+static void
 _accounts_clear_otr(const char * const account_name)
 {
     if (accounts_account_exists(account_name)) {
@@ -869,6 +887,8 @@ accounts_init_module(void)
     accounts_set_priority_all = _accounts_set_priority_all;
     accounts_get_priority_for_presence_type = _accounts_get_priority_for_presence_type;
     accounts_clear_password = _accounts_clear_password;
+    accounts_clear_server = _accounts_clear_server;
+    accounts_clear_port = _accounts_clear_port;
     accounts_clear_otr = _accounts_clear_otr;
     accounts_add_otr_policy = _accounts_add_otr_policy;
 }
diff --git a/src/config/accounts.h b/src/config/accounts.h
index 299fdf0b..97c125eb 100644
--- a/src/config/accounts.h
+++ b/src/config/accounts.h
@@ -78,6 +78,8 @@ void (*accounts_set_priority_all)(const char * const account_name, const gint va
 gint (*accounts_get_priority_for_presence_type)(const char * const account_name,
     resource_presence_t presence_type);
 void (*accounts_clear_password)(const char * const account_name);
+void (*accounts_clear_server)(const char * const account_name);
+void (*accounts_clear_port)(const char * const account_name);
 void (*accounts_clear_otr)(const char * const account_name);
 void (*accounts_add_otr_policy)(const char * const account_name, const char * const contact_jid, const char * const policy);
 
diff --git a/src/tools/p_sha1.c b/src/tools/p_sha1.c
index 7c059c97..1936b89c 100644
--- a/src/tools/p_sha1.c
+++ b/src/tools/p_sha1.c
@@ -101,19 +101,14 @@ A million repetitions of "a"
 
 #include "p_sha1.h"
 
+static uint32_t host_to_be(uint32_t i);
 void P_SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]);
 
 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
 
 /* blk0() and blk() perform the initial expand. */
 /* I got the idea of expanding during the round function from SSLeay */
-/* FIXME: can we do this in an endian-proof way? */
-#ifdef WORDS_BIGENDIAN
-#define blk0(i) block->l[i]
-#else
-#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
-    |(rol(block->l[i],8)&0x00FF00FF))
-#endif
+#define blk0(i) (block->l[i] = host_to_be(block->l[i]))
 #define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
     ^block->l[(i+2)&15]^block->l[i&15],1))
 
@@ -138,6 +133,15 @@ void SHAPrintContext(P_P_SHA1_CTX *context, char *msg){
 }
 #endif /* VERBOSE */
 
+static uint32_t host_to_be(uint32_t i)
+{
+    static const union {
+        unsigned u;
+        unsigned char c;
+    } check = {1};
+    return check.c ? (rol(i,24)&0xFF00FF00)|(rol(i,8)&0x00FF00FF) : i;
+}
+
 /* Hash a single 512-bit block. This is the core of the algorithm. */
 void P_SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
 {
diff --git a/src/ui/core.c b/src/ui/core.c
index c6971aca..f50ad982 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -1824,7 +1824,7 @@ _ui_room_requires_config(const char * const room_jid)
 
         win_save_print(window, '-', NULL, 0, 0, "", "");
         win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "",
-            "Room requires configuration.");
+            "Room locked, requires configuration.");
         win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "",
             "Use '/room accept' to accept the defaults");
         win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "",
@@ -1841,8 +1841,6 @@ _ui_room_requires_config(const char * const room_jid)
         } else {
             status_bar_new(num);
         }
-
-        cons_show("Room created, locked: %s (%d)", room_jid, ui_index);
     }
 }
 
@@ -2558,7 +2556,8 @@ static void
 _ui_show_form(ProfWin *window, const char * const room, DataForm *form)
 {
     if (form->title != NULL) {
-        win_save_print(window, '-', NULL, 0, 0, "", form->title);
+        win_save_print(window, '-', NULL, NO_EOL, 0, "", "Form title: ");
+        win_save_print(window, '-', NULL, NO_DATE, 0, "", form->title);
     } else {
         win_save_vprint(window, '-', NULL, 0, 0, "", "Configuration for room %s.", room);
     }
@@ -2609,9 +2608,9 @@ _ui_handle_room_configuration(const char * const room, DataForm *form)
     ui_show_form(window, room, form);
 
     win_save_print(window, '-', NULL, 0, 0, "", "");
-    win_save_print(window, '-', NULL, 0, COLOUR_ROOMINFO, "", "Use '/form submit' to save changes.");
-    win_save_print(window, '-', NULL, 0, COLOUR_ROOMINFO, "", "Use '/form cancel' to cancel changes.");
-    win_save_print(window, '-', NULL, 0, COLOUR_ROOMINFO, "", "See '/form help' for more information.");
+    win_save_print(window, '-', NULL, 0, 0, "", "Use '/form submit' to save changes.");
+    win_save_print(window, '-', NULL, 0, 0, "", "Use '/form cancel' to cancel changes.");
+    win_save_print(window, '-', NULL, 0, 0, "", "See '/form help' for more information.");
     win_save_print(window, '-', NULL, 0, 0, "", "");
 }
 
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index b8530b7c..a33f2291 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -234,7 +234,7 @@ _iq_confirm_instant_room(const char * const room_jid)
 }
 
 static void
-_iq_destroy_instant_room(const char * const room_jid)
+_iq_destroy_room(const char * const room_jid)
 {
     xmpp_conn_t * const conn = connection_get_conn();
     xmpp_ctx_t * const ctx = connection_get_ctx();
@@ -1241,7 +1241,7 @@ iq_init_module(void)
     iq_send_software_version = _iq_send_software_version;
     iq_set_autoping = _iq_set_autoping;
     iq_confirm_instant_room = _iq_confirm_instant_room;
-    iq_destroy_instant_room = _iq_destroy_instant_room;
+    iq_destroy_room = _iq_destroy_room;
     iq_send_ping = _iq_send_ping;
     iq_request_room_config_form = _iq_request_room_config_form;
     iq_room_config_cancel = _iq_room_config_cancel;
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index 1d391cbc..15f0a7a5 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -185,7 +185,7 @@ void (*iq_disco_info_request)(gchar *jid);
 void (*iq_disco_items_request)(gchar *jid);
 void (*iq_set_autoping)(int seconds);
 void (*iq_confirm_instant_room)(const char * const room_jid);
-void (*iq_destroy_instant_room)(const char * const room_jid);
+void (*iq_destroy_room)(const char * const room_jid);
 void (*iq_request_room_config_form)(const char * const room_jid);
 void (*iq_submit_room_config)(const char * const room, DataForm *form);
 void (*iq_room_config_cancel)(const char * const room_jid);
?h=hlt&id=1a62e61df42bfdf001010700c1e1042c67d62ec2'>^
104e521c ^
d1c9392a ^
c762564b ^





4c37b3e9 ^
c762564b ^



4c37b3e9 ^
d1c9392a ^

c762564b ^





5a2cb154 ^
c762564b ^



5a2cb154 ^
c762564b ^

1f08b541 ^
c762564b ^





4c37b3e9 ^

c762564b ^











4c37b3e9 ^
c762564b ^





104e521c ^
d1c9392a ^
c762564b ^





4c37b3e9 ^
c762564b ^



4c37b3e9 ^
d1c9392a ^

c762564b ^





5a2cb154 ^
c762564b ^



5a2cb154 ^
c762564b ^

1f08b541 ^
c762564b ^





4c37b3e9 ^

c762564b ^









4c37b3e9 ^
c762564b ^





104e521c ^
d1c9392a ^
c762564b ^





4c37b3e9 ^
c762564b ^



4c37b3e9 ^
d1c9392a ^

c762564b ^





5a2cb154 ^
c762564b ^



5a2cb154 ^
c762564b ^

1f08b541 ^
c762564b ^





4c37b3e9 ^

c762564b ^









4c37b3e9 ^
c762564b ^




5fe060d5 ^
104e521c ^
d1c9392a ^
c762564b ^





4c37b3e9 ^
c762564b ^


1a4de9dd ^
d1c9392a ^
4c37b3e9 ^
d1c9392a ^
104e521c ^
c762564b ^

104e521c ^
4c37b3e9 ^

c762564b ^







4c37b3e9 ^
c762564b ^






4c37b3e9 ^
c762564b ^










4c37b3e9 ^
c762564b ^

5fe060d5 ^
c762564b ^

4c37b3e9 ^
104e521c ^
c762564b ^

104e521c ^
4c37b3e9 ^

c762564b ^









4c37b3e9 ^
c762564b ^









4c37b3e9 ^
c762564b ^



5a2cb154 ^
c762564b ^



5a2cb154 ^
c762564b ^

1f08b541 ^
c762564b ^



5a2cb154 ^
c762564b ^



5a2cb154 ^
c762564b ^

1f08b541 ^
c762564b ^




5a2cb154 ^
c762564b ^



5a2cb154 ^
c762564b ^

1f08b541 ^
c762564b ^




104e521c ^
d1c9392a ^







c762564b ^




4c37b3e9 ^
c762564b ^









104e521c ^
4c37b3e9 ^
d1c9392a ^

c762564b ^




104e521c ^
d1c9392a ^
c762564b ^







1f08b541 ^
c762564b ^



d1c9392a ^
4c37b3e9 ^


d1c9392a ^
104e521c ^
c762564b ^




104e521c ^
d1c9392a ^
c762564b ^





4c37b3e9 ^


c762564b ^


4c37b3e9 ^
d1c9392a ^
c762564b ^
4c37b3e9 ^
d1c9392a ^

c762564b ^

5fe060d5 ^



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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564