better version and editing

master
bqv 2 years ago
parent 9d18695965
commit 57c43aa423
No known key found for this signature in database
GPG Key ID: 9E2FF3BDEBDFC910

@ -52,6 +52,7 @@
- lmdb (dynamic, dependency) - lmdb (dynamic, dependency)
- libomemo-c (libsignal-protocol-c) (dynamic, dependency) - libomemo-c (libsignal-protocol-c) (dynamic, dependency)
- rnp (dynamic, dependency) - rnp (dynamic, dependency)
- gpgme (dynamic, dependency)
- weechat (>= v3.0) - weechat (>= v3.0)
.. or just use the guix spec in .envrc .. or just use the guix spec in .envrc
@ -96,7 +97,7 @@
* [-] OOB messages * [-] OOB messages
* [X] Single media on a line * [X] Single media on a line
* [ ] Multiple media inline (protocol?) * [ ] Multiple media inline (protocol?)
* [ ] Encrypted (pgp/omemo) * [ ] [#D] Encrypted (pgp/omemo)
* [X] Buffer autoswitch on enter/open * [X] Buffer autoswitch on enter/open
* [X] Handle open/enter jids with a resource without breaking * [X] Handle open/enter jids with a resource without breaking
* [X] Allow /close without crashing * [X] Allow /close without crashing
@ -113,7 +114,7 @@
* [-] [#B] Edits * [-] [#B] Edits
* [X] [#B] Displaying * [X] [#B] Displaying
* [X] [#B] Tagging * [X] [#B] Tagging
* [ ] [#B] Making * [ ] [#B] Making (/edit)
* [X] [#C] Diff highlighting * [X] [#C] Diff highlighting
* [ ] [#B] Handle errors gracefully * [ ] [#B] Handle errors gracefully
* [X] [#B] Presence/nicklist * [X] [#B] Presence/nicklist
@ -145,9 +146,14 @@
* [X] Message Delivery (XEP-0184) * [X] Message Delivery (XEP-0184)
* [X] Message Carbons * [X] Message Carbons
* [ ] Service Disco * [ ] Service Disco
* [ ] /disco [domain]
* [ ] /whois [user|muc]
* [ ] User Avatars
* [ ] MUC Icons
* [X] MAM Fetching * [X] MAM Fetching
* [-] Bookmarks / Roster * [-] Bookmarks / Roster
* [X] Autojoin bookmarks * [X] Autojoin bookmarks
* [ ] Except biboumi rooms
* [ ] Add bookmarks * [ ] Add bookmarks
* [ ] Delete bookmarks * [ ] Delete bookmarks
* [ ] Roster * [ ] Roster
@ -158,8 +164,10 @@
* [X] Decryption * [X] Decryption
* [X] Encryption * [X] Encryption
* [X] Custom set/clear key (/pgp) * [X] Custom set/clear key (/pgp)
* [ ] Save pgp key set per jid/muc
* [ ] GPGME
* [ ] Room Explorer (https://search.jabber.network/docs/api) * [ ] Room Explorer (https://search.jabber.network/docs/api)
** TODO [#C] Implement completion engine (milestone v0.3) ** TODO [#C] Adhere to CCS (milestone v0.3)
** TODO [#D] Close all issues (milestone v1.0) ** TODO [#D] Close all issues (milestone v1.0)
* Contributing * Contributing

@ -201,8 +201,12 @@ struct t_gui_buffer *channel__create_buffer(struct t_account *account,
account_option_set(account, ACCOUNT_OPTION_NICKNAME, account_option_set(account, ACCOUNT_OPTION_NICKNAME,
xmpp_jid_node(account->context, account_jid(account))); xmpp_jid_node(account->context, account_jid(account)));
// Set notify level for buffer: "0" = never add to hotlist
// "1" = add for highlights only
// "2" = add for highlights and messages
// "3" = add for all messages.
weechat_buffer_set(ptr_buffer, "notify", weechat_buffer_set(ptr_buffer, "notify",
(type == CHANNEL_TYPE_PM) ? "3" : "1"); (type == CHANNEL_TYPE_PM) ? "3" : "2");
weechat_buffer_set(ptr_buffer, "localvar_set_type", weechat_buffer_set(ptr_buffer, "localvar_set_type",
(type == CHANNEL_TYPE_PM) ? "private" : "channel"); (type == CHANNEL_TYPE_PM) ? "private" : "channel");
weechat_buffer_set(ptr_buffer, "localvar_set_nick", weechat_buffer_set(ptr_buffer, "localvar_set_nick",

@ -906,6 +906,26 @@ int command__xml(const void *pointer, void *data,
return WEECHAT_RC_OK; return WEECHAT_RC_OK;
} }
int command__xmpp(const void *pointer, void *data,
struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
struct t_account *ptr_account = NULL;
struct t_channel *ptr_channel = NULL;
xmpp_stanza_t *stanza;
(void) pointer;
(void) data;
(void) argv;
weechat_printf(nullptr,
_("%s%s %s [%s]"),
weechat_prefix("info"), WEECHAT_XMPP_PLUGIN_NAME,
WEECHAT_XMPP_PLUGIN_VERSION, XMPP_PLUGIN_COMMIT);
return WEECHAT_RC_OK;
}
void command__init() void command__init()
{ {
struct t_hook *hook; struct t_hook *hook;
@ -1015,4 +1035,13 @@ void command__init()
NULL, &command__xml, NULL, NULL); NULL, &command__xml, NULL, NULL);
if (!hook) if (!hook)
weechat_printf(NULL, "Failed to setup command /xml"); weechat_printf(NULL, "Failed to setup command /xml");
hook = weechat_hook_command(
"xmpp",
N_("get xmpp plugin version"),
N_(""),
N_(""),
NULL, &command__xmpp, NULL, NULL);
if (!hook)
weechat_printf(NULL, "Failed to setup command /xmpp");
} }

@ -156,16 +156,21 @@ int connection__presence_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void
case 210: // Nick Modified: [presence | Entering a room]: Inform user that the service has assigned or modified the occupant's roomnick case 210: // Nick Modified: [presence | Entering a room]: Inform user that the service has assigned or modified the occupant's roomnick
break; break;
case 301: // : [presence | Removal from room]: Inform user that he or she has been banned from the room case 301: // : [presence | Removal from room]: Inform user that he or she has been banned from the room
weechat_printf(channel->buffer, "[!]\t%sBanned from Room", weechat_color("gray"));
break; break;
case 303: // : [presence | Exiting a room]: Inform all occupants of new room nickname case 303: // : [presence | Exiting a room]: Inform all occupants of new room nickname
break; break;
case 307: // : [presence | Removal from room]: Inform user that he or she has been kicked from the room case 307: // : [presence | Removal from room]: Inform user that he or she has been kicked from the room
weechat_printf(channel->buffer, "[!]\t%sKicked from room", weechat_color("gray"));
break; break;
case 321: // : [presence | Removal from room]: Inform user that he or she is being removed from the room because of an affiliation change case 321: // : [presence | Removal from room]: Inform user that he or she is being removed from the room because of an affiliation change
weechat_printf(channel->buffer, "[!]\t%sRoom Affiliation changed, kicked", weechat_color("gray"));
break; break;
case 322: // : [presence | Removal from room]: Inform user that he or she is being removed from the room because the room has been changed to members-only and the user is not a member case 322: // : [presence | Removal from room]: Inform user that he or she is being removed from the room because the room has been changed to members-only and the user is not a member
weechat_printf(channel->buffer, "[!]\t%sRoom now members-only, kicked", weechat_color("gray"));
break; break;
case 332: // : [presence | Removal from room]: Inform user that he or she is being removed from the room because of a system shutdown case 332: // : [presence | Removal from room]: Inform user that he or she is being removed from the room because of a system shutdown
weechat_printf(channel->buffer, "[!]\t%sRoom Shutdown", weechat_color("gray"));
break; break;
default: default:
break; break;
@ -618,6 +623,8 @@ int connection__message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *
{ {
char **visual = weechat_string_dyn_alloc(256); char **visual = weechat_string_dyn_alloc(256);
char ch[2] = {0}; char ch[2] = {0};
int retention = 0;
int modification = 0;
for (size_t i = 0; i < result.sessz; i++) for (size_t i = 0; i < result.sessz; i++)
switch (result.ses[i].type) switch (result.ses[i].type)
@ -626,11 +633,13 @@ int connection__message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *
weechat_string_dyn_concat(visual, weechat_color("green"), -1); weechat_string_dyn_concat(visual, weechat_color("green"), -1);
*ch = *(const char *)result.ses[i].e; *ch = *(const char *)result.ses[i].e;
weechat_string_dyn_concat(visual, ch, -1); weechat_string_dyn_concat(visual, ch, -1);
modification++;
break; break;
case DIFF_DELETE: case DIFF_DELETE:
weechat_string_dyn_concat(visual, weechat_color("red"), -1); weechat_string_dyn_concat(visual, weechat_color("red"), -1);
*ch = *(const char *)result.ses[i].e; *ch = *(const char *)result.ses[i].e;
weechat_string_dyn_concat(visual, ch, -1); weechat_string_dyn_concat(visual, ch, -1);
modification++;
break; break;
case DIFF_COMMON: case DIFF_COMMON:
default: default:
@ -638,11 +647,24 @@ int connection__message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *
*ch = *(const char *)result.ses[i].e; *ch = *(const char *)result.ses[i].e;
weechat_string_dyn_concat(visual, ch, -1); weechat_string_dyn_concat(visual, ch, -1);
retention++;
break; break;
} }
free(result.ses); free(result.ses);
free(result.lcs); free(result.lcs);
if ((modification > 20) && (modification > retention)) {
weechat_string_dyn_free(visual, 1);
visual = weechat_string_dyn_alloc(256);
weechat_string_dyn_concat(visual, weechat_color("red"), -1);
if (strlen(orig) >= 16) {
weechat_string_dyn_concat(visual, orig, 16);
weechat_string_dyn_concat(visual, "...", -1);
} else
weechat_string_dyn_concat(visual, orig, -1);
weechat_string_dyn_concat(visual, weechat_color("green"), -1);
weechat_string_dyn_concat(visual, text, -1);
}
difftext = strdup(*visual); difftext = strdup(*visual);
weechat_string_dyn_free(visual, 1); weechat_string_dyn_free(visual, 1);
} }

@ -8,6 +8,7 @@ FIND=find
INCLUDES=-Ilibstrophe -Ideps -Ideps/fmt/include \ INCLUDES=-Ilibstrophe -Ideps -Ideps/fmt/include \
$(shell xml2-config --cflags) \ $(shell xml2-config --cflags) \
$(shell pkg-config --cflags gpgme) \
$(shell pkg-config --cflags librnp) \ $(shell pkg-config --cflags librnp) \
$(shell pkg-config --cflags libsignal-protocol-c) $(shell pkg-config --cflags libsignal-protocol-c)
CFLAGS+=$(DBGCFLAGS) \ CFLAGS+=$(DBGCFLAGS) \
@ -34,6 +35,7 @@ LDFLAGS+=$(DBGLDFLAGS) \
LDLIBS=-lstrophe \ LDLIBS=-lstrophe \
-lpthread \ -lpthread \
$(shell xml2-config --libs) \ $(shell xml2-config --libs) \
$(shell pkg-config --libs gpgme) \
$(shell pkg-config --libs librnp) \ $(shell pkg-config --libs librnp) \
$(shell pkg-config --libs libsignal-protocol-c) \ $(shell pkg-config --libs libsignal-protocol-c) \
-lgcrypt \ -lgcrypt \
@ -94,10 +96,12 @@ xmpp.so: $(OBJS) $(DEPS) $(HDRS)
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(DEPS) $(LDLIBS) $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(DEPS) $(LDLIBS)
.%.o: %.c .%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@ $(eval GIT_REF=$(shell git describe --abbrev=6 --always --dirty 2>/dev/null || true))
$(CC) -DGIT_COMMIT=$(GIT_REF) $(CFLAGS) -c $< -o $@
.%.o: %.cpp .%.o: %.cpp
$(CXX) $(CPPFLAGS) -c $< -o $@ $(eval GIT_REF=$(shell git describe --abbrev=6 --always --dirty 2>/dev/null || true))
$(CXX) -DGIT_COMMIT=$(GIT_REF) $(CPPFLAGS) -c $< -o $@
.%.cov.o: %.cpp .%.cov.o: %.cpp
@$(CXX) --coverage $(CPPFLAGS) -O0 -c $< -o $@ @$(CXX) --coverage $(CPPFLAGS) -O0 -c $< -o $@

@ -4,9 +4,17 @@
#pragma once #pragma once
#define STR(X) #X
#define XSTR(X) STR(X)
#define weechat_plugin weechat_xmpp_plugin #define weechat_plugin weechat_xmpp_plugin
#define WEECHAT_XMPP_PLUGIN_NAME "xmpp" #define WEECHAT_XMPP_PLUGIN_NAME "xmpp"
#ifdef GIT_COMMIT
#define XMPP_PLUGIN_COMMIT XSTR(GIT_COMMIT)
#define WEECHAT_XMPP_PLUGIN_VERSION "0.2.0@" XMPP_PLUGIN_COMMIT
#else//GIT_COMMIT
#define XMPP_PLUGIN_COMMIT "unknown"
#define WEECHAT_XMPP_PLUGIN_VERSION "0.2.0" #define WEECHAT_XMPP_PLUGIN_VERSION "0.2.0"
#endif//GIT_COMMIT
#define TIMER_INTERVAL_SEC 0.01 #define TIMER_INTERVAL_SEC 0.01
extern struct t_weechat_plugin *weechat_xmpp_plugin; extern struct t_weechat_plugin *weechat_xmpp_plugin;

Loading…
Cancel
Save