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

322 Commits

Author SHA1 Message Date
Michael Vetter
89d8fc846e Fix double free in room id handler
Free is done in destructor now.
Regards https://github.com/profanity-im/profanity/issues/1148
2019-07-09 09:47:35 +02:00
Michael Vetter
b3bb62dcbd Fix double free regarding iq handlers 2019-07-08 15:58:40 +02:00
Michael Vetter
9aad2aa487 Free iq_id_handlers correctly
so far only the key part was freed. We also need to free the actual
handler.

Fix:
```
==21171== 1,128 bytes in 47 blocks are definitely lost in loss record
3,476 of 3,670
==21171==    at 0x483677F: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==21171==    by 0x434248: iq_id_handler_add (iq.c:265)
==21171==    by 0x4B122E: omemo_devicelist_request (omemo.c:46)
==21171==    by 0x4AC411: omemo_start_session (omemo.c:409)
==21171==    by 0x4AC37C: omemo_start_sessions (omemo.c:396)
==21171==    by 0x447881: sv_ev_roster_received (server_events.c:189)
==21171==    by 0x444019: roster_result_handler (roster.c:312)
==21171==    by 0x433FC2: _iq_handler (iq.c:202)
==21171==    by 0x5AF118E: ??? (in /usr/lib64/libmesode.so.0.0.0)
==21171==    by 0x5AEDBDA: ??? (in /usr/lib64/libmesode.so.0.0.0)
==21171==    by 0x5AFA43E: ??? (in /usr/lib64/libmesode.so.0.0.0)
==21171==    by 0x6818AA4: ??? (in /usr/lib64/libexpat.so.1.6.8)
==21171==    by 0x681A3AB: ??? (in /usr/lib64/libexpat.so.1.6.8)
==21171==    by 0x681D7EB: XML_ParseBuffer (in
/usr/lib64/libexpat.so.1.6.8)
==21171==    by 0x5AF0A63: xmpp_run_once (in
/usr/lib64/libmesode.so.0.0.0)
==21171==    by 0x432E5D: connection_check_events (connection.c:104)
==21171==    by 0x4323B3: session_process_events (session.c:255)
==21171==    by 0x42C097: prof_run (profanity.c:128)
==21171==    by 0x4B2627: main (main.c:172)
```
2019-07-04 14:25:53 +02:00
Michael Vetter
11b8204d14 Call iq_handlers_clear() upon disconnect
Free id_handlers. Fix memory leaks.
2019-06-20 12:37:32 +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
Paul Fariello
21ae946896 Handle MUC anonymous state when auto starting OMEMO
When auto joining a MUC we don't have access to required information so
we just don't start OMEMO at this time.

