text stringlengths 0 357 |
|---|
loc->latitude = sqlite3_column_double(stmt, 1); |
loc->longitude = sqlite3_column_double(stmt, 2); |
loc->accuracy = sqlite3_column_double(stmt, 3); |
loc->timestamp = sqlite3_column_int64 (stmt, 4); |
loc->independent = sqlite3_column_int (stmt, 5); |
loc->msg_id = sqlite3_column_int (stmt, 6); |
loc->contact_id = sqlite3_column_int (stmt, 7); |
loc->chat_id = sqlite3_column_int (stmt, 8); |
if (loc->msg_id) { |
const char* txt = (const char*)sqlite3_column_text(stmt, 9); |
if (is_marker(txt)) { |
loc->marker = strdup(txt); |
} |
} |
dc_array_add_ptr(ret, loc); |
} |
cleanup: |
sqlite3_finalize(stmt); |
return ret; |
} |
/** |
* Delete all locations on the current device. |
* Locations already sent cannot be deleted. |
* |
* Typically results in the event #DC_EVENT_LOCATION_CHANGED |
* with contact_id set to 0. |
* |
* @memberof dc_context_t |
* @param context The context object. |
* @return None. |
*/ |
void dc_delete_all_locations(dc_context_t* context) |
{ |
sqlite3_stmt* stmt = NULL; |
if (context==NULL || context->magic!=DC_CONTEXT_MAGIC) { |
goto cleanup; |
} |
stmt = dc_sqlite3_prepare(context->sql, |
"DELETE FROM locations;"); |
sqlite3_step(stmt); |
context->cb(context, DC_EVENT_LOCATION_CHANGED, 0, 0); |
cleanup: |
sqlite3_finalize(stmt); |
} |
``` |
Filename: dc_log.c |
```c |
/* Asynchronous "Thread-errors" are reported by the dc_log_error() |
function. These errors must be shown to the user by a bubble or so. |
"Normal" errors are usually returned by a special value (null or so) and are |
usually not reported using dc_log_error() - its up to the caller to |
decide, what should be reported or done. However, these "Normal" errors |
are usually logged by dc_log_warning(). */ |
#include <stdarg.h> |
#include <memory.h> |
#include "dc_context.h" |
static void log_vprintf(dc_context_t* context, int event, int data1, const char* msg_format, va_list va) |
{ |
char* msg = NULL; |
if (context==NULL || context->magic!=DC_CONTEXT_MAGIC) { |
return; |
} |
if (msg_format) |
{ |
#define BUFSIZE 1024 |
char tempbuf[BUFSIZE+1]; |
vsnprintf(tempbuf, BUFSIZE, msg_format, va); |
msg = dc_strdup(tempbuf); |
} |
else |
{ |
msg = dc_mprintf("event #%i", (int)event); |
} |
context->cb(context, event, (uintptr_t)data1, (uintptr_t)msg); |
free(msg); |
} |
void dc_log_info(dc_context_t* context, int data1, const char* msg, ...) |
{ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.