Aaaaaaaaaaaaaaaaaaaa

Ihateslackihateslackihateslack
v1
Tony Olagbaiye 6 years ago
parent dc0c43c80c
commit f590ef7635
No known key found for this signature in database
GPG Key ID: 7420820577A31D11

@ -17,7 +17,7 @@
[[https://github.com/bqv/weechat-slack/blob/master/LICENSE][file:https://img.shields.io/github/license/bqv/weechat-slack.svg]]
[[https://github.com/bqv/weechat-extras/][file:https://img.shields.io/badge/weechat--extras-slack-blue.svg]]
| Status: | Under Development |
| Status: | Aaaaaaaaaaaaaaaaa |
| Location: | [[http://github.com/bqv/weechat-slack]] |
| Version: | 0.1.5 |
| Disclaimer: | Slack's API is a thing of horror |
@ -79,7 +79,6 @@
** TODO [#A] Implement essential api endpoints and events (milestone v0.2)
- [X] +Implement handling api message =message.me_message= (see [[http://github.com/bqv/weechat-slack/issues/5][#5]])+
- [X] +Implement sending request =chat.meMessage= (see [[http://github.com/bqv/weechat-slack/issues/5][#5]])+
- [ ] Implement handling api message =message.thread_broadcast=
- [X] +Implement handling api message =message.bot_message= (see [[http://github.com/bqv/weechat-slack/issues/2][#2]])+
- [ ] Implement handling api message =message.message_changed=
- [ ] Implement handling api message =message.message_deleted=
@ -94,7 +93,9 @@
- [ ] Sort nick-completion by recent speakers (see [[http://github.com/bqv/weechat-slack/issues/4][#4]])
** TODO [#B] Implement websocket ping and pong (milestone v0.4)
- [ ] Add ping timer and pong handler (see [[http://github.com/bqv/weechat-slack/issues/9][#9]])
** TODO [#C] Implement remaining api endpoints and events (milestone v0.5)
** TODO [#B] Implement thread handling (milestone v0.5)
- [ ] Implement handling api message =message.thread_broadcast=
** TODO [#C] Implement remaining api endpoints and events (milestone v0.6)
- [ ] Support all channel types
- [X] +Channels+
- [ ] Groups
@ -102,7 +103,7 @@
- [ ] IMs
- [ ] Complete api endpoint set
- [ ] Complete api event set
** TODO [#C] Implement full weechat functionality (milestone v0.6)
** TODO [#C] Implement full weechat functionality (milestone v0.7)
- [ ] Hook buffer closes
- [ ] Relay compatibility
- [ ] Config Options

@ -0,0 +1,104 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, version 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <json.h>
#include <string.h>
#include "../../weechat-plugin.h"
#include "../../slack.h"
#include "../../slack-workspace.h"
#include "../../slack-message.h"
#include "../../slack-api.h"
#include "../../slack-channel.h"
#include "../../slack-user.h"
#include "../slack-api-message.h"
#include "slack-api-message-message-changed.h"
static const char *subtype = "message_changed";
static inline int json_valid(json_object *object, struct t_slack_workspace *workspace)
{
if (!object)
{
weechat_printf(
workspace->buffer,
_("%s%s: error handling websocket %smessage.%s%s message: "
"unexpected response from server"),
weechat_prefix("error"), SLACK_PLUGIN_NAME,
weechat_color("chat_value"), subtype, weechat_color("reset"));
return 0;
}
return 1;
}
int slack_api_message_message_changed_handle(struct t_slack_workspace *workspace,
json_object *root, const char *user,
const char *text, const char *ts)
{
struct t_slack_channel *ptr_channel;
struct t_slack_user *ptr_user;
struct t_slack_channel_typing *ptr_typing;
/*
ptr_channel = slack_channel_search(workspace, channel);
if (!ptr_channel)
return 1; // silently ignore if channel hasn't been loaded yet
ptr_user = slack_user_search(workspace, user);
if (!ptr_user)
return 1; // silently ignore if user hasn't been loaded yet
char *message = slack_message_decode(workspace, text);
weechat_printf_date_tags(
ptr_channel->buffer,
(time_t)atof(ts),
"slack_message,slack_thread_broadcast",
_("%s%s"),
slack_user_as_prefix(workspace, ptr_user, NULL),
message);
free(message);
ptr_typing = slack_channel_typing_search(ptr_channel,
ptr_user->profile.display_name);
if (ptr_typing)
{
slack_channel_typing_free(ptr_channel, ptr_typing);
slack_channel_typing_cb(ptr_channel, NULL, 0);
}
*/
return 1;
}
int slack_api_message_message_changed(struct t_slack_workspace *workspace,
json_object *message)
{
json_object *channel, *oldmsg, *user, *text, *ts;
channel = json_object_object_get(message, "channel");
if (!json_valid(channel, workspace))
return 0;
oldmsg = json_object_object_get(message, "message");
if (!json_valid(oldmsg, workspace))
return 0;
user = json_object_object_get(oldmsg, "user");
if (!json_valid(user, workspace))
return 0;
text = json_object_object_get(message, "text");
if (!json_valid(text, workspace))
return 0;
ts = json_object_object_get(message, "ts");
if (!json_valid(ts, workspace))
return 0;
return slack_api_message_message_changed_handle(workspace,
json_object_get_string(channel),
json_object_get_string(user),
json_object_get_string(text),
json_object_get_string(ts));
}

@ -0,0 +1,12 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, version 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef _SLACK_API_MESSAGE_MESSAGE_CHANGED_H_
#define _SLACK_API_MESSAGE_MESSAGE_CHANGED_H_
int slack_api_message_message_changed(
struct t_slack_workspace *workspace,
json_object *message);
#endif /*SLACK_API_MESSAGE_MESSAGE_CHANGED_H*/

@ -13,7 +13,7 @@
#include "../../slack-channel.h"
#include "../../slack-user.h"
#include "../slack-api-message.h"
#include "slack-api-message-thread_broadcast.h"
#include "slack-api-message-thread-broadcast.h"
static const char *subtype = "thread_broadcast";
Loading…
Cancel
Save