miscellaneous..

master
bqv 3 years ago
parent 74b6edbfb5
commit da70b29ced
No known key found for this signature in database
GPG Key ID: 9E2FF3BDEBDFC910

@ -169,6 +169,7 @@
* [ ] [#D] OTR (libotr)
* [ ] [#C] Room Explorer (https://search.jabber.network/docs/api)
* [ ] [#C] DOAP
* [ ] [#C] Link sniffing for oob
** TODO [#C] Adhere to CCS2022 (XEP-459) (milestone v0.3)
* [ ] Core
* [ ] Service Discovery (xep-030)

@ -753,7 +753,7 @@ int account__timer_cb(const void *pointer, void *data, int remaining_calls)
(void) data;
(void) remaining_calls;
try
//try
{
struct t_account *ptr_account;
@ -776,9 +776,10 @@ int account__timer_cb(const void *pointer, void *data, int remaining_calls)
return WEECHAT_RC_OK;
}
catch (const std::exception& ex)
{
__asm__("int3");
return WEECHAT_RC_ERROR;
}
//catch (const std::exception& ex)
//{
// auto what = ex.what();
// __asm__("int3");
// return WEECHAT_RC_ERROR;
//}
}

@ -104,15 +104,14 @@ int connection__presence_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void
clientid = fmt::format("{}#{}", node, ver);
std::string to = binding.to ? binding.to->full : "";
char *uuid = xmpp_uuid_gen(account->context);
xmpp_stanza_t *children[2] = {NULL};
children[0] = stanza__iq_pubsub_items(account->context, NULL,
const_cast<char*>("eu.siacs.conversations.axolotl.devicelist"));
children[0] = stanza__iq_pubsub(account->context, NULL,
children, with_noop("http://jabber.org/protocol/pubsub"));
children[0] = stanza__iq_query(account->context, NULL,
with_noop("http://jabber.org/protocol/disco#info"), NULL);
children[0] = stanza__iq(account->context, NULL, children, NULL,
strdup("fetch2"), to.size() ? strdup(to.data()) : NULL,
binding.from->bare.size() ? strdup(binding.from->bare.data()) : NULL, strdup("get"));
uuid, to.size() ? strdup(to.data()) : NULL,
binding.from ? strdup(binding.from->full.data()) : NULL, strdup("get"));
xmpp_send(conn, children[0]);
xmpp_stanza_release(children[0]);
}
@ -123,12 +122,13 @@ int connection__presence_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void
channel = channel__new(account, CHANNEL_TYPE_PM, binding.from->bare.data(), binding.from->bare.data());
}
if (binding.type && *binding.type == "error" && binding.muc() && channel)
if (binding.type && *binding.type == "error" && channel)
{
if (auto error = binding.error())
{
weechat_printf(channel->buffer, "%sError joining MUC: %s",
weechat_prefix("network"), error->reason());
weechat_printf(channel->buffer, "[!]\t%s%sError: %s",
weechat_color("gray"),
binding.muc() ? "MUC " : "", error->reason());
}
return 1;
}
@ -972,6 +972,37 @@ int connection__iq_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userd
if (weechat_strcasecmp(type, "result") == 0)
{
xmpp_stanza_t *identity = xmpp_stanza_get_child_by_name(query, "identity");
std::string category;
std::string name;
std::string type;
if (const char *attr = xmpp_stanza_get_attribute(identity, "category"))
category = attr;
if (const char *attr = xmpp_stanza_get_attribute(identity, "name"))
name = attr;
if (const char *attr = xmpp_stanza_get_attribute(identity, "type"))
type = attr;
if (category == "conference")
{
struct t_channel *ptr_channel = channel__search(account, from);
weechat_printf(ptr_channel ? ptr_channel->buffer : nullptr, "%sname = %s",
weechat_prefix("network"), name.data());
}
else if (category == "conference")
{
xmpp_stanza_t *children[2] = {NULL};
children[0] = stanza__iq_pubsub_items(account->context, NULL,
const_cast<char*>("eu.siacs.conversations.axolotl.devicelist"));
children[0] = stanza__iq_pubsub(account->context, NULL,
children, with_noop("http://jabber.org/protocol/pubsub"));
children[0] = stanza__iq(account->context, NULL, children, NULL,
strdup("fetch2"), to.size() ? strdup(to.data()) : NULL,
binding.from ? strdup(binding.from->bare.data()) : NULL, strdup("get"));
xmpp_send(conn, children[0]);
xmpp_stanza_release(children[0]);
}
}
}
@ -1139,6 +1170,21 @@ int connection__iq_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userd
intext = xmpp_stanza_get_text(text);
}
{
xmpp_stanza_t *children[2] = {0};
char *uuid = xmpp_uuid_gen(account->context);
children[0] = stanza__iq_query(account->context, NULL,
with_noop("http://jabber.org/protocol/disco#info"), NULL);
children[0] =
stanza__iq(account->context, NULL, children,
NULL, uuid,
strdup(to), strdup(jid),
strdup("get"));
xmpp_send(conn, children[0]);
xmpp_stanza_release(children[0]);
}
if (weechat_strcasecmp(autojoin, "true") == 0)
{
char **command = weechat_string_dyn_alloc(256);

@ -91,13 +91,14 @@ all:
make weechat-xmpp && make test
weechat-xmpp: $(DEPS) xmpp.so
release: xmpp.so
cp xmpp.so .xmpp.so.$(SUFFIX)
ln -sf .xmpp.so.$(SUFFIX) .xmpp.so
xmpp.so: $(OBJS) $(DEPS) $(HDRS)
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(DEPS) $(LDLIBS)
git ls-files | xargs ls -d | xargs tar cz | objcopy --add-section .source=/dev/stdin xmpp.so
#objcopy --dump-section .source=/dev/stdout xmpp.so | tar tz
cp xmpp.so .xmpp.so.$(SUFFIX)
ln -sf .xmpp.so.$(SUFFIX) .xmpp.so
.%.o: %.c
$(eval GIT_REF=$(shell git describe --abbrev=6 --always --dirty 2>/dev/null || true))
@ -184,7 +185,7 @@ else
chmod 755 ~/.weechat/plugins/xmpp.so
endif
.PHONY: all weechat-xmpp test debug depend tidy clean distclean install check
.PHONY: all weechat-xmpp release test debug depend tidy clean distclean install check
check:
clang-check --analyze *.c *.cc *.cpp

@ -219,7 +219,7 @@ namespace xml {
class error { // THIS IS RFC 6120 :(
private:
enum condition : int {
enum condition {
not_authorized,
registration_required,
forbidden,
@ -306,25 +306,26 @@ namespace xml {
std::optional<std::string> description;
const char* reason() {
switch (condition)
{
case not_authorized:
return "Password Required";
case forbidden:
return "Banned";
case item_not_found:
return "No such MUC";
case not_allowed:
return "MUC Creation Failed";
case not_acceptable:
return "Unacceptable Nickname";
case registration_required:
return "Not on Member List";
case conflict:
return "Nickname Conflict";
case service_unavailable:
return "Service Unavailable (MUC Full?)";
}
if (condition)
switch (*condition)
{
case not_authorized:
return "Password Required";
case forbidden:
return "Banned";
case item_not_found:
return "No such MUC";
case not_allowed:
return "MUC Creation Failed";
case not_acceptable:
return "Unacceptable Nickname";
case registration_required:
return "Not on Member List";
case conflict:
return "Nickname Conflict";
case service_unavailable:
return "Service Unavailable (MUC Full?)";
}
return "Unspecified";
}
};

Loading…
Cancel
Save