diff options
-rw-r--r-- | vchat-client.c | 7 | ||||
-rw-r--r-- | vchat-protocol.c | 1 | ||||
-rw-r--r-- | vchat-ui.c | 31 | ||||
-rw-r--r-- | vchat.h | 3 |
4 files changed, 38 insertions, 4 deletions
diff --git a/vchat-client.c b/vchat-client.c index a22df94..92d1905 100644 --- a/vchat-client.c +++ b/vchat-client.c | |||
@@ -343,8 +343,13 @@ void cleanup(int signal) { | |||
343 | /* inform user if we where killed by signal */ | 343 | /* inform user if we where killed by signal */ |
344 | if (signal > 1) { | 344 | if (signal > 1) { |
345 | fprintf(stderr, "vchat-client: terminated with signal %d.\n", signal); | 345 | fprintf(stderr, "vchat-client: terminated with signal %d.\n", signal); |
346 | } else if (errstr[0]) | 346 | if (!loggedin) |
347 | dumpconnect(); | ||
348 | } else if (errstr[0]) { | ||
347 | fputs(errstr, stderr); | 349 | fputs(errstr, stderr); |
350 | if (!loggedin) | ||
351 | dumpconnect(); | ||
352 | } | ||
348 | /* end of story */ | 353 | /* end of story */ |
349 | exit(0); | 354 | exit(0); |
350 | } | 355 | } |
diff --git a/vchat-protocol.c b/vchat-protocol.c index ac65639..c5021e4 100644 --- a/vchat-protocol.c +++ b/vchat-protocol.c | |||
@@ -235,6 +235,7 @@ static void justloggedin(char *message) { | |||
235 | loadcfg(getstroption(CF_LOGINSCRIPT), 0, handleline); | 235 | loadcfg(getstroption(CF_LOGINSCRIPT), 0, handleline); |
236 | handleline(".S"); | 236 | handleline(".S"); |
237 | loggedin = 1; | 237 | loggedin = 1; |
238 | flushconnect(); | ||
238 | } | 239 | } |
239 | } | 240 | } |
240 | 241 | ||
@@ -91,6 +91,7 @@ struct sb_data { | |||
91 | static struct sb_data *sb_pub = NULL; | 91 | static struct sb_data *sb_pub = NULL; |
92 | static struct sb_data *sb_priv = NULL; | 92 | static struct sb_data *sb_priv = NULL; |
93 | static struct sb_data *sb_out = NULL; | 93 | static struct sb_data *sb_out = NULL; |
94 | static struct sb_data *sb_connect = NULL; | ||
94 | 95 | ||
95 | /* Tells, which window is active */ | 96 | /* Tells, which window is active */ |
96 | static int sb_win = 0; /* 0 for pub, 1 for priv */ | 97 | static int sb_win = 0; /* 0 for pub, 1 for priv */ |
@@ -310,14 +311,18 @@ static void sb_flush(struct sb_data *sb) { | |||
310 | now = tmp; | 311 | now = tmp; |
311 | } | 312 | } |
312 | sb->entries = NULL; | 313 | sb->entries = NULL; |
314 | sb->last = NULL; | ||
315 | sb->count = 0; | ||
316 | sb->scroll = 0; | ||
313 | } | 317 | } |
314 | 318 | ||
315 | /*static void | 319 | /* |
316 | sb_clear ( struct sb_data **sb ) { | 320 | static void sb_clear ( struct sb_data **sb ) { |
317 | sb_flush(*sb); | 321 | sb_flush(*sb); |
318 | free( *sb ); | 322 | free( *sb ); |
319 | *sb = NULL; | 323 | *sb = NULL; |
320 | }*/ | 324 | } |
325 | */ | ||
321 | 326 | ||
322 | static struct sb_entry *sb_add(struct sb_data *sb, const char *line, | 327 | static struct sb_entry *sb_add(struct sb_data *sb, const char *line, |
323 | time_t when) { | 328 | time_t when) { |
@@ -407,9 +412,27 @@ int writecf(formtstr id, char *str) { | |||
407 | else | 412 | else |
408 | consoleline(NULL); | 413 | consoleline(NULL); |
409 | 414 | ||
415 | if (!loggedin) | ||
416 | sb_add(sb_connect, str, now); | ||
417 | |||
410 | return i; | 418 | return i; |
411 | } | 419 | } |
412 | 420 | ||
421 | void dumpconnect() { | ||
422 | struct sb_entry *now = sb_connect->entries, *prev = NULL, *tmp; | ||
423 | while (now) { | ||
424 | tmp = (struct sb_entry *)((unsigned long)prev ^ (unsigned long)now->link); | ||
425 | fputs(now->what, stderr); | ||
426 | fputc(10, stderr); | ||
427 | prev = now; | ||
428 | now = tmp; | ||
429 | } | ||
430 | } | ||
431 | |||
432 | void flushconnect() { | ||
433 | sb_flush(sb_connect); | ||
434 | } | ||
435 | |||
413 | int writepriv(char *str, int maybeep) { | 436 | int writepriv(char *str, int maybeep) { |
414 | int i = 0; | 437 | int i = 0; |
415 | if (private) { | 438 | if (private) { |
@@ -1222,6 +1245,7 @@ void initui(void) { | |||
1222 | /* Prepare our scrollback buffers */ | 1245 | /* Prepare our scrollback buffers */ |
1223 | sb_pub = (struct sb_data *)malloc(sizeof(struct sb_data)); | 1246 | sb_pub = (struct sb_data *)malloc(sizeof(struct sb_data)); |
1224 | sb_out = (struct sb_data *)malloc(sizeof(struct sb_data)); | 1247 | sb_out = (struct sb_data *)malloc(sizeof(struct sb_data)); |
1248 | sb_connect = (struct sb_data *)malloc(sizeof(struct sb_data)); | ||
1225 | if (privheight) | 1249 | if (privheight) |
1226 | sb_priv = (struct sb_data *)malloc(sizeof(struct sb_data)); | 1250 | sb_priv = (struct sb_data *)malloc(sizeof(struct sb_data)); |
1227 | else | 1251 | else |
@@ -1230,6 +1254,7 @@ void initui(void) { | |||
1230 | memset(sb_pub, 0, sizeof(struct sb_data)); | 1254 | memset(sb_pub, 0, sizeof(struct sb_data)); |
1231 | memset(sb_priv, 0, sizeof(struct sb_data)); | 1255 | memset(sb_priv, 0, sizeof(struct sb_data)); |
1232 | memset(sb_out, 0, sizeof(struct sb_data)); | 1256 | memset(sb_out, 0, sizeof(struct sb_data)); |
1257 | memset(sb_connect, 0, sizeof(struct sb_data)); | ||
1233 | 1258 | ||
1234 | /* set colors for windows */ | 1259 | /* set colors for windows */ |
1235 | if (has_colors()) { | 1260 | if (has_colors()) { |
@@ -195,6 +195,9 @@ void flushout(void); | |||
195 | } | 195 | } |
196 | void hideout(void); | 196 | void hideout(void); |
197 | int writecf(formtstr id, char *str); | 197 | int writecf(formtstr id, char *str); |
198 | /* dumps aggregated connect output in case of a connection error */ | ||
199 | void dumpconnect(); | ||
200 | void flushconnect(); | ||
198 | 201 | ||
199 | extern int outputcountdown; | 202 | extern int outputcountdown; |
200 | 203 | ||