Fixes https://github.com/profanity-im/profanity/issues/1423
Oldest stanza is fetched like before but now the timestamp is generated by creating date_time_from_iso8601 and then to_local, instead of trusting that the timestamp is in utc.
The procedure previously was stamp = time_val_from_iso8601() then date_time = date_time_from_utc(stamp) then local_date_time = to_local(date_time)
`/plugins install` installs a plugin to
`.local/share/profanity/plugins`.
And also loads it.
When a plugin is loaded it will automatically be added to the `profrc`
file like this:
```
[plugins]
load=my.py;
```
On the next start Profanity will try to load this plugin again unless
`/plugin unload my.py` is called.
If `~/dir` exists profanity exits for me.
Whole code for updating plugins from a dir isn't even implemented. Even
though some messgages suggest otherwise.
Remove this and only allow updating of one file.
Two options to install plugins.
Mention the whole path:
`/plugins install ~/src/profanity-plugins/my.py`
Mention only the plugin name:
`/plugins install my.py`
The latter will look in `/usr/local/share/profanity/plugins/` for the
file and copy it over to `~/.local/share/profanity/plugins`.
At first I was thinking about loading the plugins from the global
location. But users most likely don't want to have all plugins activated
that an admin installs on a system.
Regards https://github.com/profanity-im/profanity/issues/945
I feel like this mostly is confusing people.
Also don't see much value for it.
To me it looks like a regular workflow is like:
```
/plugin install ~/src/profanity-plugins/my.py
```
The whole thing with sourcepath, install (which also loads without
having that described anywhere), load etc is confusing.
Also each plugin file that is present in
`.local/share/profanity/plugins` will then be auto loaded. Which means
after installation.
Set PREF_NOTIFY_MENTION_WHOLE_WORD to true.
If I'm not mistaken the _mucwin_print_mention() / get_mentions()
functions only work correctly since
6bc440c6f7.
This changed the behaviour for users.
They got notified when their nick was `kaffee` and in the message the
string `kaffeekanne` occured.
Setting `/notify room mention word_whole` corrected this.
So my idea is that only now the mention function work correctly. And to
have a good default behaviour we should set the `word_whole` on by
default.
Regards https://github.com/profanity-im/profanity/issues/1578
- Added JABBER_RAW_CONNECT[ING/ED] connection states
- Added cl_ev_connect_raw and session_connect_raw to conform to normal
connection functions
- Fixed SIGABRT during registration
- Added a check in cmd_register to ensure it's actually connected before
registering--but this will always fail atm
_chatwin_history() reassigns msg->plain without freeing previous
string. This leads to memory leak. As a temporary solution, free
replaced string.
Fixes#1585.
Offset for g_utf8_substring() is higher than the string length. We can
avoid g_utf8_substring() for the tail and simply convert starting offset
to a pointer.
Since I didn't find a way to discover whether a notification server is
running I decided to disable them by default. So people without one will
not have such a bad lag due to timeout from libnotify.
Fix https://github.com/profanity-im/profanity/issues/977
See https://github.com/profanity-im/profanity/issues/1518
It has a good explanation of what happened:
```
Apparently, the _rotate_log_file function tried to extract user-provided
name from currently used mainlogfile and restart logging to the same
place after rotation, but currently this is interpreted as a full path
instead. As I understand, the log rotation is no longer done with
user-provided paths at all so this should be simply skipped altogether
now as passing any non-NULL value is interpreted as user-provided.
Replacing start with NULL appears to fix it for me.
```
In log_msg() we only rotate the log if not user_provided_log.
https://github.com/profanity-im/profanity/pull/1455 changed the
behaviour from user defined filename in the log dir to using full path.
`jubalh: jubalh jubalh` resulted in `20:32:34 - testuser1:
jubalh20:32:34 - testuser1: : jubalh20:32:34
- testuser1: jubalh`
Print date/nick only once at beginning of line.
get_mentions() correctly counts utf-8 chars. So the positions of
mentions we get from there are correct.
But in _mucwin_print_mention() we set position equal to byte.
We need to use utf-8 safe functions here.
Regards https://github.com/profanity-im/profanity/issues/1231
In profanity are two handlers for device list:
* _handle_own_device_list
* _handle_device_list_start_session
I seems both handler will start a session via
omemo_start_device_session_handle_bundle
_handle_own_device_list will also make sure, that the own device is withing the
omemo device list. If we add the _handle_device_list_start_session into the
hashmap, we are not going the republish ourself, in case we clean-up the device
list from another client.
This will maybe fix#1552
99 Little Bugs in my Code.
Take one down.
Patch it around.
113 Bugs in my Code
This bug was introduced in 1ec606540e when
`g_strdup_printf` was used instead of `asprintf`.
Problem discoverd by raspeguy.
Mistake discovered by optmzr and Martin.
Thanks to everybody involved!
When the connection has been re-established, chat and groupchat with OMEMO
should restat the OMEMO Session.
Fix: #1530
* Added HAVE_OMEMO
* clang-format and user output
If we are not able to publish our own device list, we just ignored it.
This commit will show at least an error message and informs the user that this
device is currently not in the list of devices.
See Issue: #1538
Next task will be to handle the <precondition-not-met/> conflict properly.
* Display the `[ATTENTION]` hint in the titlebar for both chatwins and
mucwins.
* Use THEME_TITLE_TEXT instead of THEME_TITLE_ENCRYPT
* Have separate function `_show_attention` and don't do it in unrelated
`_show_privacy`.
As defined in XEP-0384 the application should not encrypt the message to own
devices. Within a groupchat, yourself are a recipients as well.
We will check the recipients and filter out the own device of the own jid.
This Pull Request will fix Issue: #1541
The most loggings has been set to debug. Just in case of error / problem the
logging should be done with log-level ERROR or WARNING.
We will see later, which loggings should be switched to log-level INFO.
This improvement has been done to find OMEMO bugs.
See also: #1070#1530#1538
Old: `/intype on|of`
Typing information is printed in console and titlebar.
New: `/intype titlebar|console on|off`
Typing information can be configured in more detail.
Regards https://github.com/profanity-im/profanity/issues/1516
Our variable `alphabet` contains 62 alphanumeric symbols + '\0'.
When we use sizeof(alphabet) we will get 63 due to that.
But we want to choose a random numbers from the 62 alphanumeric letters only.
This mistake caused us to have strings with a max length of `length`
instead of the exact length.
When doing https://github.com/profanity-im/profanity/issues/1520
this caused our algo for muc reflection to not catch since we expect the
random ID to be exactly 15 symbols long in `message_is_sent_by_us()`.
* Generating a unique file name in tmp_dir folder
* Changed exec of vim to exec of sensible-editor
* Test file exists and create file with "private" rights
* Send a preview of the message in the window
* Delete temp file
It was a great ride!
IDs look instead of
`TE5BTDc2ZTc3YTMwZGU3MDgzMzllOTliNGExNjVmMjZkMTY1ZmUyZGEyNTUxMjVmODBkMmQzOGMxYWI2ZjAxNzdiM2Q=`
more like `7HcnNSoO1MVvb0p9a9e293152922853e910b8b1a65bb26e225a0568` now.
Regards https://github.com/profanity-im/profanity/issues/1520
We still has our identifier into it to filter MUC reflected messages.
profident maybe should be changed to be longer or be generated upon each
start.
Currently, only `chat_log_omemo_msg_out` can fail (i.e. return `NULL`
instead of a stanza id). In this case, the message is neither printed to
the chat window nor added to the log (since it wasn't sent).
If the message (key) can't be encrypted for any device, sending the
message is refused and an informative error message is presented to the
user.
Also, don't encrypt for the same device, since the OMEMO XEP disallows
this.
The function `omemo_start_session` was effectively called twice in the
`/msg` command: Once in `chatwin_new` and afterwards in `cmd_msg`. I've
removed the second call.
Two mistakes were here:
* `/autoaway time away` without a time argument segfaulted
* `/autoaway message away` without a mesage set to (null). We have
`/autoaway message off to set it off.
Also use g_strcmp0() instead of strcmp().
There was a todo for this in message.c which got forgotten.
This was most likely also the reason why there were NULL entries for
this in the DB which DebXWoody mentioned in the MUC.
Thus comparison was with NULL and no new entries were added to the
database.
Edit:
After checking pull requests I see Stefans draft PR:
https://github.com/profanity-im/profanity/pull/1505
So let's add him as co-author.
Co-authored-by: Stefan Kropp <stefan@debxwoody.de>
`/affiliation register` can now be used to register a nickname with a
MUC.
Tested with a server without forms. Couldn't find a server which
supports forms yet.
Implements https://github.com/profanity-im/profanity/issues/1210
Through asprintf() we can get rid of malloc() + sprintf().
Also we don't need to calculate the strlen() again since asprintf()
returns the bytes printes.
Only non UTF-8 characters. But that was true before already.
Main changes:
1. Attributes instead of tags
2. Read the optional <header> tags and send them in the HTTP PUT header:
* Authorization
* Cookie
* Expires
Co-authored-by: Martin Dosch <martin@mdosch.de>
Use the following options in `omemo_bundle_publish()`:
- "pubsub#persist_items" = "true"
- "pubsub#access_model" = "open"
The same options are also used in Gajim.
I've tested this on two different servers. The bundle was successfully
added as a new PEP node. Test cases:
1. Normal use on my main account
2. Log in into a fresh tesst account on a different server
3. `/omemo clear_device_list`. In this case, the client(s) may have to
be restarted.
Note: In `_omemo_bundle_publish_result`, there's a route that is taken
when the bundle publish stanza failed. In this case, the node is
configured manually, i.e. the access_model is set to 'open'. I have
manually tested this case, but this case didn't naturally occur for me.
Note: The option "pubsub#max_items=max" is REQUIRED for the bundle
publication, as per XEP-0384. However, this is not done in other clients
(I've checked the source code of Gajim and Conversations), and it is
also not supported by Prosody. Cf. <https://github.com/xsf/xeps/pull/988>.
Regards https://github.com/profanity-im/profanity/issues/1488
Actually I would have loved to see the stanza that caused the segfault
since I'm not entirely sure whether this actually means that we do
something wrong earlier on.
Right now I don't know why the to_jid should be empty.
Let's prevent the segfault for now and see whether we get further
bugreports later.
Segfaulting issue got introduced with dd566d8d56.
On every write to `chatlog.db` syslog throws
```
profanity: vfprintf %s NULL in "INSERT INTO `ChatLogs` (`from_jid`,
`from_resource`, `to_jid`, `to_resource`, `message`, `timestamp`,
`stanza_id`, `archive_id`, `replace_id`, `type`, `encryption`) SELECT
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' WHERE
NOT EXISTS (SELECT 1 FROM `ChatLogs` WHERE `archive_id` = '%s')"
```
in `/var/log/messages`. Checking for `NULL` except in the fields the DB
is expected to throw errors for, satisfies OpenBSDs security measures
Error log:
GLib-CRITICAL - g_string_insert_len: assertion 'len == 0 || val != NULL' failed
Check if a room name exists, before adding the name into the title bar.
Some functions changed in the meantime.
stanza_get_child_by_name_and_ns() got dropped and
xmpp_stanza_get_child_by_name_and_ns() from newer libstrophe is used.
It was added in f7fe87dd4e when I rewrote
window functions to include more infos (not just char* but whole jid
struct I think).
The same todo was added to win_print_outgoing_muc() but removed in
f3d9de133e.
This TODO should have been removed in
f3d9de133e since there we added the myjid
parameter.
Discovered by @aba-hollerer.
Mistake was introduced in b6b7dd5ad4
probably due to a wrong copy/paste.
First wasn't reproducible because I had `/receipts request on` and thus
win_print_outgoing_receipts() is used which has the correct
THEME_TEXT_ME.
Fixes https://github.com/profanity-im/profanity/issues/1441
`profanity -f my` created ~/.local/share/profanity/logs/my.log`.
It would be nicer if one could define the actual path, so one can choose
another directory or even use /dev/null.
Fixes https://github.com/profanity-im/profanity/issues/1442