Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Added --as FILENAME option to the (chat send) command, which uses FILENAME as the attachment name for the file specified by the --file flag. Mimetype guessing for the attachment is based on the --as name. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
2bb3c76ad9e78e44f02b9d8d67914cd2 |
| User & Date: | stephan 2022-01-01 12:50:48.240 |
Context
|
2022-01-01
| ||
| 13:09 | /chat: when creating download links, append file's extension to the /chat-download/MSGID so that the browser's mime-type guessing can work better (seems to fix inline SVG attachments). Prefer to use an attachment's mimetype, instead of filename, for guessing whether it can be embedded, and enable embedding for all text/ and image/ mimetypes. ... (check-in: cead9178c8 user: stephan tags: trunk) | |
| 12:50 | Added --as FILENAME option to the (chat send) command, which uses FILENAME as the attachment name for the file specified by the --file flag. Mimetype guessing for the attachment is based on the --as name. ... (check-in: 2bb3c76ad9 user: stephan tags: trunk) | |
| 00:41 | Update the built-in SQLite to the latest 3.38.0 alpha, for testing. ... (check-in: 3e74ae503f user: drh tags: trunk) | |
Changes
Changes to src/chat.c.
| ︙ | ︙ | |||
832 833 834 835 836 837 838 839 840 841 842 843 844 845 | ** ** > fossil chat send [ARGUMENTS] ** ** This command sends a new message to the chatroom. The message ** to be sent is determined by arguments as follows: ** ** -f|--file FILENAME File to attach to the message ** -m|--message TEXT Text of the chat message ** --remote URL Send to this remote URL ** --unsafe Allow the use of unencrypted http:// ** ** > fossil chat url ** ** Show the default URL used to access the chat server. | > > | 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | ** ** > fossil chat send [ARGUMENTS] ** ** This command sends a new message to the chatroom. The message ** to be sent is determined by arguments as follows: ** ** -f|--file FILENAME File to attach to the message ** --as FILENAME2 Causes --file FILENAME to be sent with ** the attachment name FILENAME2 ** -m|--message TEXT Text of the chat message ** --remote URL Send to this remote URL ** --unsafe Allow the use of unencrypted http:// ** ** > fossil chat url ** ** Show the default URL used to access the chat server. |
| ︙ | ︙ | |||
889 890 891 892 893 894 895 896 897 898 899 900 901 902 |
zCmd = mprintf("%s %s/chat?cli &", zBrowser, zUrl);
#else
zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl);
#endif
fossil_system(zCmd);
}else if( strcmp(g.argv[2],"send")==0 ){
const char *zFilename = find_option("file","r",1);
const char *zMsg = find_option("message","m",1);
int allowUnsafe = find_option("unsafe",0,0)!=0;
const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
int i;
const char *zPw;
char *zLMTime;
Blob up, down, fcontent;
| > | 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 |
zCmd = mprintf("%s %s/chat?cli &", zBrowser, zUrl);
#else
zCmd = mprintf("%s \"%s/chat?cli\" &", zBrowser, zUrl);
#endif
fossil_system(zCmd);
}else if( strcmp(g.argv[2],"send")==0 ){
const char *zFilename = find_option("file","r",1);
const char *zAs = find_option("as",0,1);
const char *zMsg = find_option("message","m",1);
int allowUnsafe = find_option("unsafe",0,0)!=0;
const int mFlags = HTTP_GENERIC | HTTP_QUIET | HTTP_NOCOMPRESS;
int i;
const char *zPw;
char *zLMTime;
Blob up, down, fcontent;
|
| ︙ | ︙ | |||
938 939 940 941 942 943 944 |
"\r\n%z\r\n%s", obscure(zPw), zBoundary);
}
if( zMsg && zMsg[0] ){
blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n"
"\r\n%s\r\n%s", zMsg, zBoundary);
}
if( zFilename && blob_read_from_file(&fcontent, zFilename, ExtFILE)>0 ){
| | | | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 |
"\r\n%z\r\n%s", obscure(zPw), zBoundary);
}
if( zMsg && zMsg[0] ){
blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n"
"\r\n%s\r\n%s", zMsg, zBoundary);
}
if( zFilename && blob_read_from_file(&fcontent, zFilename, ExtFILE)>0 ){
char *zFN = mprintf("%s", file_tail(zAs ? zAs : zFilename));
int i;
const char *zMime = mimetype_from_name(zFN);
for(i=0; zFN[i]; i++){
char c = zFN[i];
if( fossil_isalnum(c) ) continue;
if( c=='.' ) continue;
if( c=='-' ) continue;
zFN[i] = '_';
}
|
| ︙ | ︙ |