1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-05 19:42:04 +02:00

add function to bind any location to a message object

This commit is contained in:
B. Petersen 2019-04-25 13:46:18 +02:00
parent b9fcace18e
commit 76250798ba
No known key found for this signature in database
GPG key ID: 3B88E92DEA8E9AFC
5 changed files with 86 additions and 0 deletions

View file

@ -449,6 +449,7 @@ char* dc_cmdline(dc_context_t* context, const char* cmdline)
"send <text>\n"
"sendimage <file> [<text>]\n"
"sendfile <file>\n"
"sendpoi <lat> <lang> <text>\n"
"draft [<text>]\n"
"listmedia\n"
"archive <chat-id>\n"
@ -1035,6 +1036,31 @@ char* dc_cmdline(dc_context_t* context, const char* cmdline)
ret = dc_strdup("No chat selected.");
}
}
else if (strcmp(cmd, "sendpoi")==0)
{
if (sel_chat) {
char* arg2 = arg1? strchr(arg1, ' ') : NULL;
if (arg2) { *arg2 = 0; arg2++; }
char* arg3 = arg2? strchr(arg2, ' ') : NULL;
if (arg3) { *arg3 = 0; arg3++; }
if (arg1 && arg2 && arg3) {
dc_msg_t* msg = dc_msg_new(context,DC_MSG_TEXT);
dc_msg_set_text(msg, arg3);
dc_msg_set_location(msg, dc_atof(arg1), dc_atof(arg2), 2.0);
dc_send_msg(context, dc_chat_get_id(sel_chat), msg);
dc_msg_unref(msg);
ret = COMMAND_SUCCEEDED;
}
else {
ret = dc_strdup("ERROR: Usage: sendpoi <lat> <lng> <text>");
}
}
else {
ret = dc_strdup("No chat selected.");
}
}
else if (strcmp(cmd, "listmsgs")==0)
{
if (arg1) {