mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-27 20:46:21 +00:00
Added basic SHA-1 hash of capabilities
This commit is contained in:
23
src/jabber.c
23
src/jabber.c
@@ -24,6 +24,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <openssl/sha.h>
|
||||||
#include <strophe.h>
|
#include <strophe.h>
|
||||||
|
|
||||||
#include "capabilities.h"
|
#include "capabilities.h"
|
||||||
@@ -179,6 +180,28 @@ jabber_disconnect(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
jabber_get_sha1_caps_str(void)
|
||||||
|
{
|
||||||
|
GString *str = g_string_new("");
|
||||||
|
unsigned char hash[SHA_DIGEST_LENGTH];
|
||||||
|
|
||||||
|
g_string_append(str, "client/pc//Profanity ");
|
||||||
|
g_string_append(str, PACKAGE_VERSION);
|
||||||
|
if (strcmp(PACKAGE_STATUS, "development") == 0) {
|
||||||
|
g_string_append(str, "dev");
|
||||||
|
}
|
||||||
|
g_string_append(str, "<");
|
||||||
|
|
||||||
|
SHA1((unsigned char *)str->str, strlen(str->str), hash);
|
||||||
|
|
||||||
|
char *result = g_base64_encode(hash, strlen((char *)hash));
|
||||||
|
|
||||||
|
g_string_free(str, TRUE);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
jabber_process_events(void)
|
jabber_process_events(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,5 +81,6 @@ char * jabber_get_status(void);
|
|||||||
void jabber_free_resources(void);
|
void jabber_free_resources(void);
|
||||||
void jabber_restart(void);
|
void jabber_restart(void);
|
||||||
void jabber_set_autoping(int seconds);
|
void jabber_set_autoping(int seconds);
|
||||||
|
char * jabber_get_sha1_caps_str(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user