Once we receive disco info we then try to start OMEMO.
2019-04-17 14:03:14 +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
2d28725c85 Rename ProfIdCallback into ProfIqCallback
Goal is to create other kind of callback no based on id cmp
2019-04-10 16:03:50 +02:00
Michael Vetter
706af9a900 Update copyright to include 2019 2019-01-22 11:31:45 +01:00
Paul Fariello
ac2d1c07fa Fix optionnal sessionid in xep 0050 2019-01-21 15:02:54 +01:00
Paul Fariello
2e0bc27bf0 Make _get_groups_from_item and roster _compare_* public
In order to avoid duplication with xep 0133 support in command execution
2018-09-26 14:34:52 +02:00
Paul Fariello
01428eb858 Add special handling for xep-0133 get-user-roster 2018-09-10 13:09:23 +02:00
Paul Fariello
6de60e7efc Add support for ad-hoc response with forms 2018-09-10 12:28:28 +02:00
Paul Fariello
b7556b4e41 Add missing command name for completion log 2018-09-10 11:30:46 +02:00
Paul Fariello
ec5fc3612f Allow to use cmd without being in a window 2018-09-05 13:52:20 +02:00
Paul Fariello
233e076be9 Add support for command config execution 2018-09-05 13:52:19 +02:00
Paul Fariello
b11d3a79df Add conf win callback 2018-09-05 13:51:00 +02:00
Paul Fariello
a952776b89 Rename mucconf wins into conf wins
Configuration windows are now being used by both muc and cmd.
2018-09-05 13:51:00 +02:00
Paul Fariello
7123e94e82 Add support for form edition in command execution
Also change wins_get_by_string prototype in order to handle const str.
2018-09-05 13:51:00 +02:00
Paul Fariello
40eee1caab Add command exec error handling 2018-09-05 13:51:00 +02:00
Paul Fariello
925cd488c1 Handle simple execution
Tested with ping from biboumi
2018-09-05 13:50:59 +02:00
Paul Fariello
c9f6a78f57 Add command subcommands: list and exec
Also handle list result
2018-09-05 13:49:40 +02:00
Paul Fariello
ca022ec75e Add command command
Initial commit to test commands API
2018-09-05 13:42:28 +02:00
Michael Vetter
6d80700329 Move ID generation to xmpp folder
create_unique_id() was changed to use UUIDs instead of a counter in the
last commit. Since now it depends on connection_create_uuid() which is
in the xmpp subfolder the function should also be moved there.

Renamed it to connection_create_stanza_id() and moved it to
src/xmpp/connection.c.

