Merge 8845e9235b
into 8848289491
This commit is contained in:
commit
0833946905
|
@ -39,7 +39,7 @@ static void discord_handle_voice_state(struct im_connection *ic,
|
|||
user_info *uinfo = get_user(dd, json_o_str(vsinfo, "user_id"), server_id,
|
||||
SEARCH_ID);
|
||||
|
||||
if (uinfo == NULL || g_strcmp0(uinfo->id, dd->id) == 0) {
|
||||
if (uinfo == NULL || uinfo->id == dd->id) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ static void discord_handle_user(struct im_connection *ic, json_value *uinfo,
|
|||
if (bu != NULL) {
|
||||
ui = g_new0(user_info, 1);
|
||||
ui->user = bu;
|
||||
ui->id = g_strdup(id);
|
||||
parse_int64((char *) id, 10, &ui->id);
|
||||
ui->name = g_strdup(name);
|
||||
ui->flags = flags;
|
||||
|
||||
|
@ -741,7 +741,9 @@ void discord_handle_message(struct im_connection *ic, json_value *minfo,
|
|||
if (posted) {
|
||||
if (msgid > cinfo->last_read) {
|
||||
cinfo->last_read = msgid;
|
||||
if (g_strcmp0(json_o_str(json_o_get(minfo, "author"), "id"), dd->id)) {
|
||||
guint64 num;
|
||||
if (parse_int64((char *) json_o_str(json_o_get(minfo, "author"), "id"), 10, &num) &&
|
||||
num != dd->id) {
|
||||
discord_http_send_ack(ic, cinfo->id, json_o_str(minfo, "id"));
|
||||
}
|
||||
}
|
||||
|
@ -848,7 +850,7 @@ gboolean discord_parse_message(struct im_connection *ic, gchar *buf, guint64 siz
|
|||
|
||||
json_value *user = json_o_get(data, "user");
|
||||
if (user != NULL && user->type == json_object) {
|
||||
dd->id = json_o_strdup(user, "id");
|
||||
parse_int64((char *) json_o_str(user, "id"), 10, &dd->id);
|
||||
dd->uname = discord_canonize_name(json_o_str(user, "username"));
|
||||
}
|
||||
dd->session_id = json_o_strdup(data, "session_id");
|
||||
|
|
|
@ -427,7 +427,7 @@ static gboolean discord_mentions_string(const GMatchInfo *match,
|
|||
g_free(name);
|
||||
|
||||
if (uinfo != NULL) {
|
||||
gchar *id = g_strdup_printf("<@%s>", uinfo->id);
|
||||
gchar *id = g_strdup_printf("<@%" G_GUINT64_FORMAT ">", uinfo->id);
|
||||
result = g_string_append(result, id);
|
||||
g_free(id);
|
||||
} else {
|
||||
|
@ -678,8 +678,8 @@ void discord_http_create_and_send_msg(struct im_connection *ic,
|
|||
GString *request = g_string_new("");
|
||||
GString *content = g_string_new("");
|
||||
|
||||
g_string_printf(content, "{\"recipient_id\":\"%s\"}", uinfo->id);
|
||||
g_string_printf(request, "POST /api/users/%s/channels HTTP/1.1\r\n"
|
||||
g_string_printf(content, "{\"recipient_id\":\"%" G_GUINT64_FORMAT "\"}", uinfo->id);
|
||||
g_string_printf(request, "POST /api/users/%" G_GUINT64_FORMAT "/channels HTTP/1.1\r\n"
|
||||
"Host: %s\r\n"
|
||||
"User-Agent: Bitlbee-Discord\r\n"
|
||||
"authorization: %s\r\n"
|
||||
|
|
|
@ -42,7 +42,6 @@ void discord_debug(char *format, ...)
|
|||
void free_user_info(user_info *uinfo)
|
||||
{
|
||||
g_free(uinfo->name);
|
||||
g_free(uinfo->id);
|
||||
g_free(uinfo);
|
||||
}
|
||||
|
||||
|
@ -123,7 +122,6 @@ void free_discord_data(discord_data *dd)
|
|||
g_free(dd->token);
|
||||
g_free(dd->uname);
|
||||
g_free(dd->session_id);
|
||||
g_free(dd->id);
|
||||
|
||||
g_free(dd);
|
||||
}
|
||||
|
@ -179,9 +177,9 @@ static gint cmp_chan_name_ignorecase(const channel_info *cinfo,
|
|||
return result;
|
||||
}
|
||||
|
||||
static gint cmp_user_id(const user_info *uinfo, const char *user_id)
|
||||
static gint cmp_user_id(const user_info *uinfo, guint64 *user_id)
|
||||
{
|
||||
return g_strcmp0(uinfo->id, user_id);
|
||||
return uinfo->id == *user_id;
|
||||
}
|
||||
|
||||
static gint cmp_user_name(const user_info *uinfo, const char *uname)
|
||||
|
|
|
@ -55,7 +55,7 @@ typedef struct _gw_data {
|
|||
|
||||
typedef struct _discord_data {
|
||||
char *token;
|
||||
char *id;
|
||||
guint64 id;
|
||||
char *session_id;
|
||||
char *uname;
|
||||
char *nonce;
|
||||
|
@ -116,7 +116,7 @@ typedef struct _channel_info {
|
|||
} channel_info;
|
||||
|
||||
typedef struct _user_info {
|
||||
char *id;
|
||||
guint64 id;
|
||||
char *name;
|
||||
channel_info *voice_channel;
|
||||
bee_user_t *user;
|
||||
|
|
Loading…
Reference in New Issue