From c0efb9f6325c6f81d9d05fdd4f7a656d66c8a1b1 Mon Sep 17 00:00:00 2001 From: bqv Date: Sat, 23 Apr 2022 22:54:27 +0100 Subject: [PATCH] drop back to c++20 and use tl::optional --- .depend | 543 ---------------------------------------------- .gitignore | 1 + .gitmodules | 3 + channel.cpp | 3 +- deps/optional | 1 + makefile | 8 +- omemo.cpp | 3 +- user.hh | 3 +- xmpp/node.cpp | 6 +- xmpp/node.hh | 37 ++-- xmpp/xep-0027.inl | 12 +- xmpp/xep-0045.inl | 42 ++-- xmpp/xep-0115.inl | 8 +- xmpp/xep-0319.inl | 10 +- 14 files changed, 73 insertions(+), 607 deletions(-) create mode 160000 deps/optional diff --git a/.depend b/.depend index c32b60c..e69de29 100644 --- a/.depend +++ b/.depend @@ -1,543 +0,0 @@ - -.plugin.o: plugin.cpp plugin.hh config.hh account.hh omemo.hh \ - /usr/include/signal/signal_protocol.h /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - deps/fmt/include/fmt/core.h /usr/include/signal/key_helper.h \ - /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h connection.hh command.hh input.hh buffer.hh \ - completion.hh -plugin.hh: -config.hh: -account.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -deps/fmt/include/fmt/core.h: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -connection.hh: -command.hh: -input.hh: -buffer.hh: -completion.hh: -.account.o: account.cpp /usr/include/libxml2/libxml/xmlwriter.h \ - /usr/include/libxml2/libxml/xmlversion.h \ - /usr/include/libxml2/libxml/xmlexports.h \ - /usr/include/libxml2/libxml/xmlIO.h \ - /usr/include/libxml2/libxml/globals.h \ - /usr/include/libxml2/libxml/parser.h /usr/include/libxml2/libxml/tree.h \ - /usr/include/libxml2/libxml/xmlstring.h \ - /usr/include/libxml2/libxml/xmlregexp.h \ - /usr/include/libxml2/libxml/dict.h /usr/include/libxml2/libxml/hash.h \ - /usr/include/libxml2/libxml/valid.h \ - /usr/include/libxml2/libxml/xmlerror.h \ - /usr/include/libxml2/libxml/list.h \ - /usr/include/libxml2/libxml/xmlautomata.h \ - /usr/include/libxml2/libxml/entities.h \ - /usr/include/libxml2/libxml/encoding.h \ - /usr/include/libxml2/libxml/SAX2.h /usr/include/libxml2/libxml/xlink.h \ - /usr/include/libxml2/libxml/xmlmemory.h \ - /usr/include/libxml2/libxml/threads.h plugin.hh xmpp/stanza.hh config.hh \ - input.hh omemo.hh /usr/include/signal/signal_protocol.h \ - /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - deps/fmt/include/fmt/core.h /usr/include/signal/key_helper.h \ - /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h account.hh connection.hh user.hh channel.hh \ - buffer.hh -/usr/include/libxml2/libxml/xmlwriter.h: -/usr/include/libxml2/libxml/xmlversion.h: -/usr/include/libxml2/libxml/xmlexports.h: -/usr/include/libxml2/libxml/xmlIO.h: -/usr/include/libxml2/libxml/globals.h: -/usr/include/libxml2/libxml/parser.h: -/usr/include/libxml2/libxml/tree.h: -/usr/include/libxml2/libxml/xmlstring.h: -/usr/include/libxml2/libxml/xmlregexp.h: -/usr/include/libxml2/libxml/dict.h: -/usr/include/libxml2/libxml/hash.h: -/usr/include/libxml2/libxml/valid.h: -/usr/include/libxml2/libxml/xmlerror.h: -/usr/include/libxml2/libxml/list.h: -/usr/include/libxml2/libxml/xmlautomata.h: -/usr/include/libxml2/libxml/entities.h: -/usr/include/libxml2/libxml/encoding.h: -/usr/include/libxml2/libxml/SAX2.h: -/usr/include/libxml2/libxml/xlink.h: -/usr/include/libxml2/libxml/xmlmemory.h: -/usr/include/libxml2/libxml/threads.h: -plugin.hh: -xmpp/stanza.hh: -config.hh: -input.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -deps/fmt/include/fmt/core.h: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -account.hh: -connection.hh: -user.hh: -channel.hh: -buffer.hh: -.buffer.o: buffer.cpp plugin.hh account.hh omemo.hh \ - /usr/include/signal/signal_protocol.h /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - deps/fmt/include/fmt/core.h /usr/include/signal/key_helper.h \ - /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h channel.hh buffer.hh -plugin.hh: -account.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -deps/fmt/include/fmt/core.h: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -channel.hh: -buffer.hh: -.channel.o: channel.cpp deps/fmt/include/fmt/core.h plugin.hh account.hh \ - omemo.hh /usr/include/signal/signal_protocol.h \ - /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - /usr/include/signal/key_helper.h /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h user.hh channel.hh input.hh buffer.hh pgp.hh \ - util.hh xmpp/node.hh xmpp/xep-0027.inl xmpp/ns.hh xmpp/xep-0030.inl \ - xmpp/xep-0045.inl xmpp/xep-0049.inl xmpp/xep-0115.inl xmpp/xep-0280.inl \ - xmpp/xep-0319.inl xmpp/rfc-6121.inl -deps/fmt/include/fmt/core.h: -plugin.hh: -account.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -user.hh: -channel.hh: -input.hh: -buffer.hh: -pgp.hh: -util.hh: -xmpp/node.hh: -xmpp/xep-0027.inl: -xmpp/ns.hh: -xmpp/xep-0030.inl: -xmpp/xep-0045.inl: -xmpp/xep-0049.inl: -xmpp/xep-0115.inl: -xmpp/xep-0280.inl: -xmpp/xep-0319.inl: -xmpp/rfc-6121.inl: -.command.o: command.cpp plugin.hh account.hh omemo.hh \ - /usr/include/signal/signal_protocol.h /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - deps/fmt/include/fmt/core.h /usr/include/signal/key_helper.h \ - /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h user.hh channel.hh buffer.hh message.hh \ - command.hh sexp/driver.hh sexp/scanner.hh sexp/parser.tab.hh \ - sexp/location.hh -plugin.hh: -account.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -deps/fmt/include/fmt/core.h: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -user.hh: -channel.hh: -buffer.hh: -message.hh: -command.hh: -sexp/driver.hh: -sexp/scanner.hh: -sexp/parser.tab.hh: -sexp/location.hh: -.completion.o: completion.cpp plugin.hh config.hh account.hh omemo.hh \ - /usr/include/signal/signal_protocol.h /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - deps/fmt/include/fmt/core.h /usr/include/signal/key_helper.h \ - /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h channel.hh user.hh buffer.hh completion.hh -plugin.hh: -config.hh: -account.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -deps/fmt/include/fmt/core.h: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -channel.hh: -user.hh: -buffer.hh: -completion.hh: -.config.o: config.cpp plugin.hh account.hh omemo.hh \ - /usr/include/signal/signal_protocol.h /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - deps/fmt/include/fmt/core.h /usr/include/signal/key_helper.h \ - /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h config.hh -plugin.hh: -account.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -deps/fmt/include/fmt/core.h: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -config.hh: -.connection.o: connection.cpp deps/fmt/include/fmt/core.h \ - deps/fmt/include/fmt/chrono.h deps/fmt/include/fmt/format.h \ - deps/fmt/include/fmt/core.h /usr/include/libxml2/libxml/uri.h \ - /usr/include/libxml2/libxml/xmlversion.h \ - /usr/include/libxml2/libxml/xmlexports.h \ - /usr/include/libxml2/libxml/tree.h \ - /usr/include/libxml2/libxml/xmlstring.h \ - /usr/include/libxml2/libxml/xmlregexp.h \ - /usr/include/libxml2/libxml/dict.h \ - /usr/include/libxml2/libxml/xmlmemory.h \ - /usr/include/libxml2/libxml/threads.h \ - /usr/include/libxml2/libxml/globals.h \ - /usr/include/libxml2/libxml/parser.h /usr/include/libxml2/libxml/hash.h \ - /usr/include/libxml2/libxml/valid.h \ - /usr/include/libxml2/libxml/xmlerror.h \ - /usr/include/libxml2/libxml/list.h \ - /usr/include/libxml2/libxml/xmlautomata.h \ - /usr/include/libxml2/libxml/entities.h \ - /usr/include/libxml2/libxml/encoding.h \ - /usr/include/libxml2/libxml/xmlIO.h /usr/include/libxml2/libxml/SAX2.h \ - /usr/include/libxml2/libxml/xlink.h plugin.hh xmpp/node.hh \ - xmpp/xep-0027.inl xmpp/ns.hh xmpp/xep-0030.inl xmpp/xep-0045.inl \ - xmpp/xep-0049.inl xmpp/xep-0115.inl xmpp/xep-0280.inl xmpp/xep-0319.inl \ - xmpp/rfc-6121.inl xmpp/stanza.hh config.hh account.hh omemo.hh \ - /usr/include/signal/signal_protocol.h /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - /usr/include/signal/key_helper.h /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h user.hh channel.hh connection.hh pgp.hh \ - util.hh deps/diff/diff.h -deps/fmt/include/fmt/core.h: -deps/fmt/include/fmt/chrono.h: -deps/fmt/include/fmt/format.h: -deps/fmt/include/fmt/core.h: -/usr/include/libxml2/libxml/uri.h: -/usr/include/libxml2/libxml/xmlversion.h: -/usr/include/libxml2/libxml/xmlexports.h: -/usr/include/libxml2/libxml/tree.h: -/usr/include/libxml2/libxml/xmlstring.h: -/usr/include/libxml2/libxml/xmlregexp.h: -/usr/include/libxml2/libxml/dict.h: -/usr/include/libxml2/libxml/xmlmemory.h: -/usr/include/libxml2/libxml/threads.h: -/usr/include/libxml2/libxml/globals.h: -/usr/include/libxml2/libxml/parser.h: -/usr/include/libxml2/libxml/hash.h: -/usr/include/libxml2/libxml/valid.h: -/usr/include/libxml2/libxml/xmlerror.h: -/usr/include/libxml2/libxml/list.h: -/usr/include/libxml2/libxml/xmlautomata.h: -/usr/include/libxml2/libxml/entities.h: -/usr/include/libxml2/libxml/encoding.h: -/usr/include/libxml2/libxml/xmlIO.h: -/usr/include/libxml2/libxml/SAX2.h: -/usr/include/libxml2/libxml/xlink.h: -plugin.hh: -xmpp/node.hh: -xmpp/xep-0027.inl: -xmpp/ns.hh: -xmpp/xep-0030.inl: -xmpp/xep-0045.inl: -xmpp/xep-0049.inl: -xmpp/xep-0115.inl: -xmpp/xep-0280.inl: -xmpp/xep-0319.inl: -xmpp/rfc-6121.inl: -xmpp/stanza.hh: -config.hh: -account.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -user.hh: -channel.hh: -connection.hh: -pgp.hh: -util.hh: -deps/diff/diff.h: -.input.o: input.cpp plugin.hh account.hh omemo.hh \ - /usr/include/signal/signal_protocol.h /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - deps/fmt/include/fmt/core.h /usr/include/signal/key_helper.h \ - /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h channel.hh buffer.hh message.hh input.hh -plugin.hh: -account.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -deps/fmt/include/fmt/core.h: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -channel.hh: -buffer.hh: -message.hh: -input.hh: -.message.o: message.cpp plugin.hh account.hh omemo.hh \ - /usr/include/signal/signal_protocol.h /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - deps/fmt/include/fmt/core.h /usr/include/signal/key_helper.h \ - /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h channel.hh user.hh message.hh -plugin.hh: -account.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -deps/fmt/include/fmt/core.h: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -channel.hh: -user.hh: -message.hh: -.omemo.o: omemo.cpp deps/fmt/include/fmt/core.h plugin.hh xmpp/stanza.hh \ - account.hh omemo.hh /usr/include/signal/signal_protocol.h \ - /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - /usr/include/signal/key_helper.h /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h gcrypt.hh util.hh -deps/fmt/include/fmt/core.h: -plugin.hh: -xmpp/stanza.hh: -account.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -gcrypt.hh: -util.hh: -.pgp.o: pgp.cpp plugin.hh pgp.hh -plugin.hh: -pgp.hh: -.user.o: user.cpp plugin.hh account.hh omemo.hh \ - /usr/include/signal/signal_protocol.h /usr/include/signal/ratchet.h \ - /usr/include/signal/signal_protocol_types.h /usr/include/signal/curve.h \ - /usr/include/signal/session_record.h \ - /usr/include/signal/session_pre_key.h \ - /usr/include/signal/sender_key_record.h signal.hh \ - deps/fmt/include/fmt/core.h /usr/include/signal/key_helper.h \ - /usr/include/signal/session_builder.h \ - /usr/include/signal/session_cipher.h \ - /usr/include/signal/session_pre_key.h /usr/include/signal/protocol.h \ - /usr/include/signal/curve.h user.hh channel.hh -plugin.hh: -account.hh: -omemo.hh: -/usr/include/signal/signal_protocol.h: -/usr/include/signal/ratchet.h: -/usr/include/signal/signal_protocol_types.h: -/usr/include/signal/curve.h: -/usr/include/signal/session_record.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/sender_key_record.h: -signal.hh: -deps/fmt/include/fmt/core.h: -/usr/include/signal/key_helper.h: -/usr/include/signal/session_builder.h: -/usr/include/signal/session_cipher.h: -/usr/include/signal/session_pre_key.h: -/usr/include/signal/protocol.h: -/usr/include/signal/curve.h: -user.hh: -channel.hh: -.util.o: util.cpp plugin.hh util.hh -plugin.hh: -util.hh: -xmpp/.presence.o: xmpp/presence.cpp xmpp/stanza.hh -xmpp/stanza.hh: -xmpp/.iq.o: xmpp/iq.cpp xmpp/stanza.hh -xmpp/stanza.hh: -xmpp/.node.o: xmpp/node.cpp xmpp/node.hh deps/fmt/include/fmt/core.h \ - xmpp/xep-0027.inl xmpp/ns.hh xmpp/xep-0030.inl xmpp/xep-0045.inl \ - xmpp/xep-0049.inl xmpp/xep-0115.inl xmpp/xep-0280.inl xmpp/xep-0319.inl \ - xmpp/rfc-6121.inl -xmpp/node.hh: -deps/fmt/include/fmt/core.h: -xmpp/xep-0027.inl: -xmpp/ns.hh: -xmpp/xep-0030.inl: -xmpp/xep-0045.inl: -xmpp/xep-0049.inl: -xmpp/xep-0115.inl: -xmpp/xep-0280.inl: -xmpp/xep-0319.inl: -xmpp/rfc-6121.inl: diff --git a/.gitignore b/.gitignore index e46f175..e635207 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ compile_commands.json .cache cscope* +.depend *.d *.gcno *.gcda diff --git a/.gitmodules b/.gitmodules index 537eb1e..044f278 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "diff"] path = deps/diff url = https://github.com/kristapsdz/libdiff +[submodule "deps/optional"] + path = deps/optional + url = https://github.com/TartanLlama/optional diff --git a/channel.cpp b/channel.cpp index 7e840ee..70c2afa 100644 --- a/channel.cpp +++ b/channel.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -1056,7 +1057,7 @@ struct t_channel_member *channel__remove_member(struct t_account *account, int channel__send_message(struct t_account *account, struct t_channel *channel, std::string to, std::string body, - std::optional oob = {}) + tl::optional oob = {}) { xmpp_stanza_t *message = xmpp_message_new(account->context, channel->type == CHANNEL_TYPE_MUC diff --git a/deps/optional b/deps/optional new file mode 160000 index 0000000..c28fcf7 --- /dev/null +++ b/deps/optional @@ -0,0 +1 @@ +Subproject commit c28fcf74d207fc667c4ed3dbae4c251ea551c8c1 diff --git a/makefile b/makefile index d91faf1..af958d7 100644 --- a/makefile +++ b/makefile @@ -5,10 +5,10 @@ endif RM ?= rm -f FIND ?= find -CC = $(if $(shell which gcc-12.0.1),gcc-12.0.1,cc) -CXX = $(if $(shell which g++-12.0.1),g++-12.0.1,c++) +CC = gcc +CXX = g++ -INCLUDES=-Ilibstrophe -Ideps -Ideps/fmt/include \ +INCLUDES=-Ilibstrophe -Ideps -Ideps/optional/include -Ideps/fmt/include \ $(shell xml2-config --cflags) \ $(shell pkg-config --cflags gpgme) \ $(shell pkg-config --cflags libsignal-protocol-c) @@ -25,7 +25,7 @@ CFLAGS+=$(DBGCFLAGS) \ CPPFLAGS+=$(DBGCFLAGS) -O0 \ -fno-omit-frame-pointer -fPIC \ -fvisibility=hidden -fvisibility-inlines-hidden \ - -std=c++23 -gdwarf-4 -fkeep-inline-functions \ + -std=c++20 -gdwarf-4 -fkeep-inline-functions \ -Wall -Wextra -pedantic \ -Wno-missing-field-initializers \ $(INCLUDES) diff --git a/omemo.cpp b/omemo.cpp index 5867375..6a3d5e7 100644 --- a/omemo.cpp +++ b/omemo.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -1691,7 +1692,7 @@ int bks_store_bundle(struct signal_protocol_address *address, return 0; } -std::optional bks_load_bundle(struct signal_protocol_address *address, t_omemo *omemo) +tl::optional bks_load_bundle(struct signal_protocol_address *address, t_omemo *omemo) { std::string k_bundle_pk = fmt::format("bundle_pk_{}_{}", address->name, address->device_id); std::string k_bundle_sk = fmt::format("bundle_sk_{}_{}", address->name, address->device_id); diff --git a/user.hh b/user.hh index c0b2d65..d477257 100644 --- a/user.hh +++ b/user.hh @@ -6,13 +6,14 @@ #include #include +#include struct t_user_profile { char *avatar_hash; char *status_text; char *status; - std::optional idle; + tl::optional idle; char *display_name; char *email; char *role; diff --git a/xmpp/node.cpp b/xmpp/node.cpp index 64a4ca9..df4d7d4 100644 --- a/xmpp/node.cpp +++ b/xmpp/node.cpp @@ -26,7 +26,7 @@ std::string get_name(xmpp_stanza_t *stanza) { return {}; } -std::optional get_attribute(xmpp_stanza_t *stanza, const char *name) { +tl::optional get_attribute(xmpp_stanza_t *stanza, const char *name) { const char *result = NULL; result = xmpp_stanza_get_attribute(stanza, name); if (result) @@ -124,14 +124,14 @@ void xml::message::bind(xmpp_ctx_t *context, xmpp_stanza_t *stanza) { node::bind(context, stanza); } -std::optional xml::presence::show() { +tl::optional xml::presence::show() { auto child = get_children("show"); if (child.size() > 0) return child.front().get().text; return {}; } -std::optional xml::presence::status() { +tl::optional xml::presence::status() { auto child = get_children("status"); if (child.size() > 0) return child.front().get().text; diff --git a/xmpp/node.hh b/xmpp/node.hh index 4f5990f..5247a0a 100644 --- a/xmpp/node.hh +++ b/xmpp/node.hh @@ -16,10 +16,11 @@ #include #include #include +#include std::string get_name(xmpp_stanza_t *stanza); -std::optional get_attribute(xmpp_stanza_t *stanza, const char *name); +tl::optional get_attribute(xmpp_stanza_t *stanza, const char *name); std::string get_text(xmpp_stanza_t *stanza); @@ -59,10 +60,10 @@ namespace xml { xmpp_ctx_t *context; - std::optional name; + tl::optional name; - std::optional id; - std::optional ns; + tl::optional id; + tl::optional ns; std::map attributes; std::vector children; @@ -71,7 +72,7 @@ namespace xml { virtual void bind(xmpp_ctx_t *context, xmpp_stanza_t *stanza); - inline std::optional + inline tl::optional get_attr(const std::string& name) { auto attribute = attributes.find(name); if (attribute != attributes.end()) @@ -227,10 +228,10 @@ namespace xml { bind(context, stanza); } - std::optional from; - std::optional to; + tl::optional from; + tl::optional to; - std::optional type; + tl::optional type; void bind(xmpp_ctx_t *context, xmpp_stanza_t *stanza) override; }; @@ -242,13 +243,13 @@ namespace xml { bind(context, stanza); } - std::optional from; - std::optional to; + tl::optional from; + tl::optional to; - std::optional type; + tl::optional type; - std::optional show(); - std::optional status(); + tl::optional show(); + tl::optional status(); void bind(xmpp_ctx_t *context, xmpp_stanza_t *stanza) override; }; @@ -259,10 +260,10 @@ namespace xml { bind(context, stanza); } - std::optional from; - std::optional to; + tl::optional from; + tl::optional to; - std::optional type; + tl::optional type; void bind(xmpp_ctx_t *context, xmpp_stanza_t *stanza) override; }; @@ -273,8 +274,8 @@ namespace xml { bind(context, stanza); } - std::optional from; - std::optional to; + tl::optional from; + tl::optional to; void bind(xmpp_ctx_t *context, xmpp_stanza_t *stanza) override; }; diff --git a/xmpp/xep-0027.inl b/xmpp/xep-0027.inl index 5763d82..4cd91cc 100644 --- a/xmpp/xep-0027.inl +++ b/xmpp/xep-0027.inl @@ -17,29 +17,29 @@ namespace xml { /* Current Jabber OpenPGP Usage */ class xep0027 : virtual public node { private: - std::optional> _signature; - std::optional> _encrypted; + tl::optional> _signature; + tl::optional> _encrypted; public: - std::optional& signature() { + tl::optional& signature() { if (!_signature) { auto child = get_children("x"); if (child.size() > 0) _signature = child.front().get().text; else - _signature.emplace(std::nullopt); + _signature.emplace(tl::nullopt); } return *_signature; } - std::optional& encrypted() { + tl::optional& encrypted() { if (!_encrypted) { auto child = get_children("x"); if (child.size() > 0) _encrypted = child.front().get().text; else - _encrypted.emplace(std::nullopt); + _encrypted.emplace(tl::nullopt); } return *_encrypted; } diff --git a/xmpp/xep-0045.inl b/xmpp/xep-0045.inl index 2aa2da1..44edb7f 100644 --- a/xmpp/xep-0045.inl +++ b/xmpp/xep-0045.inl @@ -108,8 +108,8 @@ namespace xml { }; std::string reason; - std::optional from; - std::optional to; + tl::optional from; + tl::optional to; }; struct destroy { @@ -121,7 +121,7 @@ namespace xml { }; std::string reason; - std::optional target; + tl::optional target; }; struct invite { @@ -135,8 +135,8 @@ namespace xml { }; std::string reason; - std::optional from; - std::optional to; + tl::optional from; + tl::optional to; }; class item { @@ -152,7 +152,7 @@ namespace xml { } std::string reason; - std::optional target; + tl::optional target; std::string nick; }; @@ -186,10 +186,10 @@ namespace xml { std::vector actors; std::vector continues; std::string reason; - std::optional affiliation; - std::optional target; - std::optional nick; - std::optional role; + tl::optional affiliation; + tl::optional target; + tl::optional nick; + tl::optional role; }; public: @@ -300,10 +300,10 @@ namespace xml { description = child.get().text; } - std::optional by; - std::optional type; - std::optional condition; - std::optional description; + tl::optional by; + tl::optional type; + tl::optional condition; + tl::optional description; const char* reason() { if (condition) @@ -331,9 +331,9 @@ namespace xml { }; private: - std::optional _muc; - std::optional> _muc_user; - std::optional> _error; + tl::optional _muc; + tl::optional> _muc_user; + tl::optional> _error; public: bool muc() { if (!_muc) @@ -344,26 +344,26 @@ namespace xml { return *_muc; } - std::optional& muc_user() { + tl::optional& muc_user() { if (!_muc_user) { auto child = get_children("x"); if (child.size() > 0) _muc_user = child.front().get(); else - _muc_user.emplace(std::nullopt); + _muc_user.emplace(tl::nullopt); } return *_muc_user; } - std::optional& error() { + tl::optional& error() { if (!_error) { auto child = get_children("error"); if (child.size() > 0) _error = child.front().get(); else - _error.emplace(std::nullopt); + _error.emplace(tl::nullopt); } return *_error; } diff --git a/xmpp/xep-0115.inl b/xmpp/xep-0115.inl index 17cdc3f..09c8f5d 100644 --- a/xmpp/xep-0115.inl +++ b/xmpp/xep-0115.inl @@ -29,23 +29,23 @@ namespace xml{ verification = *attr; }; - std::optional ext; + tl::optional ext; std::string hashalgo; std::string node; std::string verification; }; private: - std::optional> _capabilities; + tl::optional> _capabilities; public: - std::optional capabilities() { + tl::optional capabilities() { if (!_capabilities) { auto child = get_children("c"); if (child.size() > 0) _capabilities = caps(child.front().get()); else - _capabilities.emplace(std::nullopt); + _capabilities.emplace(tl::nullopt); } return *_capabilities; } diff --git a/xmpp/xep-0319.inl b/xmpp/xep-0319.inl index f466666..bc91fc3 100644 --- a/xmpp/xep-0319.inl +++ b/xmpp/xep-0319.inl @@ -19,24 +19,24 @@ namespace xml { /* Last User Interaction in Presence */ class xep0319 : virtual public node { private: - std::optional> _idle_since; + tl::optional> _idle_since; public: - std::optional idle_since() { + tl::optional idle_since() { if (!_idle_since) { auto children = get_children("idle"); if (children.size() <= 0) - _idle_since.emplace(std::nullopt); + _idle_since.emplace(tl::nullopt); else { auto since = children.front().get().get_attr("since"); if (!since) - _idle_since.emplace(std::nullopt); + _idle_since.emplace(tl::nullopt); else { try { _idle_since = get_time(*since); } catch (const std::invalid_argument& ex) { - _idle_since.emplace(std::nullopt); + _idle_since.emplace(tl::nullopt); } } }