1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00
Commit Graph

370 Commits

Author SHA1 Message Date
Paul Fariello
84506cbaeb Use OMEMO for offline MUC members (#1242) 2020-01-20 14:28:13 +01:00
Michael Vetter
be13e98fe7 Update my Copyright to 2020 2020-01-03 19:52:31 +01:00
Michael Vetter
771dfab123 Start implementing XEP-0084
So far we just subscribe and get the IDs.
2019-12-18 10:17:10 +01:00
Michael Vetter
3bb2e07c1e Use helper function to clean incoming messages
We might want to use utf8proc or something to normalize utf8 strings
later?
2019-12-13 13:42:43 +01:00
Michael Vetter
46fd7150e5 Add vim modeline 2019-11-13 12:11:05 +01:00
Michael Vetter
87f9bacffa Filter RTL unicode characters out
Gajim sends \u200E and \u200F for RTL.
It is planned that Gajim stops doing this and uses some GTK feature to
get the same result.

However users expressed the whish that we filter out such characters in
incoming messages before displaying them to make Profanity more robust.

I'm still not sure whether I like the solution because it means a lot of
allocating/deallocating upon every new message.

Fix https://github.com/profanity-im/profanity/issues/1220
2019-11-13 09:39:07 +01:00
Michael Vetter
f71de61b9d Don't override ProfMessage Id with origin-id
Profanity sends the same value for both. Other clients might not.
Safe both since we could need them later.

Once we implement Last Message Correction we will need the regular id.
If we override it with origin-id and another client chooses to not use
the same value for id and origin-id then we can't interpret the id sent
with the LMC request correctly.
2019-10-31 13:45:44 +01:00
Michael Vetter
aa0c638394 Update chat_log_pgp_msg_out() usage
Fix build
2019-10-29 15:20:24 +01:00
Michael Vetter
5a0a6c97e2 Two carbon logging changes
Add resourcepart to the outgoing carbon that is logged, so we use the
correct filenames for MUC PMs.

Dont log incoming carbons of MUC PMs as a workaround to faulty server
behaviour.

See https://wiki.xmpp.org/web/Multi-Session_Nicks#Private_Messages under
'Client-side workaround behavior'.

Regards https://github.com/profanity-im/profanity/issues/1214
2019-10-29 11:46:01 +01:00
Michael Vetter
9788410aaf Also log sv_ev_delayed_private_message 2019-10-29 10:52:11 +01:00
Michael Vetter
8c8c18c6fd Actually log MUC PM messages
If I'm not mistaken MUC PMs have not been logged at all if there was no
other client sending carbons.
This should add MUC PM logging functionality.

We still need to make sure carbons log to the same file.

Regards https://github.com/profanity-im/profanity/issues/1214
2019-10-28 23:36:42 +01:00
Michael Vetter
31014b5e51 Fix which message we want to log 2019-10-19 23:24:33 +02:00
Michael Vetter
06f300a42c Move message sent by us logic in own function 2019-10-18 14:50:25 +02:00
Michael Vetter
dfead6415f sv_ev_room_message: log in all cases if not our client
Forgot to check what happens if the length is <= 10.
2019-10-18 11:59:39 +02:00
Michael Vetter
f7474cd72c sv_ev_room_message: check if message->id is not NULL 2019-10-18 11:43:30 +02:00
Michael Vetter
5c6f5ba0f7 Add connection_get_profanity_identifier stub
And move defintion to xmpp.h
2019-10-18 11:23:30 +02:00
Michael Vetter
430b2eaa0d Log incoming MUC messages if origin-id sais they dont come from us
Regards https://github.com/profanity-im/profanity/issues/1201
2019-10-18 10:40:24 +02:00
Michael Vetter
147be3afdf Don't log own messages on incoming MUC
`sv_ev_room_message()` called `groupchat_log_msg_in()` to log all
incoming MUC messages.

`cl_ev_send_muc_msg()` calls `groupchat_log_msg_out()`.

So messages sent by the user himself was logged two times.

Filter the incoming messages and only log the ones not from our occupant
jid/nick.

Fix https://github.com/profanity-im/profanity/issues/1201
2019-10-06 22:32:58 +02:00
Michael Vetter
523681a642 Log outgoing carbons instead of incoming
Incoming carbons are logged as normal message already.
So we had this logged twice but didn't log outgoing carbons,
send from our account but by another client, at all.

Fix https://github.com/profanity-im/profanity/issues/1181
2019-10-04 13:22:14 +02:00
Michael Vetter
09b6fc9aaa Log 1:1 messages from other clients also to file
Carbons where not logged so far.

Fix https://github.com/profanity-im/profanity/issues/1181
2019-09-04 10:28:52 +02:00
Michael Vetter
25501a5d8a Improve sv_ev_roster_received() last activity check
We don't need to do all the timing stuff if last activity is disabled
anyways.
2019-08-02 15:52:49 +02:00
Michael Vetter
53c3115976 Don't print subscribed message if contact is already in roster
This occured with a user running Cisco Jabber. It seems this server
sends repeated presence subscribed stanzas. And although I find this
strange according to RFC this seems to be ok.

So let's filter them and only display in the console output and to the
log. But don't open seperate windows.

Fix https://github.com/profanity-im/profanity/issues/1165
2019-08-01 20:48:23 +02:00
Michael Vetter
ad9263520e Show MUC history on intentional reconnect
Small bug caused by 13675fb and ce5a4ed.
Fix https://github.com/profanity-im/profanity/issues/1142
2019-07-03 09:19:24 +02:00
Paul Fariello
db8f32c049 Fix handling of encrypted carbons 2019-06-21 15:52:24 +02:00
Paul Fariello
f831f65737 Rename prof_message_t into ProfMessage 2019-06-20 14:30:45 +02:00
Paul Fariello
44d16e9141 Add prof_message_t to wrap all message attributes
Probably missing copy of body to plain in carbon and privmessage.
Only covers the incoming message path because goal is OMEMO decryption
of untrusted message.
Cover some of the log functions but not all.
2019-06-20 14:30:42 +02:00
Paul Fariello
3bb3cc625d Use flags in xmmp/message.c for encryption and trust 2019-06-20 14:30:37 +02:00
Michael Vetter
40b72ffe55 Add myself to copyright
Like discussed with James.
2019-06-17 10:44:08 +02:00
Michael Vetter
5dd6ba73f4
Merge pull request #1110 from profanity-im/feature/704-ui-behaviour-reconnect
Feature/704 ui behaviour reconnect
2019-06-11 07:00:34 +02:00
Michael Vetter
47e55cc112 Safe last MUC message timestamp per MUC
After pasis review of my code he thinks it's better to safe the
timestamp per MUC so we can account for some problems that could occur
with timing.
2019-06-11 06:35:03 +02:00
Michael Vetter
ff6038fe32 Rejoin all MUCs on reconnect
Should fix https://github.com/profanity-im/profanity/issues/1120
2019-06-10 23:18:43 +02:00
Michael Vetter
ce5a4ed77c Only show MUC subject on first connect
For #704 we don't show the room history upon reconnect.
Now we also don't show the room subject in the channel
upon re-established connection.
2019-06-05 10:05:12 +02:00
Michael Vetter
d53c477e4e Reduce timestamp call when saving last muc message
Let's test for mucwin earlier.
2019-06-05 09:56:00 +02:00
Michael Vetter
13675fbf06 Only print room history for new messages upon reconnect
If re-establish a connection don't print the room history again.
In case there there happened nothing at all since we got the room
history on the last connection.
And in case there were no new messages during the time we have been
disconnected.

Instead of printing the room history again we now print 'Re-established
Connection'.

This adds a bit of overhead since we save the timestamp upon every MUC
message.

See: https://github.com/profanity-im/profanity/issues/704
2019-06-05 09:49:50 +02:00
Dmitry Podgorny
6138a5f79b Cancel autoping timer on disconnect or connection loss
If Profanity is disconnected in any way before ping response is
received, the autoping timer will expire after the next connection
is established. As result, user will be disconnected immediately.

Cancel autoping timer in ev_disconnect_cleanup(), so it is done
for all kind of disconnections.
2019-06-03 13:28:00 +03:00
Michael Vetter
bfa4a2ef1f Close windows on connection loss not general disc.
Call `ui_close_all_wins();` only if we disconnect on purpose not when
connection is lost.

Otherwise users might miss messages.

This partly reverts 6ac73db876.
Regards https://github.com/profanity-im/profanity/issues/1083
2019-05-27 12:52:04 +02:00
Michael Vetter
883dbe1911 Create seperate function for disconnect cleanup
Duplicate code in client_events.c and server_events.c. Let's have
events/common.c and a function containing that code.
2019-05-19 22:57:51 +02:00
Michael Vetter
c94f3d0b4a Fix ifdef guard (should have been OMEMO) 2019-05-06 16:11:22 +02:00
Michael Vetter
6ac73db876 Reset things on connection loss
Remove the windows, clear tls certs, clean omemo.
Regards https://github.com/profanity-im/profanity/issues/1089
2019-05-06 12:30:33 +02:00
Michael Vetter
199e8752ca
Merge pull request #1063 from paulfariello/hotfix/presence-before-roster
Handle presence received before roster
2019-04-17 20:47:54 +02:00
Paul Fariello
db55e01dce Follow OMEMO policy even when opening window on message and carbon reception
This should close #1052
2019-04-17 15:54:15 +02:00
Paul Fariello
973a05d15a Handle presence received before roster
Presence of contact not found in roster are filtered out.
But sometimes roster is received after a first few presences.

We choose to store presences until we receive roster and then process
this presences.

Fixes #1050
2019-04-17 14:19:31 +02:00
Paul Fariello
df648ba959 Try to start sessions with every jid in roster 2019-04-10 17:24:56 +02:00
Paul Fariello
4ad6904216 Wait for discovery end to publish omemo devicelist and bundle
Add sv_ev_connection_features_received for that purpose
2019-04-10 17:23:46 +02:00
Paul Fariello
e69f947547 Rework MUC reflected message filtering
Reflected messages can't be filtered by nick only otherwise you might
ignore messages comming from you on another devices.

Consequently we maintain a list of sent messages id in mucwin.
To be sure the id will be correctly reflected we use the origin-id
stanza.
2019-04-10 17:23:46 +02:00
Paul Fariello
2015ba201d Ensure encrypted carbon of own message are marked as encrypted 2019-04-10 17:23:45 +02:00
Paul Fariello
91ee289c77 Add support for disconnect in OMEMO 2019-04-10 17:12:31 +02:00
Paul Fariello
4e1ffa6bdb Log and print outgoing encrypted message 2019-04-10 17:12:31 +02:00
Paul Fariello
a9d55dec92 Add support for sending encrypted message in MUC 2019-04-10 17:12:31 +02:00
Paul Fariello
319fb856e0 Handle decrypted OMEMO messages as such 2019-04-10 17:12:31 +02:00
Paul Fariello
3e325a61c3 Add support for OMEMO, OTR, PGP built together 2019-04-10 17:12:31 +02:00
Paul Fariello
9b8c1d7d2c Add support for encrypted carbon
Fix {signed,}_pre_key store
2019-04-10 16:31:45 +02:00
Paul Fariello
421d1b1560 Add OMEMO identity materials long term storage 2019-04-10 16:31:39 +02:00
Paul Fariello
810ea32223 Follow normal workflow for OMEMO message reception
We try to decrypt all messages, if it's successful we use
sv_ev_incoming_message even for OMEMO messages. We pass an OMEMO
boolean to let UI be aware that message were encrypted.
2019-04-10 16:03:50 +02:00
Paul Fariello
0fb27dc496 Add OMEMO message encryption and decryption 2019-04-10 16:03:50 +02:00
Michael Vetter
6034b833be Redraw screen after entry of PGP secret key
After specifying the PGP key ID with pgp.keyid within the accounts file on startup profanity asks for the secret key passphrase. It then doesn't redraw the screen, leaving it in an odd looking state.

This probably only happens with pinentry-curses since it draws in
screen.

We need this fix for cli only environments.

Fixes https://github.com/boothj5/profanity/issues/906 reported by Bob
Mottram.
Based on https://github.com/boothj5/profanity/pull/908 by Bob Mottram

Bob removed his GitHub account, so GitHub created a ghost placeholder
user for him, which unfortunately makes it impossible to cherry-pick
this commit. To more or less preserve authorship I added him as
co-author.

Commit picked and message edited by jubalh.

Co-authored-by: Bob Mottram <bob@freedombone.net>
2019-02-20 12:03:23 +01:00
Michael Vetter
706af9a900 Update copyright to include 2019 2019-01-22 11:31:45 +01:00
Michael Vetter
811b3ba857
Merge pull request #926 from msantos/null-pointer-dereference
server_events: fix potential NULL pointer deref
2018-07-30 12:23:53 +02:00
James Booth
59382984c0 Add preferences for tab display 2018-03-09 21:15:27 +00:00
James Booth
119c5650cf Show name in statusbar tabs WIP 2018-03-08 20:01:36 +00:00
James Booth
cba17faf3d Add /rooms service autocompletion 2018-02-05 21:40:32 +00:00
James Booth
250e972b7a Update copyright 2018-01-21 15:00:02 +00:00
Michael Santos
db18ba8bdf server_events: fix potential NULL pointer deref 2017-04-12 10:20:22 -04:00
James Booth
68a3daedb9 Update Copyright 2017-01-28 17:24:22 +00:00
James Booth
83385cdbc0 Add pre chat and room message blocking 2017-01-22 18:09:04 +00:00
James Booth
0d0578b625 Fix compile 2017-01-16 00:07:17 +00:00
James Booth
2b7894ccff Remove status from cl_ev_presence_send
fixes #888
2017-01-15 23:59:31 +00:00
James Booth
e043029a50 Allow clearing account resource
issue #880
2016-11-22 00:39:52 +00:00
James Booth
eac6b52e05 Fix typo 2016-10-29 13:06:50 +01:00
James Booth
8f1d3ab55c Add win_print 2016-10-15 18:29:02 +01:00
James Booth
864939b809 Use win_printf_line instead of win_println 2016-10-15 17:03:30 +01:00
James Booth
f6e9ff5b9b Fix missing params 2016-09-03 22:53:32 +01:00
Dmitry Podgorny
6090f76f72 Add missed argument 2016-09-02 20:56:20 +03:00
James Booth
47a1a62009 Add sv_ev_bookmark_autojoin 2016-08-28 22:42:09 +01:00
James Booth
a978bb12bf Send receipt request only when receiver supports feature
issue #829
2016-08-18 22:53:23 +01:00
James Booth
5f8ef3816c Free rooms list in sv_ev_login_account_success 2016-07-25 23:11:41 +01:00
James Booth
0a57c4de78 Tidy headers 2016-07-24 15:43:51 +01:00
James Booth
5bc38b6bc2 Moved window_list.c 2016-07-24 15:14:46 +01:00
James Booth
90b9b48ab9 Moved roster_list.c 2016-07-24 15:08:47 +01:00
James Booth
2af0d38e3d Moved muc.c 2016-07-24 15:02:43 +01:00
James Booth
9cff37352a Make header defines consistent 2016-07-24 14:51:39 +01:00
James Booth
25a6252a28 Moved chat_session.c 2016-07-24 14:23:55 +01:00
James Booth
8d8f2f290d Moved chat state handling code to chat_state.c 2016-07-24 13:56:11 +01:00
James Booth
e8fc80f5c1 Update GPL link in headers 2016-07-24 01:14:49 +01:00
James Booth
6559263b2f Option to bookmark room invites
issue #813
2016-05-23 23:53:44 +01:00
James Booth
81e95966cf Remove redundant tls secured function 2016-05-06 02:18:31 +01:00
James Booth
d1c71e98f4 Move connection fulljid function 2016-05-06 01:12:54 +01:00
James Booth
88f423afea Rename jabber_ functions 2016-05-06 00:53:03 +01:00
Dmitry Podgorny
efbf233c85 Define stanza's attributes as const char*
In most get-like funcitons libstrophe returns pointer to a string
that resides in an internal structure (e.g. xmpp_stanza_t). Hence,
Profanity must not change such strings. Define respective variables
as 'const char*' to reduce a chance of error and conform future
libstrophe's interface.

This patch mostly replaces 'char *' with 'const char*', but also
fixes two memory leaks after stanza_get_reason(). Add comment within
stanza_get_reason() to fix conflict with different allocator types.
2016-04-27 10:31:28 +00:00
Dominik Heidler
1b0ce852bb Implement XEP-0363: HTTP File Upload 2016-04-26 23:50:55 +02:00
James Booth
bdb1287a4f Free mentions list 2016-04-07 01:14:12 +01:00
James Booth
f243e333fc Added whole word matches for room mention 2016-04-07 01:01:27 +01:00
James Booth
afa2c0f5ba Added mention match preferences 2016-04-03 23:33:21 +01:00
James Booth
d9344b00fe Added prof_strstr function 2016-04-03 22:30:24 +01:00
James Booth
9b177a9e01 Removed #AX_PREFIX_CONFIG_H 2016-03-31 21:05:02 +01:00
James Booth
759d9ccb8d Added plugins presence hooks 2016-03-30 23:18:12 +01:00
James Booth
503fc9e393 Update roster count on carbons 2016-03-22 00:28:22 +00:00
James Booth
6f537c3818 Add PGP decryption for incoming/outgoing carbons 2016-03-22 00:20:29 +00:00
James Booth
3705437a60 Removed plugin hook call for MUC history 2016-02-18 22:59:00 +00:00
James Booth
2ac911618a Fix call to plugins_post_chat_message_send 2016-02-16 23:48:47 +00:00
James Booth
1f90aca503 Merge branch 'master' into plugins-c
Conflicts:
	src/main.c
	src/ui/console.c
2016-02-14 23:00:52 +00:00
James Booth
e53e94f1e2 Updated copyright 2016-02-14 22:54:46 +00:00
James Booth
41fe8c22b1 Added C plugin code from plugins branch 2016-02-14 22:28:55 +00:00
James Booth
d7b331874a Fix memory leaks 2016-02-14 01:49:57 +00:00
James Booth
1a3dc91e11 Highlight room trigger terms 2016-02-13 22:46:25 +00:00
James Booth
6702bb9739 Don't show notification reminders for messages the user does not want notifications for 2016-02-04 01:24:37 +00:00
James Booth
e1962261a9 Tidy notify_room_message() 2016-02-04 00:45:37 +00:00
James Booth
77e819e81a Handle self leaving room in private wins 2016-02-03 00:11:38 +00:00
James Booth
292c9cf454 Handle occupant nick change in private wins 2016-02-02 23:25:26 +00:00
James Booth
3ddef99dfe Handle occupant kicked/banned in private chat wins 2016-02-02 22:25:55 +00:00
James Booth
150015fa3d Show message in private windows when user offline 2016-02-02 21:52:13 +00:00
James Booth
08c1e62e3c Colour private chats by presence in roster panel 2016-01-31 23:08:14 +00:00
James Booth
0ae975c27f Added themes for roster room mention and triggers
closes #718
2016-01-25 00:19:26 +00:00
James Booth
b6e9a09c64 Show console messages for room mention and triggers
closes #719
2016-01-24 23:47:17 +00:00
James Booth
5ff9fbd810 Tidy handling room mention and room triggers 2016-01-24 23:06:22 +00:00
James Booth
67abfaa21e Added private chat to roster rooms 2016-01-24 00:33:24 +00:00
James Booth
fbc302317a Added roster contact themes 2016-01-14 22:54:50 +00:00
James Booth
51f033ae42 End OTR sessions on lost server connection 2016-01-08 00:22:17 +00:00
James Booth
a90e109f7e Destroy roster after updating UI in server disconnect 2016-01-08 00:13:12 +00:00
James Booth
393e690165 Merge branch 'master' into roster-struct 2016-01-05 01:38:31 +00:00
James Booth
e1e0fda8b3 Call UI disconnect functions before disconnecting with /disconnect
fixes #703
2016-01-05 01:30:32 +00:00
James Booth
055a5f71ce Added roster struct, create and destroy roster on connect/disconnect 2016-01-05 00:06:50 +00:00
James Booth
8e9bf08389 Add cl_ev_disconnect 2016-01-03 17:23:36 +00:00
James Booth
a713654f93 Fixed compilation without libotr 2016-01-03 02:01:01 +00:00
James Booth
4f35b11471 End OTR session when recipient goes offline 2016-01-03 01:32:37 +00:00
James Booth
8ca3fe4ea8 Sort roster rooms 2016-01-02 02:41:51 +00:00
James Booth
22a14e1240 Show rooms in roster panel 2016-01-02 01:22:19 +00:00
James Booth
6a8656a06b Added /console command 2015-12-29 23:32:32 +00:00
James Booth
8ea228480c Added console MUC message preference 2015-12-29 23:00:49 +00:00
Dmitry Podgorny
bea246d81b Don't compile pgp code with --disable-pgp 2015-12-21 12:53:41 +02:00
James Booth
1f56c12377 Added cons_show_incoming_room_message() 2015-12-20 00:54:17 +00:00
James Booth
e1f674eca3 Fixed PGP error message 2015-12-19 22:55:33 +00:00
James Booth
88fd2a25ee Show PGP error strings 2015-12-15 00:38:16 +00:00
James Booth
482eea4fcf Moved sending of initial presence to sv_ev_roster_received 2015-12-14 23:57:06 +00:00
James Booth
fcfdc175b6 Allow /quit during TLS certificate verification prompt 2015-11-10 23:14:59 +00:00
James Booth
9302188a32 Show current TLS certificate 2015-11-10 01:20:40 +00:00
James Booth
bee27f4773 Added /tls cert to show current certificate fingerprint 2015-11-09 23:31:21 +00:00
James Booth
4cbfb88814 Store current TLS certificate fingerpint in memory for reconnect 2015-11-09 20:57:26 +00:00
James Booth
60215cdf9d Renamed MUC private window functions 2015-11-08 22:08:29 +00:00
James Booth
8a397263dd ui_incoming_private_msg takes ProfPrivateWin, added asserts 2015-11-08 22:01:51 +00:00
James Booth
2e81a4efa3 mucwin_broadcast takes ProfMucWin 2015-11-02 00:36:25 +00:00
James Booth
23ada0d38b mucwin_subject takes ProfMucWin 2015-11-02 00:29:35 +00:00
James Booth
0592c7f9e9 mucwin_requires_config takes ProfMucWin 2015-11-02 00:26:56 +00:00
James Booth
986741dea8 mucwin_message takes ProfMucWin 2015-11-02 00:24:19 +00:00
James Booth
e68784be43 mucwin_history takes ProfMucWin 2015-11-02 00:19:46 +00:00
James Booth
6ed72d8a35 mucwin_nick_change takes ProfMucWin 2015-11-02 00:17:46 +00:00
James Booth
42643391a4 mucwin_occupant_nick_change takes ProfMucWin 2015-11-02 00:16:01 +00:00
James Booth
b3150ef8e1 mucwin_occupant_presence takes ProfMucWin 2015-11-02 00:14:16 +00:00
James Booth
d505a92d1e mucwin_occupant_online takes ProfMucWin 2015-11-01 23:52:16 +00:00
James Booth
3a98bf315c mucwin_occupant_banned takes ProfMucWin 2015-11-01 23:49:45 +00:00