morse command
This commit is contained in:
+7
-2
@@ -55,11 +55,16 @@ int64_t hammy_job_age_ms(const hammy_job_t* job, struct discord* client);
|
||||
// Does not destroy the job.
|
||||
void hammy_job_run(hammy_job_t* job, struct discord* client, hammy_refdb_t* refdb);
|
||||
|
||||
// Edits the (already deferred) interaction response with a plain text body.
|
||||
// Edits the (already deferred) interaction response with a titled embed,
|
||||
// falling back to a plain text body only if the embed cannot be built.
|
||||
// Used by hammy_job_run() and by the pool's error paths.
|
||||
//
|
||||
// Only valid on the deferred path: it edits a response, so something must have
|
||||
// answered the interaction already. Instant handlers want hammy_job_respond().
|
||||
void hammy_job_reply(const hammy_job_t* job, struct discord* client, const char* title, const char* content, bool isError);
|
||||
|
||||
// Sends a fresh interaction response with a plain text body.
|
||||
// Sends a fresh interaction response with a titled embed, falling back to a
|
||||
// plain text body only if the embed cannot be built.
|
||||
// Only valid on the instant path, where nothing has been sent yet.
|
||||
void hammy_job_respond(const hammy_job_t* job, struct discord* client, const char* title, const char* content, bool isError);
|
||||
|
||||
|
||||
@@ -15,11 +15,15 @@
|
||||
|
||||
#define HAMMY_CALLSIGN_MAX 32
|
||||
#define HAMMY_ENTITY_NAME_MAX 64
|
||||
// Longest code in the morse table is '$' ('...-..-'), seven characters.
|
||||
#define HAMMY_MORSE_MAX 16
|
||||
|
||||
struct hammy_refdb_t {
|
||||
sqlite3* handle;
|
||||
sqlite3_stmt* stExact;
|
||||
sqlite3_stmt* stPrefix;
|
||||
sqlite3_stmt* stMorse;
|
||||
char morseCode[HAMMY_MORSE_MAX]; // Scratch for the last hammy_refdb_get_morse() hit
|
||||
char version[64];
|
||||
};
|
||||
|
||||
@@ -52,6 +56,13 @@ bool hammy_refdb_close(hammy_refdb_t** db);
|
||||
//
|
||||
// Returns false if nothing matched.
|
||||
bool hammy_refdb_dxcc(hammy_refdb_t* db, const char* callsign, hammy_dxcc_t* out);
|
||||
|
||||
// Looks up a character in the Morse table. Case-insensitive; non-ASCII bytes
|
||||
// never match. Returns false if not found, leaving *out untouched.
|
||||
//
|
||||
// On a hit *out points at storage owned by the refdb and is only valid until
|
||||
// the NEXT call on the same handle - copy it if it has to outlive that.
|
||||
bool hammy_refdb_get_morse(hammy_refdb_t* db, char c, const char** out);
|
||||
|
||||
// Bundle version string from ref_meta, or NULL. Owned by the refdb.
|
||||
const char* hammy_refdb_version(hammy_refdb_t* db);
|
||||
|
||||
Reference in New Issue
Block a user