1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00
Commit Graph

4141 Commits

Author SHA1 Message Date
Daniel Lublin
4420463541 Refactor /roster show/hide (#1251)
Refactor /roster show/hide
2020-01-12 22:02:32 +01:00
Michael Vetter
33fca40b58
Merge pull request #1248 from svensp/master
OMEMO message keys allow prekey="1" alongside prekey="true"
2020-01-05 18:56:35 +01:00
Michael Vetter
be13e98fe7 Update my Copyright to 2020 2020-01-03 19:52:31 +01:00
Sven Speckmaier
5ccd04c91b omemo: Check for 1 alongside true in an omemo encrypted message stanza
prekey is defined as `<xs:attribute name="prekey" type="xs:boolean"/>`
which allows both `true` and `1` as truthy values.
Not checking for `1` breaks omemo encryption when interacting with
clients which set prekey="1", example: psi+ 1.4.983
Regards https://github.com/profanity-im/profanity/issues/1247
2020-01-03 10:39:40 +01:00
Michael Vetter
5d7f2d1516 Add comments to avatar.c
And use better function names.
2019-12-23 20:56:38 +01:00
Michael Vetter
92c8366880 Dont kill *.char preferences if theme doesnt contain it
So far `/occupants char *`, `/roster contact char *`, `/roster room char #`,
`/roster header char -`, `/occupants header char -` was saved and
loaded from the preferences.

But was overwritten when the theme was loaded. If the theme didn't set
these values the value was just cleared. Despite that it might have been
set in the users preferences.

Funny enough the themes don't operate generally like this.
For example `otr.char` is not cleared.

This is again due to our borked theme/prefs concept
(https://github.com/profanity-im/profanity/issues/1077).

For now let's just use the one set from the preferences if it's set. The
theme will however overwrite it if it is set there.

Fix https://github.com/profanity-im/profanity/issues/1244
2019-12-20 10:45:25 +01:00
Michael Vetter
e904b000ad Make /roster color configurable when offline 2019-12-20 10:07:44 +01:00
Michael Vetter
abd8e3d6c5 Adjust /color configuration output
Fix https://github.com/profanity-im/profanity/issues/1243
2019-12-20 10:05:58 +01:00
Michael Vetter
fdd6897eee Add workaround for stupid compiler warning
Makes travis builds for TW, Debian and Arch fail.
2019-12-19 20:38:05 +01:00
Michael Vetter
5170a2d542 Add string.h to avatars.c
Regards https://github.com/profanity-im/profanity/issues/1241
2019-12-19 20:04:19 +01:00
Michael Vetter
1f809e5210 Refactor _cmd_set_boolean_preference
Only compute string if necessary.
2019-12-19 19:25:58 +01:00
Michael Vetter
808850c6f5 Add /occupants color command
`/occupants color on|off` to enable or disable XEP-0392 also for the
MUC occupants.

Regards
https://github.com/profanity-im/profanity/issues/1191
2019-12-19 19:14:59 +01:00
Michael Vetter
6d82020a66 Merge branch 'master' of https://github.com/profanity-im/profanity 2019-12-19 18:54:27 +01:00
Michael Vetter
0af54d8a72 Add /roster color command
`/roster color on|off` to enable or disable XEP-0392 also for the
roster.

Regards https://github.com/profanity-im/profanity/issues/1191
2019-12-19 18:53:22 +01:00
Michael Vetter
6c2fd1a8ca Include stdlib.h in avatar.c
We use malloc() and free().

Fix https://github.com/profanity-im/profanity/issues/1241
2019-12-19 18:21:48 +01:00
Michael Vetter
c302af99b7 xep-0392: colorize roster 2019-12-19 14:02:24 +01:00
Michael Vetter
9ac72980d1 xep-0084: add test stub file 2019-12-18 15:44:59 +01:00
Michael Vetter
53b92561cb Add header file guard to avatar.h 2019-12-18 15:33:16 +01:00
Michael Vetter
6978c39538 xep-0084: make internal functions static 2019-12-18 15:31:34 +01:00
Michael Vetter
da3ee9539d xep-0084: move id to avatar_metadata 2019-12-18 15:29:08 +01:00
Michael Vetter
fe41459d86 xep-0084: Add correct file extension 2019-12-18 15:20:07 +01:00
Michael Vetter
0ea1d3f85d xep-0084: Normalize at out of image filename 2019-12-18 14:36:18 +01:00
Michael Vetter
2b6b165ed2 xep-0084: Improve help 2019-12-18 14:35:47 +01:00
Michael Vetter
795ae00acf xep-0084:
So far we removed the avatar feature only after a succesful retrive in
avatar_request_item_by_id() before we are going to retrieve the actual
image.

We should remove it at every `/avatar barejid` call too so in case one
retrieval was unsucessful that we can call it again.

So far it seems like there is no other way to trigger getting the nodes
except announcing that we support the avatar feature.
2019-12-18 13:52:48 +01:00
Michael Vetter
64a86a1785 Fix header 2019-12-18 13:42:21 +01:00
Michael Vetter
3fdeb52f1c xep-0084: add /avatar help and autocompletion 2019-12-18 13:37:42 +01:00
Michael Vetter
3f58aba2bd xep-0084: save avatars in own directory 2019-12-18 13:29:28 +01:00
Michael Vetter
f692d6d0e0 xep-0084: Make it work multiple times 2019-12-18 13:14:17 +01:00
Michael Vetter
c2aa585615 xep-0084: Download avatars
Proof of concept.
Needs error checking, a nice interface, general cleanup..
2019-12-18 12:50:09 +01:00
Michael Vetter
e3538cf739 xep-0084: Look for specific user and print ID
Add a `/avatar` command.
2019-12-18 11:24:50 +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
3036834ec8 separator: Enable for MUC and PRIVWIN too
Fix https://github.com/profanity-im/profanity/issues/1238
2019-12-13 13:13:02 +01:00
Michael Vetter
e2b44a69bd separator: Print only one for each chat window
So far we printed one after the last received message, which doesn't
make much sense of course.
Now only print one if there is not already one present.
2019-12-13 12:47:27 +01:00
Michael Vetter
a1ed37953c separator: print trackbar across the whole line
Use the whole line.
We do this in win_redraw() so upon terminal size change it still
matches.

Regards https://github.com/profanity-im/profanity/issues/1238
2019-12-13 12:19:07 +01:00
Michael Vetter
14f25992c3 Initial work on last-read-position feature
Print dashes on the position we last left off in a chat window.
So far the number of dashes is hardcoded, and the feature only works in
chat windows.

Regards https://github.com/profanity-im/profanity/issues/1238
2019-12-13 12:05:24 +01:00
Michael Vetter
9bb2d7f95e Dont print error message if a valid setting function is called
This is because the actual command that parses itself (cmd_logging) returns false if it didn't get the expected parameters.
Handing the printing however is done by another function. This function is added to the Command struct as setting_function.
So if this is set, and the actual command returns false. We should just call the setting_function and not print the error message.

Fix https://github.com/profanity-im/profanity/issues/1237
2019-12-12 22:24:09 +01:00
Michael Vetter
fd36fcdb1e Handle case where color.nick is not set
Fixes a segfault if color.nick was never set but we want to print it's
value.
2019-12-12 20:16:10 +01:00
Michael Vetter
3258211f27 Improve color blindness handling
Rename some things and use a swtich instead of if.
2019-12-12 14:23:07 +01:00
Michael Vetter
2750194279 Implement Color Vision Deficiencies setting
Implement settings for redgreen and blue blindness.

Regards https://github.com/profanity-im/profanity/issues/1191
2019-12-12 11:07:11 +01:00
Michael Vetter
ddf6ada3d1 Add initial support for XEP-0392
The last 3 commits added basic support.
Thanks @aaptel!

This commit adds basic settings interface to use it.
See `/color on|off`.

We still have to enable settings for color blindness.
And maybe another setting to decide whether to color the
occupantslist/roster with the same algo.

Regards https://github.com/profanity-im/profanity/issues/1191
2019-12-09 16:12:54 +01:00
Aurelien Aptel
7a0a578a8a XEP-0392: theme, ui: conditionally colorize user nicks
* add theme_hash_attrs()
* when printing a user message check PREF_COLOR_NICK to decide whether
  to colorize it or not

ideally we should hash the jid instead of the nick but this is already
a first step.
2019-12-03 21:10:39 +01:00
Aurelien Aptel
4a672bda22 XEP-0392: color: implement color hashing
* add the HSL values of each of the 256 terminal colors
* add color_pair_cache_hash_str()
* move common code to _color_pair_cache_get() helper func

after hashing a string to a color, return the closest matching
terminal color using euclidian distance of the HSL diff vector (this
method was found empirically and seems to work well enough...)
2019-12-03 21:10:39 +01:00
Aurelien Aptel
15064d9739 XEP-0392: config: add "color.nick" bool option
the option will control whether to enable coloration of usernames
based on the hashing algorithm described in XEP-0392.
2019-12-03 21:10:39 +01:00
Michael Vetter
19de066008 Call ncurses resize function before move function
From @xaizek s comment on issue #1235:
```
If the move would cause the window to be off the screen, it is an error and the window
is not moved.

Resize on the other hand doesn't fail like this according to its documentation. So new size needs to be applied first.
```

Big thanks to @xaizek for taking a look at our code and helping us!!

Regards https://github.com/profanity-im/profanity/issues/1235
2019-12-02 14:03:53 +01:00
Michael Vetter
09b8802f51 _win_print: Guard against time being null
This is encountered when biboumi is used.
Example: `/join #debian-next%irc.oftc.net@biboumi.lebihan.pl`
It seems then time can be null.

g_date_time_format() will not work in this case although time_pref will
not be "off". So let's not call g_date_time_format() in this case. But
treat it like time is set to off.

However message reflection will not work properly with biboumi.
Probably we dont get origin-id.

Fix https://github.com/profanity-im/profanity/issues/1230
2019-12-01 18:01:28 +01:00
Michael Vetter
f0a719d1e1 Merge /group command into /roster
Fix https://github.com/profanity-im/profanity/issues/1229
Regards https://github.com/profanity-im/profanity/issues/1116
2019-11-25 10:40:25 +01:00
Michael Vetter
548b64f6c5 Fix stanza_get_child_by_name_and_from() strcmp
Fix https://github.com/profanity-im/profanity/issues/1227
2019-11-14 19:22:06 +01:00
Michael Vetter
46fd7150e5 Add vim modeline 2019-11-13 12:11:05 +01:00
Michael Vetter
61f66966dd Check for correct delay tag for muc timestamps
https://github.com/profanity-im/profanity/issues/1190 had another issue:
Sometimes servers send multiple </delay> and we just checked the first
one we got and only used it if the 'from' attribute was fitting.
However it could be that we actually wanted the second </delay> element
and there the 'from' would have been right.

So we need to loop through them until we get the one with the fitting
'from'.

Fix https://github.com/profanity-im/profanity/issues/1190
2019-11-13 09:41:19 +01:00