Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/commands.c @ 1434:bed2f0caa952
Expand filename in /say_to -f
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 23 Feb 2008 12:00:56 +0100 |
parents | 0c030b00306d |
children | 9bf7f3ddff10 |
comparison
equal
deleted
inserted
replaced
1433:0c030b00306d | 1434:bed2f0caa952 |
---|---|
1348 // Read the whole content of a file. | 1348 // Read the whole content of a file. |
1349 // The data are converted to UTF8, they should be freed by the caller after | 1349 // The data are converted to UTF8, they should be freed by the caller after |
1350 // use. | 1350 // use. |
1351 char *load_message_from_file(const char *filename) | 1351 char *load_message_from_file(const char *filename) |
1352 { | 1352 { |
1353 FILE *fd; | |
1353 struct stat buf; | 1354 struct stat buf; |
1354 FILE *fd; | |
1355 char *msgbuf, *msgbuf_utf8; | 1355 char *msgbuf, *msgbuf_utf8; |
1356 char *eol; | 1356 char *eol; |
1357 | 1357 |
1358 fd = fopen(filename, "r"); | 1358 fd = fopen(filename, "r"); |
1359 | 1359 |
1460 | 1460 |
1461 fjid = to_utf8(fjid); | 1461 fjid = to_utf8(fjid); |
1462 if (!file) { | 1462 if (!file) { |
1463 msg = to_utf8(msg); | 1463 msg = to_utf8(msg); |
1464 } else { | 1464 } else { |
1465 char *filename_xp; | |
1465 if (msg) | 1466 if (msg) |
1466 scr_LogPrint(LPRINT_NORMAL, "say_to: extra parameter ignored."); | 1467 scr_LogPrint(LPRINT_NORMAL, "say_to: extra parameter ignored."); |
1467 msg = load_message_from_file(file); | 1468 filename_xp = expand_filename(file); |
1469 msg = load_message_from_file(filename_xp); | |
1470 g_free(filename_xp); | |
1468 g_free(file); | 1471 g_free(file); |
1469 } | 1472 } |
1470 | 1473 |
1471 send_message_to(fjid, msg, NULL, msg_type, quiet); | 1474 send_message_to(fjid, msg, NULL, msg_type, quiet); |
1472 | 1475 |