Discussion happened in https://github.com/boothj5/profanity/pull/1010
2018-08-30 11:17:04 +02:00
Dominik Heidler
86a9ef7b5c Use correct macro
XMPP_FEATURE_PING insted of STANZA_NS_PING
2018-07-30 11:04:54 +02:00
James Booth
26a182945f Add /rooms cache 2018-02-05 20:01:54 +00:00
James Booth
8db2389df6 Filter rooms by simple case insensitive text 2018-02-04 21:59:33 +00:00
James Booth
a04b02c928 Include filter string in no rooms message 2018-01-28 00:13:36 +00:00
James Booth
e571ccd8ea Fix tests, move glob creation 2018-01-27 23:51:03 +00:00
James Booth
2e414797a4 Allow filtering rooms list by glob 2018-01-27 22:42:31 +00:00
James Booth
250e972b7a Update copyright 2018-01-21 15:00:02 +00:00
James Booth
4a6bf68727 Merge remote-tracking branch 'asdil12/ping' 2017-06-17 21:49:19 +01:00
Dominik Heidler
29f84ea3d4 Disable autoping if server doesn't support it
fixes #859
2017-06-16 12:11:44 +02:00
James Booth
68a3daedb9 Update Copyright 2017-01-28 17:24:22 +00:00
James Booth
6a18dedca8 Fixed typos 2016-08-28 17:30:15 +01:00
James Booth
27263508c7 Use libstrophe xmpp_iq_new convenience function 2016-08-20 20:20:38 +01:00
James Booth
24c3eff428 Use libstrophe convenience functions for stanza attributes 2016-08-20 18:16:51 +01:00
James Booth
b26c961730 Move caps_create -> stanza_create_caps_from_query_element 2016-08-14 00:15:03 +01:00
James Booth
d5f14abd4e Move caps_create_sha1_str -> stanza_create_caps_sha1_from_query 2016-08-14 00:07:08 +01:00
James Booth
e776ef9b68 Rename caps_contains -> caps_cache_contains 2016-08-13 23:45:58 +01:00
James Booth
9cecef5609 Move caps_create_query_response_stanza -> stanza_create_caps_query_element 2016-08-13 23:43:54 +01:00
James Booth
80eb5bee90 Rename Capabilties -> EntityCapabilities 2016-08-13 16:39:25 +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
e8fc80f5c1 Update GPL link in headers 2016-07-24 01:14:49 +01:00
James Booth
3a3933eff6 Add ProfIdFreeCallback to free stale id handlers on connect 2016-06-08 23:25:51 +01:00
James Booth
ac3ab39e23 Use hash table for disco features 2016-05-08 03:04:36 +01:00
James Booth
31e6cc8e38 Add connection_get_disco_info() 2016-05-08 02:25:34 +01:00
James Booth
137202e5dd Add connection_item_for_feature() 2016-05-08 01:45:22 +01:00
James Booth
f28655c5c8 Move logic to connection_set_disco_items 2016-05-08 01:10:42 +01:00
James Booth
6ce8edc194 Move disco info struct to connection 2016-05-07 23:28:16 +01:00
James Booth
88f423afea Rename jabber_ functions 2016-05-06 00:53:03 +01:00
James Booth
3bb1f12410 Add session.c 2016-05-05 23:51:49 +01:00
James Booth
f6fa63b374 Renamed connection.c -> session.c 2016-05-05 22:10:10 +01:00
James Booth
ccabc08fef Tidy xmpp headers 2016-05-04 01:19:51 +01:00
James Booth
aabe3afff8 Rename stanza handler init functions 2016-05-02 22:34:43 +01:00
James Booth
39fb05577a Rename id_handler_add -> iq_id_handler_add 2016-05-02 21:50:39 +01:00
James Booth
92780f3e6e Remove free DiscoInfo values 2016-05-02 00:59:37 +01:00
James Booth
31ab43ea2d Free stanza text and DiscoInfo features 2016-05-02 00:40:16 +01:00
James Booth
2bacd43a16 Free stanza text on plugin send hooks 2016-05-01 23:41:57 +01:00
James Booth
b8c94376aa Add /blocked command 2016-05-01 19:39:39 +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
Dominik Heidler
28e260c7da Cache all disco items and features on connect 2016-04-20 00:19:40 +02:00
Dominik Heidler
4b1481987d Fix typo: diso -> disco 2016-04-01 12:09:35 +02:00
James Booth
9b177a9e01 Removed #AX_PREFIX_CONFIG_H 2016-03-31 21:05:02 +01:00
James Booth
c6730783bf Removed duplicate typedef 2016-03-28 15:44:03 +01:00
James Booth
d39e48ba18 Use one stanza handler per type (message, iq, presence)
Allows plugins to stop stanza processing
2016-03-28 01:25:48 +01:00
James Booth
8933d59b03 Added basic stanza receive eooks 2016-03-27 21:36:29 +01:00
James Booth
7b34f72007 Use xmpp_send_raw_string instead of xmpp_send_raw 2016-03-26 16:44:02 +00:00
James Booth
d0397f3da5 Added stanza send hooks for plugins 2016-03-26 15:50:16 +00:00
James Booth
4c913aa08b Added prof_send_stanza to plugins API 2016-03-23 22:57:03 +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
7938db0a25 Use offline presence for software version responses from non contacts
fixes #714
2016-01-13 22:25:29 +00:00
James Booth
3d9e860574 Set autoping timeout default to 10 seconds, added null checks 2016-01-02 16:45:20 +00:00
James Booth
f27cae68c5 Added autoping timeout preference 2016-01-01 19:50:13 +00:00
James Booth
94b0d2c6da Added hardcoded autoping timeout 2015-12-31 01:48:04 +00:00
James Booth
08d30a4a83 Abort autping when existing attempt already in progress 2015-12-31 00:33:05 +00:00
James Booth
2847e39659 Tidy ping handlers 2015-12-31 00:11:58 +00:00
James Booth
a0c9b0cb70 Renamed autoping handler 2015-12-30 23:50:39 +00:00
James Booth
38255e9be4 Make all mucconfwin functions take ProfMucConfWin 2015-11-02 22:19:01 +00:00
James Booth
a3e9178ea2 Renamed mucconfwin functions 2015-11-02 22:05:17 +00:00
James Booth
1602011e01 mucwin_role_set_error takes ProfMucWin 2015-11-02 00:52:50 +00:00
James Booth
982bc8e066 mucwin_affiliation_set_error takes ProfMucWin 2015-11-02 00:51:12 +00:00
James Booth
7bedb6c294 mucwin_handle_role_list takes ProfMucWin 2015-11-02 00:47:43 +00:00
James Booth
1aa3c0ea4f mucwin_role_list_error takes ProfMucWin 2015-11-02 00:44:33 +00:00
James Booth
3341e8c202 mucwin_handle_affiliation_list takes ProfMucWin 2015-11-02 00:40:23 +00:00
James Booth
d81dbdb233 mucwin_affiliation_list_error takes ProfMucWin 2015-11-02 00:38:26 +00:00
James Booth
5c53c94253 mucwin_kick_error takes ProfMucWin 2015-11-02 00:33:31 +00:00
James Booth
d21faa4609 mucwin_room_disco_info takes ProfMucWin 2015-11-01 23:33:50 +00:00
James Booth
363fda82c1 mucwin_room_info_error takes ProfMucWin 2015-11-01 23:30:44 +00:00
James Booth
67f8faf645 Renamed ui_handle_room_role_set_error -> mucwin_role_set_error 2015-11-01 21:53:12 +00:00
James Booth
50765190f7 Renamed ui_handle_room_affiliation_set_error -> mucwin_affiliation_set_error 2015-11-01 21:52:27 +00:00
James Booth
556985ec39 Renamed ui_handle_room_role_list -> mucwin_handle_role_list 2015-11-01 21:50:32 +00:00
James Booth
2cc5f17871 Renamed ui_handle_room_role_list_error -> mucwin_role_list_error 2015-11-01 21:48:28 +00:00
James Booth
fa0ed64190 Renamed ui_handle_room_affiliation_list -> mucwin_handle_affiliation_list 2015-11-01 21:45:59 +00:00
James Booth
21d560f068 Renamed ui_handle_room_affiliation_list_error -> mucwin_affiliation_list_error 2015-11-01 21:37:09 +00:00
James Booth
a575ab174c Renamed ui_handle_room_kick_error -> mucwin_kick_error 2015-11-01 21:34:28 +00:00
James Booth
fdd00b33a4 Renamed ui_show_room_disco_info -> mucwin_room_disco_info 2015-11-01 21:19:08 +00:00
James Booth
bb14b19bb1 Renamed ui_handle_room_info_error -> mucwin_room_info_error 2015-11-01 21:18:13 +00:00
James Booth
c8a6bdb381 Applied coding style to src/xmpp/ 2015-10-26 00:14:23 +00:00
James Booth
1fd2a8a4e9 Send service-unavailable when lastactivity disabled 2015-10-14 21:45:19 +01:00
James Booth
1afe492e30 Added jabber:iq:last to capabilities 2015-09-29 23:55:01 +01:00
James Booth
bfdda17b7f Fix last active query 2015-09-29 00:53:58 +01:00
James Booth
26d160cae8 WIP: Added last activity request and response 2015-09-29 00:01:38 +01:00
James Booth
fe22fea9a8 Fixed spelling mistake 2015-09-27 18:32:21 +01:00
James Booth
2b88e2f1bf Check for libmesode, fall back to libstrophe 2015-09-21 21:40:04 +01:00
James Booth
131f1788c2 Free software version result properties 2015-08-09 01:10:02 +01:00
James Booth
70c0eeed1e Free error message in carbons handlers 2015-08-09 00:43:00 +01:00
James Booth
406b821b35 Show software version result in current window 2015-08-06 01:56:52 +01:00
James Booth
af38ddc9e7 Handle resource not found on sofware version request 2015-08-05 01:14:41 +01:00
James Booth
0b7c79ac13 Use original JID in software version request in MUC 2015-08-05 01:01:46 +01:00
James Booth
ac3e7dd9e8 Handle software version requests for gateways that return from domainpart 2015-08-05 00:48:50 +01:00
James Booth
2a92169351 Use id handler for software version requests, handle errors 2015-08-05 00:26:29 +01:00
James Booth
8e2578459e Use null check convention in iq.c 2015-05-04 23:19:10 +01:00
James Booth
0118178080 Removed server event delegation functions 2015-05-01 00:55:40 +01:00
James Booth
8aba52f4fe Renamed event functions 2015-04-28 23:38:56 +01:00
James Booth
e688dd7d28 Renamed server event functions 2015-04-19 17:29:54 +01:00
James Booth
424f52c3fa Moved server_events to event/ 2015-04-19 16:54:16 +01:00
James Booth
714faeb2e6 Add callback data to room disco info response handler 2015-03-29 00:55:33 +00:00
James Booth
24a45e5292 Set members only property when getting room features 2015-03-29 00:21:18 +00:00
James Booth
3c1e8c4e15 Added server error handling when setting /carbons preference 2015-03-09 23:07:51 +00:00
James Booth
945f29873e Merge remote-tracking branch 'oliverlemoal/xep-0280' into xep-0280 2015-03-08 21:51:50 +00:00
James Booth
9951da0c8f Free jid on caps response handler 2015-02-11 00:17:07 +00:00
James Booth
b3be26a214 Updated copyright 2015-02-10 23:16:09 +00:00
Olivier LE MOAL
48f9f3b3b0 Add XEP-0280 support 2015-02-10 11:32:22 +01:00
James Booth
38e6dc0e85 Free expected_node for legacy caps 2015-02-09 21:59:17 +00:00
James Booth
9d94ac5c63 Removed function pointers 2014-12-22 22:13:42 +00:00
James Booth
aec7afd06a Added caching of legacy capabilities 2014-11-30 00:37:36 +00:00
James Booth
94bd9dbdfe Store capabilities against fulljid when unsupported hash 2014-11-27 01:08:02 +00:00
James Booth
7a03dd7641 Free datetime on ping errors 2014-11-03 21:09:49 +00:00
James Booth
c4ab9405f6 Fixed leaks in /affiliation and /role 2014-11-03 20:57:22 +00:00
James Booth
c4412fe823 Fixed various memory leaks 2014-11-01 01:48:36 +00:00
James Booth
c014bb34b3 Renamed room destroy function 2014-10-23 23:33:12 +01:00
James Booth
0cc25e1b76 Removed debug messages when setting roles/affiliations 2014-10-18 19:19:01 +01:00
James Booth
965f048b18 Implemented setting and listing roles 2014-10-06 21:42:09 +01:00
James Booth
d12534c58e Implemented /room kick command 2014-10-05 20:52:34 +01:00
James Booth
ac7bc02c63 Added /room kick command 2014-10-05 03:52:55 +01:00
James Booth
2026ab4b6e Implemented getting affiliation list, and setting affiliation 2014-10-05 01:39:48 +01:00
James Booth
0b78a9a57e Implemented setting affiliation and listing affiliations 2014-10-04 23:40:36 +01:00
James Booth
58fb89ad33 Allow adding and removing room owners 2014-10-04 21:38:31 +01:00
James Booth
25b04537e1 Added service discovery to /room info command 2014-10-02 23:37:10 +01:00
James Booth
4f7feedb65 Changed rooms to use Occupant type instead of PContact 2014-09-30 00:16:01 +01:00
James Booth
d25d6b4502 Tidied muc module 2014-09-28 22:09:20 +01:00
James Booth
7703f57584 Use log_warning for room config form errors 2014-09-25 20:26:42 +01:00
James Booth
41f4621e6f Free caps, remove strdup 2014-09-24 01:06:49 +01:00
James Booth
95a2cec953 Handle errors for /disco info requests 2014-09-24 00:30:05 +01:00
James Booth
c343b3ecef Log errors on caps responses 2014-09-21 16:51:35 +01:00