├── .travis.yml ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── COPYING.Commercial ├── ChangeLog ├── LICENSE ├── README.md ├── auto_welcome.hpp ├── avboost ├── README.md ├── example │ ├── CMakeLists.txt │ ├── autoproxy.cpp │ └── multi_proxychain.cpp └── include │ └── boost │ ├── async_coro_queue.hpp │ ├── async_dir_walk.hpp │ ├── async_foreach.hpp │ ├── avloop.hpp │ ├── avproxy.hpp │ ├── avproxy │ ├── auto_proxychain.hpp │ ├── avproxy.hpp │ ├── detail │ │ ├── connect_condition.hpp │ │ ├── error.hpp │ │ ├── proxy_chain.hpp │ │ ├── proxy_error_mapper.hpp │ │ ├── proxy_http.hpp │ │ ├── proxy_socks5.hpp │ │ ├── proxy_ssl.hpp │ │ └── proxy_tcp.hpp │ ├── proxies.hpp │ └── proxy_connect.hpp │ ├── base64.hpp │ ├── bin_from_hex.hpp │ ├── bin_hex_iterator.hpp │ ├── cfunction.hpp │ ├── hash.hpp │ ├── hash │ ├── adler.hpp │ ├── block_cyphers │ │ ├── basic_shacal.hpp │ │ ├── detail │ │ │ ├── basic_functions.hpp │ │ │ ├── md4_policy.hpp │ │ │ ├── md5_policy.hpp │ │ │ ├── shacal1_policy.hpp │ │ │ ├── shacal2_policy.hpp │ │ │ ├── shacal_functions.hpp │ │ │ ├── shacal_policy.hpp │ │ │ └── threefish_policy.hpp │ │ ├── md4.hpp │ │ ├── md5.hpp │ │ ├── shacal.hpp │ │ ├── shacal1.hpp │ │ ├── shacal2.hpp │ │ └── threefish.hpp │ ├── compute_digest.hpp │ ├── crc.hpp │ ├── cubehash.hpp │ ├── davies_meyer_compressor.hpp │ ├── detail │ │ ├── basic_functions.hpp │ │ ├── cubehash_policy.hpp │ │ ├── exploder.hpp │ │ ├── imploder.hpp │ │ ├── md4_policy.hpp │ │ ├── md5_policy.hpp │ │ ├── primes.hpp │ │ ├── sha1_policy.hpp │ │ ├── sha2_policy.hpp │ │ ├── sha_policy.hpp │ │ ├── state_adder.hpp │ │ └── unbounded_shift.hpp │ ├── digest.hpp │ ├── digest_io.hpp │ ├── md4.hpp │ ├── md5.hpp │ ├── merkle_damgard_block_hash.hpp │ ├── pack.hpp │ ├── sha.hpp │ ├── sha1.hpp │ ├── sha2.hpp │ ├── stream_endian.hpp │ └── stream_preprocessor.hpp │ ├── ietf │ └── README.md │ ├── interthread_stream.hpp │ ├── invoke_wrapper.hpp │ ├── json_parser_read.hpp │ ├── json_parser_write.hpp │ ├── logger.hpp │ ├── multihandler.hpp │ ├── splice_stream.hpp │ ├── stringencodings.hpp │ ├── timedcall.hpp │ └── urlencode.hpp ├── avbot.conf.example ├── avbot.ico ├── avbot.manifest ├── avbot.png ├── avbot.qrc ├── avbot.rc.in ├── avbot.service.in ├── avbot.svg ├── avbot_log_search.cpp ├── avbotpch.h ├── avhttpd ├── CMakeLists.txt ├── LICENSE ├── README.md ├── example │ ├── CMakeLists.txt │ └── main.cpp └── include │ ├── avhttpd.hpp │ └── avhttpd │ ├── error_code.hpp │ ├── read_request.hpp │ ├── settings.hpp │ └── write_reponse.hpp ├── backtrace.cpp ├── botctl.cpp ├── botctl.hpp ├── cmake ├── FindPythonLibsNew.cmake └── Findsystemd.cmake ├── cpacksettings.cmake ├── cxx11.cmake ├── deCAPTCHA ├── CMakeLists.txt ├── README.md ├── example │ └── decode.cpp └── include │ └── deCAPTCHA │ ├── anticaptcha_decoder.hpp │ ├── avplayer_free_decoder.hpp │ ├── deathbycaptcha_decoder.hpp │ ├── decaptcha.hpp │ ├── hydati_decoder.hpp │ └── jsdati_decoder.hpp ├── dpi.manifest ├── extension ├── CMakeLists.txt ├── README.md ├── avbot.py ├── bulletin.cpp ├── bulletin.hpp ├── dllextension.hpp ├── exchangerate.hpp ├── extension.cpp ├── extension.hpp ├── html.hpp ├── iplocation.hpp ├── joke.cpp ├── joke.hpp ├── luascript │ ├── CMakeLists.txt │ ├── libs │ │ ├── lua_libraries │ │ │ ├── json.lua │ │ │ └── json │ │ │ │ ├── decode.lua │ │ │ │ ├── decode │ │ │ │ ├── composite.lua │ │ │ │ ├── number.lua │ │ │ │ ├── others.lua │ │ │ │ ├── state.lua │ │ │ │ ├── strings.lua │ │ │ │ └── util.lua │ │ │ │ ├── encode.lua │ │ │ │ ├── encode │ │ │ │ ├── array.lua │ │ │ │ ├── calls.lua │ │ │ │ ├── number.lua │ │ │ │ ├── object.lua │ │ │ │ ├── others.lua │ │ │ │ ├── output.lua │ │ │ │ ├── output_utility.lua │ │ │ │ └── strings.lua │ │ │ │ └── util.lua │ │ ├── luascript │ │ │ ├── TALK.lua │ │ │ ├── bet.lua │ │ │ ├── dictionary.lua │ │ │ ├── dnddice.lua │ │ │ ├── dnddice_detail.lua │ │ │ ├── escape.lua │ │ │ ├── fate.lua │ │ │ ├── fruit.lua │ │ │ ├── getlink.lua │ │ │ ├── godmachine.lua │ │ │ ├── help.lua │ │ │ ├── knight.lua │ │ │ ├── ppg.lua │ │ │ ├── random.lua │ │ │ ├── rememberip.lua │ │ │ ├── roll.lua │ │ │ ├── ronind10.lua │ │ │ ├── router.lua │ │ │ ├── rss.lua │ │ │ ├── scp.lua │ │ │ ├── seventhsea.lua │ │ │ ├── tishen.lua │ │ │ ├── trim.lua │ │ │ ├── wiki.lua │ │ │ ├── woddice.lua │ │ │ └── zhan.lua │ │ └── main.lua │ ├── lpeg-0.11 │ │ ├── HISTORY │ │ ├── lpcap.c │ │ ├── lpcap.h │ │ ├── lpcode.c │ │ ├── lpcode.h │ │ ├── lpeg-128.gif │ │ ├── lpeg.html │ │ ├── lpprint.c │ │ ├── lpprint.h │ │ ├── lptree.c │ │ ├── lptree.h │ │ ├── lptypes.h │ │ ├── lpvm.c │ │ ├── lpvm.h │ │ ├── makefile │ │ ├── re.html │ │ ├── re.lua │ │ └── test.lua │ ├── luabind │ │ ├── INSTALL │ │ ├── Jamroot │ │ ├── LICENSE │ │ ├── doc │ │ │ ├── adopt.rst │ │ │ ├── building.rst │ │ │ ├── changes.txt │ │ │ ├── copy.rst │ │ │ ├── dependency.rst │ │ │ ├── discard_result.rst │ │ │ ├── docs.html │ │ │ ├── docs.rst │ │ │ ├── index.html │ │ │ ├── luabind-logo-label.ps │ │ │ ├── luabind.png │ │ │ ├── out_value.rst │ │ │ ├── pure_out_value.rst │ │ │ ├── raw.rst │ │ │ ├── return_reference_to.rst │ │ │ ├── return_stl_iterator.rst │ │ │ ├── style.css │ │ │ ├── version.rst │ │ │ └── yield.rst │ │ ├── examples │ │ │ ├── any_converter │ │ │ │ ├── Jamfile │ │ │ │ └── any_converter.cpp │ │ │ ├── cln │ │ │ │ ├── README │ │ │ │ ├── cln_test.cpp │ │ │ │ └── cln_test.lua │ │ │ ├── filesystem │ │ │ │ ├── Jamfile │ │ │ │ ├── directory_iterator.hpp │ │ │ │ ├── filesystem.cpp │ │ │ │ └── inspect.lua │ │ │ ├── glut │ │ │ │ ├── Jamfile │ │ │ │ ├── glut_bind.cpp │ │ │ │ └── glut_bindings.lua │ │ │ ├── hello_world │ │ │ │ ├── Jamfile │ │ │ │ ├── README │ │ │ │ ├── hello_world.cpp │ │ │ │ └── project-root.jam │ │ │ ├── intrusive_ptr │ │ │ │ ├── Jamfile │ │ │ │ └── intrusive_ptr.cpp │ │ │ └── regexp │ │ │ │ ├── Jamfile │ │ │ │ ├── regex.lua │ │ │ │ └── regex_wrap.cpp │ │ ├── luabind │ │ │ ├── adopt_policy.hpp │ │ │ ├── back_reference.hpp │ │ │ ├── back_reference_fwd.hpp │ │ │ ├── class.hpp │ │ │ ├── class_info.hpp │ │ │ ├── config.hpp │ │ │ ├── container_policy.hpp │ │ │ ├── copy_policy.hpp │ │ │ ├── dependency_policy.hpp │ │ │ ├── detail │ │ │ │ ├── calc_arity.hpp │ │ │ │ ├── call.hpp │ │ │ │ ├── call_function.hpp │ │ │ │ ├── call_member.hpp │ │ │ │ ├── call_operator_iterate.hpp │ │ │ │ ├── class_cache.hpp │ │ │ │ ├── class_registry.hpp │ │ │ │ ├── class_rep.hpp │ │ │ │ ├── compute_score.hpp │ │ │ │ ├── constructor.hpp │ │ │ │ ├── conversion_storage.hpp │ │ │ │ ├── convert_to_lua.hpp │ │ │ │ ├── debug.hpp │ │ │ │ ├── decorate_type.hpp │ │ │ │ ├── deduce_signature.hpp │ │ │ │ ├── enum_maker.hpp │ │ │ │ ├── format_signature.hpp │ │ │ │ ├── garbage_collector.hpp │ │ │ │ ├── has_get_pointer.hpp │ │ │ │ ├── inheritance.hpp │ │ │ │ ├── instance_holder.hpp │ │ │ │ ├── is_indirect_const.hpp │ │ │ │ ├── link_compatibility.hpp │ │ │ │ ├── make_instance.hpp │ │ │ │ ├── most_derived.hpp │ │ │ │ ├── object_call.hpp │ │ │ │ ├── object_funs.hpp │ │ │ │ ├── object_rep.hpp │ │ │ │ ├── open.hpp │ │ │ │ ├── operator_id.hpp │ │ │ │ ├── other.hpp │ │ │ │ ├── pcall.hpp │ │ │ │ ├── pointee_sizeof.hpp │ │ │ │ ├── pointee_typeid.hpp │ │ │ │ ├── policy.hpp │ │ │ │ ├── primitives.hpp │ │ │ │ ├── property.hpp │ │ │ │ ├── ref.hpp │ │ │ │ ├── signature_match.hpp │ │ │ │ ├── stack_utils.hpp │ │ │ │ ├── typetraits.hpp │ │ │ │ └── yes_no.hpp │ │ │ ├── discard_result_policy.hpp │ │ │ ├── error.hpp │ │ │ ├── exception_handler.hpp │ │ │ ├── from_stack.hpp │ │ │ ├── function.hpp │ │ │ ├── get_main_thread.hpp │ │ │ ├── get_pointer.hpp │ │ │ ├── handle.hpp │ │ │ ├── iterator_policy.hpp │ │ │ ├── lua_include.hpp │ │ │ ├── luabind.hpp │ │ │ ├── make_function.hpp │ │ │ ├── nil.hpp │ │ │ ├── object.hpp │ │ │ ├── open.hpp │ │ │ ├── operator.hpp │ │ │ ├── out_value_policy.hpp │ │ │ ├── prefix.hpp │ │ │ ├── raw_policy.hpp │ │ │ ├── return_reference_to_policy.hpp │ │ │ ├── scope.hpp │ │ │ ├── shared_ptr_converter.hpp │ │ │ ├── tag_function.hpp │ │ │ ├── typeid.hpp │ │ │ ├── value_wrapper.hpp │ │ │ ├── version.hpp │ │ │ ├── weak_ref.hpp │ │ │ ├── wrapper_base.hpp │ │ │ └── yield_policy.hpp │ │ ├── src │ │ │ ├── class.cpp │ │ │ ├── class_info.cpp │ │ │ ├── class_registry.cpp │ │ │ ├── class_rep.cpp │ │ │ ├── create_class.cpp │ │ │ ├── error.cpp │ │ │ ├── exception_handler.cpp │ │ │ ├── function.cpp │ │ │ ├── inheritance.cpp │ │ │ ├── link_compatibility.cpp │ │ │ ├── object_rep.cpp │ │ │ ├── open.cpp │ │ │ ├── pcall.cpp │ │ │ ├── scope.cpp │ │ │ ├── stack_content_by_name.cpp │ │ │ ├── weak_ref.cpp │ │ │ └── wrapper_base.cpp │ │ └── test │ │ │ ├── Jamfile │ │ │ ├── benchmark.cpp │ │ │ ├── main.cpp │ │ │ ├── test.hpp │ │ │ ├── test_abstract_base.cpp │ │ │ ├── test_adopt.cpp │ │ │ ├── test_adopt_wrapper.cpp │ │ │ ├── test_attributes.cpp │ │ │ ├── test_automatic_smart_ptr.cpp │ │ │ ├── test_back_reference.cpp │ │ │ ├── test_builtin_converters.cpp │ │ │ ├── test_class_info.cpp │ │ │ ├── test_collapse_converter.cpp │ │ │ ├── test_const.cpp │ │ │ ├── test_construction.cpp │ │ │ ├── test_create_in_thread.cpp │ │ │ ├── test_def_from_base.cpp │ │ │ ├── test_dynamic_type.cpp │ │ │ ├── test_exception_handlers.cpp │ │ │ ├── test_exceptions.cpp │ │ │ ├── test_extend_class_in_lua.cpp │ │ │ ├── test_free_functions.cpp │ │ │ ├── test_has_get_pointer.cpp │ │ │ ├── test_held_type.cpp │ │ │ ├── test_implicit_cast.cpp │ │ │ ├── test_implicit_raw.cpp │ │ │ ├── test_iterator.cpp │ │ │ ├── test_lua_classes.cpp │ │ │ ├── test_null_pointer.cpp │ │ │ ├── test_object.cpp │ │ │ ├── test_operators.cpp │ │ │ ├── test_policies.cpp │ │ │ ├── test_private_destructors.cpp │ │ │ ├── test_properties.cpp │ │ │ ├── test_scope.cpp │ │ │ ├── test_separation.cpp │ │ │ ├── test_set_instance_value.cpp │ │ │ ├── test_shadow.cpp │ │ │ ├── test_shared_ptr.cpp │ │ │ ├── test_simple_class.cpp │ │ │ ├── test_smart_ptr_attributes.cpp │ │ │ ├── test_super_leak.cpp │ │ │ ├── test_table.cpp │ │ │ ├── test_tag_function.cpp │ │ │ ├── test_typetraits.cpp │ │ │ ├── test_unsigned_int.cpp │ │ │ ├── test_user_defined_converter.cpp │ │ │ ├── test_value_wrapper.cpp │ │ │ ├── test_vector_of_object.cpp │ │ │ ├── test_virtual_inheritance.cpp │ │ │ └── test_yield.cpp │ ├── luainclude │ │ └── luajit-2.0 │ │ │ ├── lauxlib.h │ │ │ ├── lua.h │ │ │ ├── lua.hpp │ │ │ ├── luaconf.h │ │ │ ├── luajit.h │ │ │ └── lualib.h │ ├── luascript.cpp │ ├── luascript.hpp │ ├── msvc_x64 │ │ ├── lua.def │ │ ├── lua51.def │ │ ├── lua51.exp │ │ └── lua51.lib │ └── msvc_x86 │ │ ├── lua51.def │ │ ├── lua51.exp │ │ └── lua51.lib ├── metalprice.hpp ├── pythonscriptengine.cpp ├── pythonscriptengine.hpp ├── staticcontent.cpp ├── staticcontent.hpp ├── stockprice.hpp ├── urlpreview.cpp └── urlpreview.hpp ├── input.cpp ├── input.hpp ├── libavbot ├── CMakeLists.txt ├── README.md ├── avaccount.hpp ├── avbot.cpp ├── avbot.hpp ├── avchannel.cpp └── avchannel.hpp ├── libavlog ├── CMakeLists.txt ├── avlog.cpp └── avlog.hpp ├── main.cpp ├── minidump.cpp ├── protocols ├── CMakeLists.txt ├── libavim_group │ ├── CMakeLists.txt │ ├── include │ │ └── avim_group.hpp │ └── src │ │ ├── avim_group.cpp │ │ ├── avim_group_impl.cpp │ │ └── avim_group_impl.hpp ├── libirc │ ├── CMakeLists.txt │ ├── include │ │ └── irc.hpp │ ├── src │ │ └── irc.cpp │ └── test.cpp ├── libmailexchange │ ├── CMakeLists.txt │ ├── FindICU.cmake │ ├── internet_mail_format.hpp │ ├── mx.hpp │ ├── pop3.cpp │ ├── pop3.hpp │ ├── pop3test.cpp │ ├── smtp.cpp │ ├── smtp.hpp │ └── smtptest.cpp ├── libwebqq │ ├── CMakeLists.txt │ ├── README.en.md │ ├── README.md │ ├── encrypt.js │ ├── include │ │ └── libwebqq │ │ │ ├── error_code.hpp │ │ │ └── webqq.hpp │ ├── js │ │ ├── comm.js │ │ ├── compat.js │ │ ├── md.js │ │ ├── mq.js │ │ └── test.js │ └── src │ │ ├── error_code.cpp │ │ ├── impl │ │ ├── buddy_mgr.cpp │ │ ├── buddy_mgr.hpp │ │ ├── constant.hpp │ │ ├── cookie_mgr.hpp │ │ ├── group_message_sender.hpp │ │ ├── lwqq_status.hpp │ │ ├── process_group_msg.hpp │ │ ├── webqq_buddy_info.hpp │ │ ├── webqq_check_login.hpp │ │ ├── webqq_face.cpp │ │ ├── webqq_group_list.hpp │ │ ├── webqq_group_member.hpp │ │ ├── webqq_group_qqnumber.hpp │ │ ├── webqq_hash.cpp │ │ ├── webqq_hash.hpp │ │ ├── webqq_impl.cpp │ │ ├── webqq_impl.hpp │ │ ├── webqq_keepalive.hpp │ │ ├── webqq_login.cpp │ │ ├── webqq_login.hpp │ │ ├── webqq_loop.cpp │ │ ├── webqq_loop.hpp │ │ ├── webqq_poll_message.hpp │ │ ├── webqq_send_offfile.hpp │ │ ├── webqq_status.hpp │ │ ├── webqq_verify_image.hpp │ │ └── webqq_vfwebqq.hpp │ │ └── webqq.cpp └── libxmpp │ ├── CMakeLists.txt │ ├── include │ └── libxmpp │ │ └── xmpp.hpp │ └── src │ ├── test.cpp │ ├── xmpp.cpp │ ├── xmpp_impl.cpp │ └── xmpp_impl.hpp ├── resource.h ├── rpc ├── CMakeLists.txt ├── avbotrpc_adaptor.cpp ├── avbotrpc_adaptor.h ├── dbusrpc.cpp ├── dbusrpc.hpp ├── org.avplayer.avbot.xml ├── server.cpp └── server.hpp ├── spirit.cpp ├── third_party ├── gloox │ ├── AUTHORS │ ├── CMakeLists.txt │ ├── COPYING │ ├── ChangeLog │ ├── Doxyfile │ ├── INSTALL │ ├── LICENSE │ ├── Makefile.am │ ├── Makefile.in │ ├── NEWS │ ├── README │ ├── README.symbian │ ├── README.win32 │ ├── README.wince │ ├── TODO │ ├── UPGRADING │ ├── acinclude.m4 │ ├── aclocal.m4 │ ├── bld.inf │ ├── config.guess │ ├── config.h.symbian │ ├── config.h.unix │ ├── config.h.unix.in │ ├── config.h.win │ ├── config.sub │ ├── configure │ ├── configure.ac │ ├── depcomp │ ├── gloox-config.in │ ├── gloox.cbp │ ├── gloox.dsp │ ├── gloox.mmp │ ├── gloox.pc.in │ ├── gloox.vcproj │ ├── gloox │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── adhoc.cpp │ │ ├── adhoc.h │ │ ├── adhoccommandprovider.h │ │ ├── adhochandler.h │ │ ├── adhocplugin.h │ │ ├── amp.cpp │ │ ├── amp.h │ │ ├── annotations.cpp │ │ ├── annotations.h │ │ ├── annotationshandler.h │ │ ├── atomicrefcount.cpp │ │ ├── atomicrefcount.h │ │ ├── attention.cpp │ │ ├── attention.h │ │ ├── base64.cpp │ │ ├── base64.h │ │ ├── bookmarkhandler.h │ │ ├── bookmarkstorage.cpp │ │ ├── bookmarkstorage.h │ │ ├── bytestream.h │ │ ├── bytestreamdatahandler.h │ │ ├── bytestreamhandler.h │ │ ├── capabilities.cpp │ │ ├── capabilities.h │ │ ├── carbons.cpp │ │ ├── carbons.h │ │ ├── chatstate.cpp │ │ ├── chatstate.h │ │ ├── chatstatefilter.cpp │ │ ├── chatstatefilter.h │ │ ├── chatstatehandler.h │ │ ├── client.cpp │ │ ├── client.h │ │ ├── clientbase.cpp │ │ ├── clientbase.h │ │ ├── component.cpp │ │ ├── component.h │ │ ├── compressionbase.h │ │ ├── compressiondatahandler.h │ │ ├── compressiondefault.cpp │ │ ├── compressiondefault.h │ │ ├── compressionzlib.cpp │ │ ├── compressionzlib.h │ │ ├── config.h │ │ ├── connectionbase.h │ │ ├── connectionbosh.cpp │ │ ├── connectionbosh.h │ │ ├── connectiondatahandler.h │ │ ├── connectionhandler.h │ │ ├── connectionhttpproxy.cpp │ │ ├── connectionhttpproxy.h │ │ ├── connectionlistener.h │ │ ├── connectionsocks5proxy.cpp │ │ ├── connectionsocks5proxy.h │ │ ├── connectiontcpbase.cpp │ │ ├── connectiontcpbase.h │ │ ├── connectiontcpclient.cpp │ │ ├── connectiontcpclient.h │ │ ├── connectiontcpserver.cpp │ │ ├── connectiontcpserver.h │ │ ├── connectiontls.cpp │ │ ├── connectiontls.h │ │ ├── connectiontlsserver.cpp │ │ ├── connectiontlsserver.h │ │ ├── dataform.cpp │ │ ├── dataform.h │ │ ├── dataformfield.cpp │ │ ├── dataformfield.h │ │ ├── dataformfieldcontainer.cpp │ │ ├── dataformfieldcontainer.h │ │ ├── dataformitem.cpp │ │ ├── dataformitem.h │ │ ├── dataformreported.cpp │ │ ├── dataformreported.h │ │ ├── delayeddelivery.cpp │ │ ├── delayeddelivery.h │ │ ├── disco.cpp │ │ ├── disco.h │ │ ├── discohandler.h │ │ ├── disconodehandler.h │ │ ├── dns.cpp │ │ ├── dns.h │ │ ├── error.cpp │ │ ├── error.h │ │ ├── event.h │ │ ├── eventdispatcher.cpp │ │ ├── eventdispatcher.h │ │ ├── eventhandler.h │ │ ├── featureneg.cpp │ │ ├── featureneg.h │ │ ├── flexoff.cpp │ │ ├── flexoff.h │ │ ├── flexoffhandler.h │ │ ├── forward.cpp │ │ ├── forward.h │ │ ├── gloox.cpp │ │ ├── gloox.h │ │ ├── glooxversion.h │ │ ├── gpgencrypted.cpp │ │ ├── gpgencrypted.h │ │ ├── gpgsigned.cpp │ │ ├── gpgsigned.h │ │ ├── inbandbytestream.cpp │ │ ├── inbandbytestream.h │ │ ├── instantmucroom.cpp │ │ ├── instantmucroom.h │ │ ├── iodata.cpp │ │ ├── iodata.h │ │ ├── iq.cpp │ │ ├── iq.h │ │ ├── iqhandler.h │ │ ├── jid.cpp │ │ ├── jid.h │ │ ├── jinglecontent.cpp │ │ ├── jinglecontent.h │ │ ├── jinglefiletransfer.cpp │ │ ├── jinglefiletransfer.h │ │ ├── jingleiceudp.cpp │ │ ├── jingleiceudp.h │ │ ├── jingleplugin.h │ │ ├── jinglepluginfactory.cpp │ │ ├── jinglepluginfactory.h │ │ ├── jinglesession.cpp │ │ ├── jinglesession.h │ │ ├── jinglesessionhandler.h │ │ ├── jinglesessionmanager.cpp │ │ ├── jinglesessionmanager.h │ │ ├── lastactivity.cpp │ │ ├── lastactivity.h │ │ ├── lastactivityhandler.h │ │ ├── linklocal.h │ │ ├── linklocalclient.cpp │ │ ├── linklocalclient.h │ │ ├── linklocalhandler.h │ │ ├── linklocalmanager.cpp │ │ ├── linklocalmanager.h │ │ ├── loghandler.h │ │ ├── logsink.cpp │ │ ├── logsink.h │ │ ├── macros.h │ │ ├── md5.cpp │ │ ├── md5.h │ │ ├── message.cpp │ │ ├── message.h │ │ ├── messageevent.cpp │ │ ├── messageevent.h │ │ ├── messageeventfilter.cpp │ │ ├── messageeventfilter.h │ │ ├── messageeventhandler.h │ │ ├── messagefilter.cpp │ │ ├── messagefilter.h │ │ ├── messagehandler.h │ │ ├── messagesession.cpp │ │ ├── messagesession.h │ │ ├── messagesessionhandler.h │ │ ├── mucinvitationhandler.cpp │ │ ├── mucinvitationhandler.h │ │ ├── mucmessagesession.cpp │ │ ├── mucmessagesession.h │ │ ├── mucroom.cpp │ │ ├── mucroom.h │ │ ├── mucroomconfighandler.h │ │ ├── mucroomhandler.h │ │ ├── mutex.cpp │ │ ├── mutex.h │ │ ├── mutexguard.h │ │ ├── nickname.cpp │ │ ├── nickname.h │ │ ├── nonsaslauth.cpp │ │ ├── nonsaslauth.h │ │ ├── oob.cpp │ │ ├── oob.h │ │ ├── parser.cpp │ │ ├── parser.h │ │ ├── prep.cpp │ │ ├── prep.h │ │ ├── presence.cpp │ │ ├── presence.h │ │ ├── presencehandler.h │ │ ├── privacyitem.cpp │ │ ├── privacyitem.h │ │ ├── privacylisthandler.h │ │ ├── privacymanager.cpp │ │ ├── privacymanager.h │ │ ├── privatexml.cpp │ │ ├── privatexml.h │ │ ├── privatexmlhandler.h │ │ ├── pubsub.h │ │ ├── pubsubevent.cpp │ │ ├── pubsubevent.h │ │ ├── pubsubitem.cpp │ │ ├── pubsubitem.h │ │ ├── pubsubmanager.cpp │ │ ├── pubsubmanager.h │ │ ├── pubsubresulthandler.h │ │ ├── receipt.cpp │ │ ├── receipt.h │ │ ├── registration.cpp │ │ ├── registration.h │ │ ├── registrationhandler.h │ │ ├── resource.h │ │ ├── rosteritem.cpp │ │ ├── rosteritem.h │ │ ├── rosteritemdata.h │ │ ├── rosterlistener.h │ │ ├── rostermanager.cpp │ │ ├── rostermanager.h │ │ ├── search.cpp │ │ ├── search.h │ │ ├── searchhandler.h │ │ ├── sha.cpp │ │ ├── sha.h │ │ ├── shim.cpp │ │ ├── shim.h │ │ ├── sihandler.h │ │ ├── simanager.cpp │ │ ├── simanager.h │ │ ├── siprofileft.cpp │ │ ├── siprofileft.h │ │ ├── siprofilefthandler.h │ │ ├── siprofilehandler.h │ │ ├── socks5bytestream.cpp │ │ ├── socks5bytestream.h │ │ ├── socks5bytestreammanager.cpp │ │ ├── socks5bytestreammanager.h │ │ ├── socks5bytestreamserver.cpp │ │ ├── socks5bytestreamserver.h │ │ ├── softwareversion.cpp │ │ ├── softwareversion.h │ │ ├── stanza.cpp │ │ ├── stanza.h │ │ ├── stanzaextension.h │ │ ├── stanzaextensionfactory.cpp │ │ ├── stanzaextensionfactory.h │ │ ├── statisticshandler.h │ │ ├── subscription.cpp │ │ ├── subscription.h │ │ ├── subscriptionhandler.h │ │ ├── tag.cpp │ │ ├── tag.h │ │ ├── taghandler.h │ │ ├── tlsbase.h │ │ ├── tlsdefault.cpp │ │ ├── tlsdefault.h │ │ ├── tlsgnutlsbase.cpp │ │ ├── tlsgnutlsbase.h │ │ ├── tlsgnutlsclient.cpp │ │ ├── tlsgnutlsclient.h │ │ ├── tlsgnutlsclientanon.cpp │ │ ├── tlsgnutlsclientanon.h │ │ ├── tlsgnutlsserveranon.cpp │ │ ├── tlsgnutlsserveranon.h │ │ ├── tlshandler.h │ │ ├── tlsopensslbase.cpp │ │ ├── tlsopensslbase.h │ │ ├── tlsopensslclient.cpp │ │ ├── tlsopensslclient.h │ │ ├── tlsopensslserver.cpp │ │ ├── tlsopensslserver.h │ │ ├── tlsschannel.cpp │ │ ├── tlsschannel.h │ │ ├── uniquemucroom.cpp │ │ ├── uniquemucroom.h │ │ ├── util.cpp │ │ ├── util.h │ │ ├── vcard.cpp │ │ ├── vcard.h │ │ ├── vcardhandler.h │ │ ├── vcardmanager.cpp │ │ ├── vcardmanager.h │ │ ├── vcardupdate.cpp │ │ ├── vcardupdate.h │ │ ├── version.rc │ │ ├── xhtmlim.cpp │ │ └── xhtmlim.h │ ├── install-sh │ ├── ltmain.sh │ └── missing ├── qqwry │ ├── CMakeLists.txt │ ├── License.txt │ ├── README.md │ ├── include │ │ └── qqwry │ │ │ └── ipdb.hpp │ ├── miniz.c │ ├── qqwry.sln │ ├── test │ │ └── test.cpp │ ├── vcproject │ │ └── getip │ │ │ ├── getip.vcxproj │ │ │ └── getip.vcxproj.filters │ └── 说明.txt └── sqlite │ ├── CMakeLists.txt │ ├── include │ ├── sqlite3.h │ └── sqlite3ext.h │ └── lib │ └── sqlite3.c ├── tweakvcflasgs.cmake ├── tweet.wav ├── ui ├── CMakeLists.txt ├── include │ └── avbotui.hpp ├── src │ ├── avbotui.cpp │ ├── cli │ │ ├── CMakeLists.txt │ │ ├── avbotcli.cpp │ │ └── avbotcli.hpp │ └── qt-gui │ │ ├── CMakeLists.txt │ │ ├── avbotqtui_impl.cpp │ │ ├── avbotqtui_impl.hpp │ │ ├── qcenteredimageview.hpp │ │ ├── qtgui.cpp │ │ ├── qtgui.hpp │ │ ├── vc_input_dialog.cpp │ │ ├── vc_input_dialog.hpp │ │ └── vc_input_dialog.ui └── uifactory.cpp ├── ui_decoder.hpp └── version.c.in /AUTHORS: -------------------------------------------------------------------------------- 1 | microcai microcaicai@gmail.com 2 | Jack jack.wgm@gmail.com 3 | InvXp invidentssc@hotmail.com 4 | 海盗 lovey599@gmail.com 5 | Bob Xiang btbxbob@gmail.com 6 | eahydra xxeaglenet@gmail.com 7 | hyq huangyangqi@gmail.com 8 | kiki kiki.caicai@gmail.com 9 | mrshelly mrshelly@hotmail.com 10 | Tom Li biergaizi2009@gmail.com 11 | zh99998 zh99998@gmail.com 12 | 放羊娃 xxeaglenet@gmail.com 13 | -------------------------------------------------------------------------------- /avboost/README.md: -------------------------------------------------------------------------------- 1 | avboost 2 | ======= 3 | 4 | some templates that's very very useful during development. 5 | 6 | avboost 是一些在开发 avplayer 的项目过程中编写的极其有用的方便的小模板工具库的集合. 是对 Boost 库的一个补充. 7 | 8 | 包括但不限于 9 | 10 | 11 | * base64 编解码 12 | * cfunction 封装 boost::funcion 为 C 接口的回调. 13 | * async\_coro\_queue 协程使用的异步列队. 14 | * async\_foreach 协程并发的 for\_each 版本 15 | * async\_dir\_walk 利用协程并发的 for\_each 版本实现的异步文件夹遍历. 16 | * acceptor\_server 一个简单的 accepter 用于接受TCP连接. 17 | * avloop 为 asio 添加 idle 回调. 当 io\_service 没事情干的时候调用回调. 18 | * timedcall 简单的 asio deadline\_timer 封装. 用于延时执行一个任务. 19 | * hash 来自 boost.sandbox 的 哈希编码, 支持 SHA1 MD5 20 | * multihandler 一个回调封装, 用于 指定的回调发生N次后调用真正的回调. 21 | * json\_create\_escapes\_utf8.hpp 在使用 boost 的 json 编码器的时候, 包含这个头文件, 可以让 boost 的 json 编码器输出未经过转码的utf8文本 22 | * urlencode.hpp 用于 url 的编码, 将非允许字符使用 % 编码. 23 | * consolestr.hpp 用于将UTF-8字符串转码为本地控制台的字体编码以输出不乱码. 因 linux 和 windows 的控制台编码不一样而引入 24 | * avproxy.hpp asio 的helper, 用于一行代码完成 dns 解析+主机连接+代理协商 25 | 26 | 27 | avproxy 28 | ======= 29 | 30 | asio based async proxy connector 31 | 32 | avproxy is used to make async connections with or without proxyes in one single line of code. 33 | 34 | avproxy 用于在一行代码之内异步发起通过代理和不通过代理的TCP链接 35 | 36 | avproxy support nested proxy aka proxy behind proxy. 37 | 38 | avproxy 支持代理嵌套,能以“代理套代理”的方式发起链接。 39 | 40 | avproxy is as simple as one line call to avproxy::async\_proxy\_connect. 41 | 42 | avproxy 的使用非常简单,调用 avproxy::async\_proxy\_connect 即可。 43 | 44 | async\_proxyconnect 需要的 proxychain 参数可以使用 avproxy::autoproxychain 自动从环境变量构建 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /avboost/example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | find_package(Threads) 3 | 4 | add_executable( test1 autoproxy.cpp) 5 | add_executable( test2 multi_proxychain.cpp) 6 | 7 | target_link_libraries( test1 ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) 8 | target_link_libraries( test2 ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) -------------------------------------------------------------------------------- /avboost/example/autoproxy.cpp: -------------------------------------------------------------------------------- 1 |  2 | /*** 3 | * 4 | * autoproxy.cpp 5 | * 6 | * avproxy 示例 - 使用 avproxy::autoproxychain 自动从 环境变了构建 proxychain 7 | * 8 | */ 9 | 10 | #include "avproxy.hpp" 11 | 12 | 13 | 14 | static void connected(const boost::system::error_code & ec, boost::asio::ip::tcp::socket & msocket) 15 | { 16 | if ( ec ) 17 | std::cout << ec.message() << std::endl; 18 | else 19 | msocket.write_some(boost::asio::buffer(std::string("GET / HTTP/1.1\r\n\r\n"))); 20 | } 21 | 22 | int main() 23 | { 24 | boost::asio::io_service io_service; 25 | boost::asio::ip::tcp::socket msocket(io_service); 26 | 27 | // 支持环境变量 socks5_proxy/ http_proxy 哦! 28 | // avproxy::autoproxychain 构建一个 proxychain 29 | // avproxy::autoproxychain 支持环境变量 socks5_proxy/ http_proxy, 要更精确的控制,请自己构建 30 | // proxychain 做为参数. 31 | avproxy::async_proxy_connect( 32 | avproxy::autoproxychain(msocket, avproxy::proxy::tcp::query("www.google.com", "81")), 33 | boost::bind(&connected, boost::asio::placeholders::error, boost::ref(msocket)) 34 | ); 35 | io_service.run(); 36 | } -------------------------------------------------------------------------------- /avboost/example/multi_proxychain.cpp: -------------------------------------------------------------------------------- 1 |  2 | /*** 3 | * 4 | * multi_proxychain.cpp 5 | * 6 | * avproxy 示例 - 使用 avproxy::proxychain 进行代理嵌套 7 | * 8 | * 9 | * testclient -> socks5 proxy 10 | * -> http proxy 11 | * -> target host 12 | * 13 | */ 14 | 15 | #include "avproxy.hpp" 16 | 17 | 18 | static void connected(const boost::system::error_code & ec, boost::asio::ip::tcp::socket & msocket) 19 | { 20 | if ( ec ) 21 | std::cout << ec.message() << std::endl; 22 | else 23 | msocket.write_some(boost::asio::buffer(std::string("GET / HTTP/1.1\r\n\r\n"))); 24 | } 25 | 26 | int main() 27 | { 28 | boost::asio::io_service io_service; 29 | boost::asio::ip::tcp::socket msocket(io_service); 30 | 31 | avproxy::proxy_chain proxychain(io_service); 32 | proxychain.add(avproxy::proxy::tcp(msocket, boost::asio::ip::tcp::resolver::query("mysocks5proxy.me", "1080"))); 33 | proxychain.add(avproxy::proxy::socks5(msocket, boost::asio::ip::tcp::resolver::query("myhttpproxy.me", "8080"))); 34 | proxychain.add(avproxy::proxy::http(msocket, boost::asio::ip::tcp::resolver::query("www.google.com", "80"))); 35 | 36 | avproxy::async_proxy_connect( 37 | proxychain, boost::bind(&connected, boost::asio::placeholders::error, boost::ref(msocket)) 38 | ); 39 | io_service.run(); 40 | } -------------------------------------------------------------------------------- /avboost/include/boost/async_dir_walk.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace boost{ 11 | namespace detail{ 12 | 13 | class DirWalkDumyHandler{ 14 | public: 15 | void operator()(boost::system::error_code ec){} 16 | }; 17 | 18 | } // namespace detail 19 | 20 | typedef function async_dir_walk_continue_handler; 21 | 22 | template 23 | void async_dir_walk(boost::asio::io_service & io_service, boost::filesystem::path path, DirWalkHandler dir_walk_handler, CompleteHandler complete_handler) 24 | { 25 | async_foreach(io_service, boost::filesystem::directory_iterator(path), boost::filesystem::directory_iterator(), dir_walk_handler, complete_handler); 26 | } 27 | 28 | template 29 | void async_dir_walk(boost::asio::io_service & io_service, boost::filesystem::path path, DirWalkHandler dir_walk_handler) 30 | { 31 | async_dir_walk(io_service, path, dir_walk_handler, detail::DirWalkDumyHandler()); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /avboost/include/boost/avproxy.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "avproxy/avproxy.hpp" 4 | -------------------------------------------------------------------------------- /avboost/include/boost/avproxy/avproxy.hpp: -------------------------------------------------------------------------------- 1 |  2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #ifdef BOOST_ENABLE_SSL 9 | #include 10 | #endif 11 | 12 | 13 | #include "detail/connect_condition.hpp" 14 | #include "detail/proxy_chain.hpp" 15 | 16 | #include "proxy_connect.hpp" 17 | #include "proxies.hpp" 18 | #include "auto_proxychain.hpp" 19 | -------------------------------------------------------------------------------- /avboost/include/boost/avproxy/detail/connect_condition.hpp: -------------------------------------------------------------------------------- 1 |  2 | #pragma once 3 | 4 | 5 | namespace avproxy { 6 | 7 | namespace detail{ 8 | 9 | struct avproxy_default_connect_condition{ 10 | template 11 | Iterator operator()( 12 | const boost::system::error_code& ec, 13 | Iterator next) 14 | { 15 | return next; 16 | } 17 | }; 18 | 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /avboost/include/boost/avproxy/detail/proxy_error_mapper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace avproxy{ 6 | 7 | namespace proxy{ 8 | 9 | namespace detail{ 10 | template 11 | void proxy_error_mapper(const boost::system::error_code & _ec, Handler handler) 12 | { 13 | boost::system::error_code ec = _ec; 14 | if (ec == boost::asio::error::connection_refused) 15 | { 16 | ec = avproxy::error::make_error_code(avproxy::error::proxy_connection_refused); 17 | } 18 | handler(ec); 19 | } 20 | } 21 | 22 | }// proxy 23 | 24 | }// avproxy 25 | -------------------------------------------------------------------------------- /avboost/include/boost/avproxy/detail/proxy_ssl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "proxy_chain.hpp" 7 | #include "../proxy_connect.hpp" 8 | 9 | namespace avproxy{ 10 | namespace proxy{ 11 | 12 | // SSL 连接过程. 支持透过代理发起 SSL 连接哦! 13 | // TODO 14 | class proxy_ssl : public avproxy::detail::proxy_base{ 15 | public: 16 | typedef boost::asio::ip::tcp tcp; 17 | typedef tcp::resolver::query query; 18 | typedef tcp::socket socket; 19 | 20 | proxy_ssl(boost::asio::ssl::stream &stream, query _query) 21 | { 22 | 23 | } 24 | 25 | private: 26 | void _resolve(handler_type handler, proxy_chain subchain){ 27 | // 递归调用 avconnect 传递到下一层. 28 | avproxy::async_proxy_connect(subchain, handler); 29 | } 30 | 31 | void _handshake(handler_type handler, proxy_chain subchain ){ 32 | // 调用 ssl 的 async_handshake 33 | // TODO 34 | } 35 | 36 | }; 37 | 38 | } // namespace proxy 39 | } // namespace avproxy -------------------------------------------------------------------------------- /avboost/include/boost/avproxy/detail/proxy_tcp.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "proxy_chain.hpp" 4 | #include "../proxy_connect.hpp" 5 | 6 | namespace avproxy{ 7 | namespace proxy{ 8 | // 使用 TCP 发起连接. 也就是不使用代理啦. 9 | class tcp : public avproxy::detail::proxy_base { 10 | public: 11 | typedef boost::asio::ip::tcp::resolver::query query; 12 | typedef boost::asio::ip::tcp::socket socket; 13 | 14 | tcp(socket &_socket,const query & _query) 15 | :socket_(_socket), query_(_query) 16 | { 17 | } 18 | private: 19 | void _resolve(handler_type handler, proxy_chain subchain){ 20 | //handler(boost::system::error_code()); 21 | socket_.get_io_service().post(boost::asio::detail::bind_handler(handler, boost::system::error_code())); 22 | } 23 | 24 | void _handshake(handler_type handler, proxy_chain subchain ){ 25 | avproxy::async_connect(socket_, query_, handler); 26 | } 27 | 28 | socket& socket_; 29 | const query query_; 30 | }; 31 | 32 | 33 | } // namespace proxy 34 | } // namespace avproxy -------------------------------------------------------------------------------- /avboost/include/boost/avproxy/proxies.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "detail/proxy_chain.hpp" 4 | #include "detail/proxy_tcp.hpp" 5 | #include "detail/proxy_socks5.hpp" 6 | #include "detail/proxy_http.hpp" 7 | 8 | #ifdef BOOST_ENABLE_SSL 9 | #include "detail/proxy_ssl.hpp" 10 | #endif 11 | -------------------------------------------------------------------------------- /avboost/include/boost/hash.hpp: -------------------------------------------------------------------------------- 1 |  2 | // 3 | // Copyright 2010 Scott McMurray. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_HASH_HPP 10 | #define BOOST_HASH_HPP 11 | 12 | // Checksums 13 | #include 14 | #include 15 | 16 | // Cryptographic Hashes 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | // Infrastructure 25 | #include 26 | #include 27 | #include 28 | 29 | #endif // BOOST_HASH_HPP 30 | -------------------------------------------------------------------------------- /avboost/include/boost/hash/block_cyphers/detail/shacal1_policy.hpp: -------------------------------------------------------------------------------- 1 |  2 | // 3 | // Copyright 2010 Scott McMurray. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_HASH_BLOCK_CYPHERS_DETAIL_SHACAL1_POLICY_HPP 10 | #define BOOST_HASH_BLOCK_CYPHERS_DETAIL_SHACAL1_POLICY_HPP 11 | 12 | #include 13 | 14 | namespace boost { 15 | namespace hashes { 16 | namespace block_cyphers { 17 | namespace detail { 18 | 19 | typedef shacal_policy shacal1_policy; 20 | 21 | } // namespace detail 22 | } // namespace block_cyphers 23 | } // namespace hashes 24 | } // namespace boost 25 | 26 | #endif // BOOST_HASH_BLOCK_CYPHERS_DETAIL_SHACAL1_POLICY_HPP 27 | -------------------------------------------------------------------------------- /avboost/include/boost/hash/detail/basic_functions.hpp: -------------------------------------------------------------------------------- 1 |  2 | // 3 | // Copyright 2010 Scott McMurray. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_HASH_DETAIL_BASIC_FUNCTIONS_HPP 10 | #define BOOST_HASH_DETAIL_BASIC_FUNCTIONS_HPP 11 | 12 | #include 13 | 14 | namespace boost { 15 | namespace hashes { 16 | namespace detail { 17 | 18 | using block_cyphers::detail::basic_functions; 19 | 20 | } // namespace detail 21 | } // namespace hashes 22 | } // namespace boost 23 | 24 | #endif // BOOST_HASH_DETAIL_BASIC_FUNCTIONS_HPP 25 | -------------------------------------------------------------------------------- /avboost/include/boost/hash/detail/md4_policy.hpp: -------------------------------------------------------------------------------- 1 |  2 | // 3 | // Copyright 2010 Scott McMurray. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_HASH_DETAIL_MD4_POLICY_HPP 10 | #define BOOST_HASH_DETAIL_MD4_POLICY_HPP 11 | 12 | #include 13 | #include 14 | 15 | namespace boost { 16 | namespace hashes { 17 | namespace detail { 18 | 19 | struct md4_policy { 20 | 21 | typedef block_cyphers::detail::md4_policy cypher_policy; 22 | typedef cypher_policy::block_type state_type; 23 | 24 | static unsigned const digest_bits = cypher_policy::block_bits; 25 | typedef digest digest_type; 26 | 27 | struct iv_generator { 28 | state_type const & 29 | operator()() const { 30 | static state_type const H0 = {{ 31 | 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 32 | }}; 33 | return H0; 34 | } 35 | }; 36 | 37 | }; 38 | 39 | } // namespace detail 40 | } // namespace hashes 41 | } // namespace boost 42 | 43 | #endif // BOOST_HASH_DETAIL_MD4_POLICY_HPP 44 | -------------------------------------------------------------------------------- /avboost/include/boost/hash/detail/md5_policy.hpp: -------------------------------------------------------------------------------- 1 |  2 | // 3 | // Copyright 2010 Scott McMurray. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_HASH_DETAIL_MD5_POLICY_HPP 10 | #define BOOST_HASH_DETAIL_MD5_POLICY_HPP 11 | 12 | #include 13 | #include 14 | 15 | namespace boost { 16 | namespace hashes { 17 | namespace detail { 18 | 19 | struct md5_policy { 20 | 21 | typedef block_cyphers::detail::md5_policy cypher_policy; 22 | typedef cypher_policy::block_type state_type; 23 | 24 | static unsigned const digest_bits = cypher_policy::block_bits; 25 | typedef digest digest_type; 26 | 27 | struct iv_generator { 28 | state_type const & 29 | operator()() const { 30 | // Same as MD4 31 | static state_type const H0 = {{ 32 | 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 33 | }}; 34 | return H0; 35 | } 36 | }; 37 | 38 | }; 39 | 40 | } // namespace detail 41 | } // namespace hashes 42 | } // namespace boost 43 | 44 | #endif // BOOST_HASH_DETAIL_MD5_POLICY_HPP 45 | -------------------------------------------------------------------------------- /avboost/include/boost/hash/detail/sha1_policy.hpp: -------------------------------------------------------------------------------- 1 |  2 | // 3 | // Copyright 2010 Scott McMurray. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_HASH_DETAIL_SHA1_POLICY_HPP 10 | #define BOOST_HASH_DETAIL_SHA1_POLICY_HPP 11 | 12 | #include 13 | 14 | namespace boost { 15 | namespace hashes { 16 | namespace detail { 17 | 18 | typedef sha_policy sha1_policy; 19 | 20 | } // namespace detail 21 | } // namespace hashes 22 | } // namespace boost 23 | 24 | #endif // BOOST_HASH_DETAIL_SHA1_POLICY_HPP 25 | -------------------------------------------------------------------------------- /avboost/include/boost/hash/detail/sha_policy.hpp: -------------------------------------------------------------------------------- 1 |  2 | // 3 | // Copyright 2010 Scott McMurray. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_HASH_DETAIL_SHA_POLICY_HPP 10 | #define BOOST_HASH_DETAIL_SHA_POLICY_HPP 11 | 12 | #include 13 | #include 14 | 15 | namespace boost { 16 | namespace hashes { 17 | namespace detail { 18 | 19 | struct sha_policy { 20 | 21 | typedef block_cyphers::detail::shacal_policy cypher_policy; 22 | typedef cypher_policy::block_type state_type; 23 | 24 | static unsigned const digest_bits = 160; 25 | typedef digest digest_type; 26 | 27 | struct iv_generator { 28 | state_type const & 29 | operator()() const { 30 | // First 4 words are the same as MD4 31 | static state_type const H0 = {{ 32 | 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 33 | 0xc3d2e1f0, 34 | }}; 35 | return H0; 36 | } 37 | }; 38 | 39 | }; 40 | 41 | typedef sha_policy sha0_policy; 42 | 43 | } // namespace detail 44 | } // namespace hashes 45 | } // namespace boost 46 | 47 | #endif // BOOST_HASH_DETAIL_SHA_POLICY_HPP 48 | -------------------------------------------------------------------------------- /avboost/include/boost/hash/detail/state_adder.hpp: -------------------------------------------------------------------------------- 1 |  2 | // 3 | // Copyright 2010 Scott McMurray. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_HASH_DETAIL_STATE_ADDER_HPP 10 | #define BOOST_HASH_DETAIL_STATE_ADDER_HPP 11 | 12 | namespace boost { 13 | namespace hashes { 14 | namespace detail { 15 | 16 | struct state_adder { 17 | template 18 | void operator()(T &s1, T const &s2) { 19 | typedef typename T::size_type size_type; 20 | size_type n = (s2.size() < s1.size() ? s2.size() : s1.size()); 21 | for (typename T::size_type i = 0; i < n; ++i) { 22 | s1[i] += s2[i]; 23 | } 24 | } 25 | }; 26 | 27 | } // namespace detail 28 | } // namespace hashes 29 | } // namespace boost 30 | 31 | #endif // BOOST_HASH_DETAIL_STATE_ADDER_HPP 32 | -------------------------------------------------------------------------------- /avboost/include/boost/hash/detail/unbounded_shift.hpp: -------------------------------------------------------------------------------- 1 |  2 | // 3 | // Copyright 2010 Scott McMurray. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_HASH_DETAIL_UNBOUNDED_SHIFT_HPP 10 | #define BOOST_HASH_DETAIL_UNBOUNDED_SHIFT_HPP 11 | 12 | #include 13 | 14 | namespace boost { 15 | namespace hashes { 16 | namespace detail { 17 | 18 | template 19 | struct unbounded_shifter { 20 | static T shl(T x) { return unbounded_shifter::shl(T(x << 1)); } 21 | static T shr(T x) { return unbounded_shifter::shr(T(x >> 1)); } 22 | }; 23 | template 24 | struct unbounded_shifter<0, T> { 25 | static T shl(T x) { return x; } 26 | static T shr(T x) { return x; } 27 | }; 28 | 29 | template 30 | T unbounded_shl(T x) { 31 | return unbounded_shifter::shl(x); 32 | } 33 | template 34 | T unbounded_shr(T x) { 35 | return unbounded_shifter::shr(x); 36 | } 37 | 38 | template 39 | T low_bits(T x) { 40 | T highmask = unbounded_shl(~T()); 41 | return T(x & ~highmask); 42 | } 43 | 44 | } // namespace detail 45 | } // namespace hashes 46 | } // namespace boost 47 | 48 | #endif // BOOST_HASH_DETAIL_UNBOUNDED_SHIFT_HPP 49 | -------------------------------------------------------------------------------- /avboost/include/boost/hash/digest_io.hpp: -------------------------------------------------------------------------------- 1 |  2 | // 3 | // Copyright 2010 Scott McMurray. 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | #ifndef BOOST_HASH_DIGEST_IO_HPP 10 | #define BOOST_HASH_DIGEST_IO_HPP 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | namespace boost { 22 | namespace hashes { 23 | 24 | template 25 | std::ostream & 26 | operator<<(std::ostream &sink, digest const &d) { 27 | d.to_ascii(std::ostream_iterator(sink)); 28 | return sink; 29 | }; 30 | 31 | template 32 | std::istream & 33 | operator>>(std::istream &source, digest &d) { 34 | boost::array a = {{}}; 35 | for (unsigned i = 0; i < a.size(); ++i) { 36 | char c; 37 | if (!source.get(c)) { 38 | source.setstate(std::ios::failbit); 39 | break; 40 | } 41 | if (!std::isxdigit(c, source.getloc())) { 42 | source.unget(); 43 | source.setstate(std::ios::failbit); 44 | break; 45 | } 46 | 47 | if (std::isdigit(c, source.getloc())) { 48 | a[i] = (c - '0'); 49 | } else { 50 | a[i] = std::toupper(c, source.getloc()) - 'A' + 0xA; 51 | } 52 | } 53 | pack(a, d); 54 | return source; 55 | }; 56 | 57 | } // namespace hashes 58 | } // namespace boost 59 | 60 | #endif // BOOST_HASH_DIGEST_IO_HPP 61 | -------------------------------------------------------------------------------- /avboost/include/boost/ietf/README.md: -------------------------------------------------------------------------------- 1 | boost.ietf 2 | 3 | 这里打算收集所有的 IETF RFC标准的Boost风格实现,除了那些已经被 avhttp 实现的部分。当然未来可能是将 avhttp 并进来。 4 | 5 | 近期要实现的标准有 电子邮件。 6 | 7 | 8 | -------------------------------------------------------------------------------- /avboost/include/boost/invoke_wrapper.hpp: -------------------------------------------------------------------------------- 1 |  2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace boost{ 10 | namespace invoke_wrapper{ 11 | 12 | template 13 | class invoke_once; 14 | 15 | #define SV_TEXT(z, n, text) text ## n 16 | #define SV_ARG(z, n, _) Arg ## n arg ## n 17 | 18 | #define SINGLE_INVOKER(z, n, _) \ 19 | template \ 20 | struct invoke_once \ 21 | { \ 22 | typedef R(Signature)(BOOST_PP_ENUM(BOOST_PP_INC(n), SV_TEXT, Arg)); \ 23 | boost::shared_ptr m_invoked; \ 24 | boost::shared_ptr< \ 25 | boost::function \ 26 | > m_handler; \ 27 | \ 28 | invoke_once(std::function _handler) \ 29 | : m_handler(boost::make_shared< boost::function >(_handler)) \ 30 | , m_invoked(boost::make_shared(false)) \ 31 | {} \ 32 | \ 33 | R operator()(BOOST_PP_ENUM(BOOST_PP_INC(n), SV_ARG, nil)) \ 34 | { \ 35 | if(!*m_invoked) \ 36 | { \ 37 | *m_invoked = true; \ 38 | (*m_handler)(BOOST_PP_ENUM(BOOST_PP_INC(n), SV_TEXT, arg)); \ 39 | } \ 40 | } \ 41 | typedef R result_type; \ 42 | }; 43 | 44 | 45 | BOOST_PP_REPEAT_FROM_TO(0, 10, SINGLE_INVOKER, nil) 46 | 47 | 48 | } // namespcae invoke_wrapper 49 | } // namespace boost 50 | 51 | -------------------------------------------------------------------------------- /avboost/include/boost/multihandler.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace boost{ 9 | 10 | 11 | template 12 | class multihandler_op{ 13 | int org_count; 14 | boost::shared_ptr m_count; 15 | Handler m_handler; 16 | public: 17 | multihandler_op(int count, Handler handler ) 18 | : org_count(count), m_count(boost::make_shared(count)), m_handler(handler) 19 | { 20 | } 21 | 22 | 23 | void operator()() 24 | { 25 | -- (*m_count); 26 | if (*m_count==0) 27 | { 28 | m_handler(); 29 | *m_count = org_count; 30 | } 31 | } 32 | 33 | template 34 | void operator()(Arg1 arg1) 35 | { 36 | -- (*m_count); 37 | if (*m_count==0) 38 | { 39 | m_handler(arg1); 40 | *m_count = org_count; 41 | } 42 | } 43 | 44 | template 45 | void operator()(Arg1 arg1, Arg2 arg2) 46 | { 47 | -- (*m_count); 48 | if (*m_count==0) 49 | { 50 | m_handler(arg1, arg2); 51 | *m_count = org_count; 52 | } 53 | } 54 | 55 | }; 56 | 57 | template 58 | multihandler_op bindmultihandler(int count, Handler handler) 59 | { 60 | return multihandler_op(count, handler); 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /avbot.conf.example: -------------------------------------------------------------------------------- 1 | # 配置文件示例, avbot 运行的时候读取配置文件 /etc/avbot.conf 或 ~/.avbot.conf 2 | 3 | 4 | global : { 5 | # 配置阿三验证码服务 6 | antigate_host : "xxxxxxx" 7 | antigate_key : "xxxxxxxxxxxx" 8 | 9 | # 配置 log 地址 10 | logdir : "/home/cai/.qqbot/" 11 | } 12 | 13 | # 这样配置一个 QQ 帐号, 重复使用可以使用多个帐号 14 | 15 | qq : { 16 | qqnumber : "1239795499" 17 | password : "" 18 | } 19 | 20 | # 这里配置 irc, 重复使用可以配置多个 irc 帐号 21 | irc : { 22 | nick : "avbot132" 23 | rooms : { 24 | # 看到没, 之前的 avbot 无法加入 ## 打头的频道, 这个问题解决了! 25 | "#avplayer" "#gentoo-zh" 26 | } 27 | } 28 | 29 | # 这里配置 avim 群机器人, 重复使用可以配置多个 avim 帐号 30 | avim : { 31 | keyfile : "/home/cai/avbot_avim.key" 32 | certfile : "/home/cai/avbot_avim.crt" 33 | # 这个文件用来配置群成员. 34 | groupdef : "/home/cai/.qqbot/avimgroups.txt" 35 | } 36 | -------------------------------------------------------------------------------- /avbot.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/avbot.ico -------------------------------------------------------------------------------- /avbot.manifest: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | avbot 11 | 12 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /avbot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/avbot.png -------------------------------------------------------------------------------- /avbot.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | avbot.svg 4 | 5 | 6 | protocols/libwebqq/encrypt.js 7 | 8 | 9 | -------------------------------------------------------------------------------- /avbot.rc.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/avbot.rc.in -------------------------------------------------------------------------------- /avbot.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=avbot bridges QQ/IRC/XMPP world together 3 | Wants=network-online.target 4 | 5 | [Service] 6 | Type=simple 7 | ExecStart=@CMAKE_INSTALL_PREFIX@/bin/avbot --nostdin 8 | RestartSec=1s 9 | Restart=on-failure 10 | Environment=LANG=en_US.UTF-8 11 | Environment=TZ=Asia/Shanghai 12 | WatchdogSec=12h 13 | NotifyAccess=all 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /avbotpch.h: -------------------------------------------------------------------------------- 1 | 2 | #ifdef _MSC_VER 3 | #include 4 | #else 5 | #include 6 | #endif 7 | #ifdef _WIN32 8 | #include 9 | #include 10 | #include 11 | #endif 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | namespace fs = boost::filesystem; 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include 43 | -------------------------------------------------------------------------------- /avhttpd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 2.6) 3 | 4 | project(avhttpd) 5 | 6 | add_subdirectory(example) -------------------------------------------------------------------------------- /avhttpd/README.md: -------------------------------------------------------------------------------- 1 | avhttpd 2 | ======= 3 | 4 | avhttpd is an header only library that help you develop http based server engines 5 | 6 | ## avhttpd 是什么 7 | avhttpd 是一个 header only 的库,帮助大家编写基于 HTTP 协议的服务器程序。 8 | 9 | ## avhttpd 不是什么 10 | avhttpd 并不是一个完整的 HTTP 协议库,只是帮助大家编写简单的 HTTP 协议程序,以配合 nginx 这样的前端工作。 11 | 利用 nginx 的 proxy_pass 功能,相对 fastcgi 模式要更加灵活。必要的时候还可以让 avhttpd 编写的程序直接面对用户处理访问。 12 | 13 | avhttpd 并不打算支持 gzip/chunked 之类的高级功能, 因为这些都应该是由 nginx 这样的反向代理服务器的工作。 14 | 15 | avhttpd 支持 UNIX Socket, 这也得到了 nginx 的支持。 16 | 17 | avhttpd 并不支持 SSL , 需要 SSL 功能的,请使用 nginx 并配置好 proxy_pass 18 | 19 | ## avhttpd 设计 20 | 21 | avhttpd 不是一个面向对象的库, 只是一组 composited-handler , 并以 stack-less 协程技术编写而成。 22 | 23 | 使用 avhttpd 并不会绑架你的库。因为这些功能并不需要你继承任何对象,并且也无需使用 avhttpd 提供的任何对象。 24 | 25 | 事实上 avhttpd 并不提供任何对象,他只是一组 asio 复合回调函数。 26 | 27 | ## API 简略 28 | 29 | // 读取 HTTP 头,使用 async_read_some 继续读取body 30 | template 31 | avhttpd::session::async_read_request(Stream & stream, const MutableBuffer &buffer, Handler handler); 32 | 33 | // 写入 HTTP 头,使用 async_write_some 继续写入body 34 | template 35 | avhttpd::session::async_write_response(Stream & stream, const ConstBuffer &buffer, Handler handler); 36 | 37 | // 派发 request, 依据已经注册好的 request_uri 和处理函数. 38 | avhttpd::httpd::async_dispatch_request(); 39 | 40 | 41 | -------------------------------------------------------------------------------- /avhttpd/example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(Boost 1.54 REQUIRED system regex) 3 | 4 | include_directories(../include ${Boost_INCLUDE_DIR}) 5 | 6 | link_directories(${Boost_LIBRARY_DIR}) 7 | 8 | add_executable(avhttpd main.cpp) 9 | 10 | target_link_libraries(avhttpd ${Boost_LIBRARIES}) 11 | 12 | install(TARGETS avhttpd RUNTIME DESTINATION bin) 13 | -------------------------------------------------------------------------------- /avhttpd/include/avhttpd.hpp: -------------------------------------------------------------------------------- 1 |  2 | #pragma once 3 | 4 | #ifndef __AVHTTPD_HPP___ 5 | #define __AVHTTPD_HPP___ 6 | 7 | #include "avhttpd/error_code.hpp" 8 | #include "avhttpd/read_request.hpp" 9 | #include "avhttpd/write_reponse.hpp" 10 | 11 | #endif // __AVHTTPD_HPP___ 12 | -------------------------------------------------------------------------------- /botctl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "libavbot/avbot.hpp" 4 | 5 | // 命令控制, 所有的协议都能享受的命令控制在这里实现. 6 | // msg_sender 是一个函数, on_command 用它发送消息. 7 | void on_bot_command(channel_identifier cid, avbotmsg avmessage, send_avchannel_message_t sendmsg, boost::asio::yield_context yield_context, avbot& mybot, avchannel& channel); 8 | 9 | void set_do_vc(std::function); 10 | void set_do_vc(); 11 | -------------------------------------------------------------------------------- /cpacksettings.cmake: -------------------------------------------------------------------------------- 1 | 2 | if(MSVC) 3 | set(CPACK_GENERATOR "TBZ2") 4 | else() 5 | set(CPACK_GENERATOR "TBZ2;DEB;RPM") 6 | endif(MSVC) 7 | 8 | set(CPACK_SOURCE_GENERATOR "TBZ2") 9 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "avbot Q群云秘书") 10 | SET(CPACK_PACKAGE_VENDOR "avplayer.org") 11 | SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") 12 | SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") 13 | SET(CPACK_PACKAGE_VERSION_MAJOR "12") 14 | SET(CPACK_PACKAGE_VERSION_MINOR "0") 15 | SET(CPACK_PACKAGE_VERSION_PATCH "0") 16 | if(WIN32) 17 | SET(CPACK_PACKAGE_INSTALL_DIRECTORY "avbot") 18 | else() 19 | SET(CPACK_PACKAGE_INSTALL_DIRECTORY "/") 20 | endif() 21 | 22 | IF(WIN32 AND NOT UNIX) 23 | # There is a bug in NSI that does not handle full unix paths properly. Make 24 | # sure there is at least one set of four (4) backlasshes. 25 | SET(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\avbot.ico") 26 | SET(CPACK_NSIS_INSTALLED_ICON_NAME "avbot.exe") 27 | SET(CPACK_NSIS_DISPLAY_NAME "avplayer.org avbot") 28 | SET(CPACK_NSIS_HELP_LINK "http://qqbot.avplayer.org") 29 | SET(CPACK_NSIS_URL_INFO_ABOUT "http://qqbot.avplayer.org") 30 | SET(CPACK_NSIS_CONTACT "microcaicai@gmail.com") 31 | SET(CPACK_NSIS_MODIFY_PATH ON) 32 | ELSE(WIN32 AND NOT UNIX) 33 | SET(CPACK_STRIP_FILES "avbot") 34 | SET(CPACK_SOURCE_STRIP_FILES "") 35 | ENDIF(WIN32 AND NOT UNIX) 36 | SET(CPACK_PACKAGE_EXECUTABLES "avbot" "avbot") 37 | 38 | SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "mosir") #required 39 | 40 | SET(CPACK_SOURCE_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES};${CMAKE_CURRENT_BINARY_DIR};\\\\.git;\\\\.kdev.*;\\\\.travis\\\\.yml") 41 | -------------------------------------------------------------------------------- /cxx11.cmake: -------------------------------------------------------------------------------- 1 | 2 | include(CheckCXXCompilerFlag) 3 | 4 | if (NOT MSVC) 5 | 6 | if(NOT CMAKE_CXX_COMPILER MATCHES "icc") 7 | 8 | CHECK_CXX_COMPILER_FLAG(-std=c++11 LIBCXX_HAS_STDCXX11_FLAG) 9 | 10 | if(LIBCXX_HAS_STDCXX11_FLAG) 11 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 12 | else() 13 | 14 | CHECK_CXX_COMPILER_FLAG(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG) 15 | 16 | if(LIBCXX_HAS_STDCXX0X_FLAG) 17 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") 18 | else() 19 | message(FATAL "need at least gcc 4.4.7 or clang 3.2") 20 | endif() 21 | 22 | endif() 23 | 24 | endif() # if(NOT CMAKE_CXX_COMPILER MATCHES "icc") 25 | endif(NOT MSVC) 26 | -------------------------------------------------------------------------------- /deCAPTCHA/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project(deCAPTCHA) 4 | 5 | include_directories(avboost/include) 6 | include_directories(avhttp/include) 7 | 8 | -------------------------------------------------------------------------------- /deCAPTCHA/README.md: -------------------------------------------------------------------------------- 1 | # deCAPTCHA - 智能验证码识别 2 | 3 | deCAPTCHA 是一个异步的验证码识别API. 4 | 5 | ## 在其下, 目前实现了6个验证码识别模块 6 | 7 | * 印度阿三的 antigate 提供的人肉识别服务 (最低每1000个验证码 $0.7) 8 | * 印度阿三的 deathbydecaptcha 提供的人肉识别服务 (最低每1000个验证码 $1.35) 9 | * 利用IRC和XMPP上的好友进行识别 (免费~~~) 10 | * avlog.avplayer.org 提供的免费人肉识别服务 (服务器端利用antigate/decaptcha 的 *付费* 人肉识别服务为所有的avbot客户提供免费的验证码识别服务. 当然, 限制每个客户每天只能使用一次.) 11 | * 联众打码平台 (每 1000 个验证码 ¥10 ) 12 | * 慧眼答题平台 (每 1000 个验证码 ¥12 ) 13 | 14 | ## 近期有计划要实现的打码平台API 15 | 16 | 17 | ## 未来的研究方向是下面这个识别算法 18 | 19 | * 基于模式识别的智能识别算法 20 | 21 | -------------------------------------------------------------------------------- /dpi.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /extension/README.md: -------------------------------------------------------------------------------- 1 | avbot-extension avbot 扩展 2 | 3 | 这个目录包括了一些扩展功能,根据需要,部分扩展功能可能会被合并入主程序。 4 | 5 | 目前实现的扩展有 6 | 7 | * joke - 聊天的时候发个笑话活跃一下群里的气氛 (可关闭) 8 | 9 | * urlpreview - 解析聊天中发送的 URL , 自动将 URL 的页面下载然后将标题贴到频道里。 10 | 11 | * bulletin - 电子公告, 每天自动定时的向群里发送设定的群公告 (可关闭) 12 | 13 | * static\_content - 对符合某些规则的消息,做出回应 14 | 15 | 需要工作目录下的配置文件 static.xml 16 | 17 | ``` 18 | 19 | 20 | hyq|mixer 21 | 22 | 哈哈哈哈,谁在叫我 23 | 24 | 25 | 26 | ``` 27 | 28 | * python script - python支持 29 | 30 | 需要在编译时开启,依赖python和boost.python模块 31 | 32 | ``` 33 | # coding: UTF-8 34 | import json 35 | decoder = json.JSONDecoder() 36 | 37 | # MessageHandler.send_message 将在cpp里面设置 38 | class MessageHandler: 39 | 40 | def on_message(self, str): 41 | msg = decoder.decode(str) 42 | if msg["who"]["name"] == "hyq": 43 | self.send_message("hyq 你好") 44 | 45 | print "python module loaded" 46 | 47 | ``` 48 | -------------------------------------------------------------------------------- /extension/avbot.py: -------------------------------------------------------------------------------- 1 | # coding: UTF-8 2 | import json 3 | decoder = json.JSONDecoder() 4 | 5 | # MessageHandler.send_message 将在cpp里面设置 6 | class MessageHandler: 7 | 8 | def on_message(self, str): 9 | msg = decoder.decode(str) 10 | if msg["who"]["name"] == "hyq": 11 | self.send_message("hyq 你好") 12 | 13 | print "python module loaded" 14 | -------------------------------------------------------------------------------- /extension/luascript/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | project(avbotluascript) 3 | 4 | if(ENABLE_LUA) 5 | 6 | add_definitions(-DENABLE_LUA) 7 | include_directories( 8 | luabind 9 | ${LUAJIT_INCLUDE_DIRS} 10 | ) 11 | 12 | add_library(libluascript STATIC luascript.cpp 13 | luabind/src/open.cpp 14 | luabind/src/create_class.cpp 15 | luabind/src/class.cpp 16 | luabind/src/class_info.cpp 17 | luabind/src/class_rep.cpp 18 | luabind/src/class_registry.cpp 19 | luabind/src/object_rep.cpp 20 | luabind/src/scope.cpp 21 | luabind/src/function.cpp 22 | luabind/src/exception_handler.cpp 23 | luabind/src/error.cpp 24 | luabind/src/inheritance.cpp 25 | luabind/src/pcall.cpp 26 | luabind/src/link_compatibility.cpp 27 | 28 | ) 29 | target_link_libraries(libluascript ${LUAJIT_LIBRARIES} libavbot) 30 | 31 | if(MSVC) 32 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:lua51.dll" ) 33 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:lua51.dll" PARENT_SCOPE) 34 | target_link_libraries(libluascript delayimp.lib) 35 | 36 | set_target_properties(libluascript PROPERTIES LINK_FLAGS "/DELAYLOAD:lua51.dll") 37 | endif() 38 | 39 | add_custom_command(TARGET libluascript POST_BUILD 40 | COMMAND ${CMAKE_COMMAND} -E copy_directory libs ${CMAKE_BINARY_DIR}) 41 | 42 | endif() 43 | 44 | target_include_directories(libluascript PRIVATE 45 | $) 46 | -------------------------------------------------------------------------------- /extension/luascript/libs/lua_libraries/json.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Licensed according to the included 'LICENSE' document 3 | Author: Thomas Harning Jr 4 | ]] 5 | local decode = require("json.decode") 6 | local encode = require("json.encode") 7 | local util = require("json.util") 8 | 9 | local _G = _G 10 | 11 | local _ENV = nil 12 | 13 | local json = { 14 | _VERSION = "1.3", 15 | _DESCRIPTION = "LuaJSON : customizable JSON decoder/encoder", 16 | _COPYRIGHT = "Copyright (c) 2007-2012 Thomas Harning Jr. ", 17 | decode = decode, 18 | encode = encode, 19 | util = util 20 | } 21 | 22 | _G.json = json 23 | 24 | return json 25 | -------------------------------------------------------------------------------- /extension/luascript/libs/lua_libraries/json/encode/number.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Licensed according to the included 'LICENSE' document 3 | Author: Thomas Harning Jr 4 | ]] 5 | local tostring = tostring 6 | local assert = assert 7 | local jsonutil = require("json.util") 8 | local huge = require("math").huge 9 | 10 | local _ENV = nil 11 | 12 | local defaultOptions = { 13 | nan = true, 14 | inf = true 15 | } 16 | 17 | local modeOptions = {} 18 | modeOptions.strict = { 19 | nan = false, 20 | inf = false 21 | } 22 | 23 | local function mergeOptions(options, mode) 24 | jsonutil.doOptionMerge(options, false, 'number', defaultOptions, mode and modeOptions[mode]) 25 | end 26 | 27 | 28 | local function encodeNumber(number, options) 29 | if number ~= number then 30 | assert(options.nan, "Invalid number: NaN not enabled") 31 | return "NaN" 32 | end 33 | if number == huge then 34 | assert(options.inf, "Invalid number: Infinity not enabled") 35 | return "Infinity" 36 | end 37 | if number == -huge then 38 | assert(options.inf, "Invalid number: Infinity not enabled") 39 | return "-Infinity" 40 | end 41 | return tostring(number) 42 | end 43 | 44 | local function getEncoder(options) 45 | options = options and jsonutil.merge({}, defaultOptions, options) or defaultOptions 46 | return { 47 | number = function(number, state) 48 | return encodeNumber(number, options) 49 | end 50 | } 51 | end 52 | 53 | local number = { 54 | mergeOptions = mergeOptions, 55 | getEncoder = getEncoder 56 | } 57 | 58 | return number 59 | -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/bet.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/libs/luascript/bet.lua -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/dictionary.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/libs/luascript/dictionary.lua -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/escape.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/libs/luascript/escape.lua -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/godmachine.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/libs/luascript/godmachine.lua -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/help.lua: -------------------------------------------------------------------------------- 1 | function help(msg,msg_time,buddy_name,buddy_num,qun_name,qun_num) 2 | if string.match(msg,"^%.help")==nil then return end 3 | local result="" 4 | for i=1 , table.maxn(main_help_table) do 5 | result=result..main_help_table[i].."\n" 6 | --print(tostring(i)..main_help_table[i].."\n") 7 | if string.len(result..main_help_table[i])>600 then 8 | say_qun(result,qun_num) 9 | result="" 10 | end 11 | end 12 | say_qun(result,qun_num) 13 | end 14 | -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/knight.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/libs/luascript/knight.lua -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/ppg.lua: -------------------------------------------------------------------------------- 1 | --跑跑龟 2 | function ppg() 3 | 4 | end 5 | -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/random.lua: -------------------------------------------------------------------------------- 1 | --say_qun(msg,qun_num) 2 | function random(msg,msg_time,buddy_name,buddy_num,qun_name,qun_num) 3 | if string.match(msg, "^random")~=nil then 4 | math.randomseed(os.time()) 5 | math.random() 6 | say_qun(tostring(math.random()),qun_num) 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/rememberip.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/libs/luascript/rememberip.lua -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/roll.lua: -------------------------------------------------------------------------------- 1 | n=1 2 | table.insert(main_help_table,".roll (数字) 大概就和魔兽一样吧。") 3 | function roll(msg,msg_time,buddy_name,buddy_num,qun_name,qun_num) 4 | if string.match(msg, "^%.roll")==nil then return end 5 | math.randomseed(os.time()+n) 6 | math.random() 7 | if n<10000 then n=n+1 end 8 | max=string.match(msg, "^%.roll (%d+)") 9 | if max==nil then return end 10 | if tonumber(max)>10000 then return end 11 | result=msg_time.."\n"..buddy_name.."进行投掷(最大"..max.."点):"..math.random(1,max) 12 | say_qun(result,qun_num) 13 | end 14 | -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/ronind10.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/libs/luascript/ronind10.lua -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/router.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/libs/luascript/router.lua -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/rss.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/libs/luascript/rss.lua -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/trim.lua: -------------------------------------------------------------------------------- 1 | --trim 2 | function trim(words) 3 | if type(words)~="string" then return end 4 | local out_words=string.match(words,"^%s*(.-)%s*$") 5 | return out_words 6 | end 7 | -------------------------------------------------------------------------------- /extension/luascript/libs/luascript/wiki.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/libs/luascript/wiki.lua -------------------------------------------------------------------------------- /extension/luascript/lpeg-0.11/lpcap.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lpcap.h,v 1.1 2013/03/21 20:25:12 roberto Exp $ 3 | */ 4 | 5 | #if !defined(lpcap_h) 6 | #define lpcap_h 7 | 8 | 9 | #include "lptypes.h" 10 | 11 | 12 | /* kinds of captures */ 13 | typedef enum CapKind { 14 | Cclose, Cposition, Cconst, Cbackref, Carg, Csimple, Ctable, Cfunction, 15 | Cquery, Cstring, Cnum, Csubst, Cfold, Cruntime, Cgroup 16 | } CapKind; 17 | 18 | 19 | typedef struct Capture { 20 | const char *s; /* subject position */ 21 | short idx; /* extra info about capture (group name, arg index, etc.) */ 22 | byte kind; /* kind of capture */ 23 | byte siz; /* size of full capture + 1 (0 = not a full capture) */ 24 | } Capture; 25 | 26 | 27 | typedef struct CapState { 28 | Capture *cap; /* current capture */ 29 | Capture *ocap; /* (original) capture list */ 30 | lua_State *L; 31 | int ptop; /* index of last argument to 'match' */ 32 | const char *s; /* original string */ 33 | int valuecached; /* value stored in cache slot */ 34 | } CapState; 35 | 36 | 37 | int runtimecap (CapState *cs, Capture *close, const char *s, int *rem); 38 | int getcaptures (lua_State *L, const char *s, const char *r, int ptop); 39 | int finddyncap (Capture *cap, Capture *last); 40 | 41 | #endif 42 | 43 | 44 | -------------------------------------------------------------------------------- /extension/luascript/lpeg-0.11/lpcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lpcode.h,v 1.2 2013/03/27 15:48:56 roberto Exp $ 3 | */ 4 | 5 | #if !defined(lpcode_h) 6 | #define lpcode_h 7 | 8 | #include "lua.h" 9 | 10 | #include "lptypes.h" 11 | #include "lptree.h" 12 | #include "lpvm.h" 13 | 14 | int tocharset (TTree *tree, byte *cs); 15 | int checkaux (TTree *tree, int pred); 16 | int fixedlenx (TTree *tree, int count, int len); 17 | int hascaptures (TTree *tree); 18 | int lp_gc (lua_State *L); 19 | Instruction *compile (lua_State *L, Pattern *p); 20 | void reallocprog (lua_State *L, Pattern *p, int nsize); 21 | 22 | 23 | #define PEnullable 0 24 | #define PEnofail 2 25 | 26 | #define nofail(t) checkaux(t, PEnofail) 27 | #define nullable(t) checkaux(t, PEnullable) 28 | 29 | #define fixedlen(t) fixedlenx(t, 0, 0) 30 | 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /extension/luascript/lpeg-0.11/lpeg-128.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/lpeg-0.11/lpeg-128.gif -------------------------------------------------------------------------------- /extension/luascript/lpeg-0.11/lpprint.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lpprint.h,v 1.1 2013/03/21 20:25:12 roberto Exp $ 3 | */ 4 | 5 | 6 | #if !defined(lpprint_h) 7 | #define lpprint_h 8 | 9 | 10 | #include "lptree.h" 11 | #include "lpvm.h" 12 | 13 | 14 | #if defined(LPEG_DEBUG) 15 | 16 | void printpatt (Instruction *p, int n); 17 | void printtree (TTree *tree, int ident); 18 | void printktable (lua_State *L, int idx); 19 | void printcharset (const byte *st); 20 | void printcaplist (Capture *cap, Capture *limit); 21 | 22 | #else 23 | 24 | #define printktable(L,idx) \ 25 | luaL_error(L, "function only implemented in debug mode") 26 | #define printtree(tree,i) \ 27 | luaL_error(L, "function only implemented in debug mode") 28 | #define printpatt(p,n) \ 29 | luaL_error(L, "function only implemented in debug mode") 30 | 31 | #endif 32 | 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /extension/luascript/lpeg-0.11/makefile: -------------------------------------------------------------------------------- 1 | LIBNAME = lpeg 2 | LUADIR = /usr/include/lua5.1/ 3 | 4 | COPT = -O2 5 | # COPT = -DLPEG_DEBUG -g 6 | 7 | CWARNS = -Wall -Wextra -pedantic \ 8 | -Waggregate-return \ 9 | -Wbad-function-cast \ 10 | -Wcast-align \ 11 | -Wcast-qual \ 12 | -Wdeclaration-after-statement \ 13 | -Wdisabled-optimization \ 14 | -Wmissing-prototypes \ 15 | -Wnested-externs \ 16 | -Wpointer-arith \ 17 | -Wshadow \ 18 | -Wsign-compare \ 19 | -Wstrict-prototypes \ 20 | -Wundef \ 21 | -Wwrite-strings \ 22 | # -Wunreachable-code \ 23 | 24 | 25 | CFLAGS = $(CWARNS) $(COPT) -ansi -I$(LUADIR) -fPIC 26 | CC = gcc 27 | 28 | # For Linux 29 | DLLFLAGS = -shared -fPIC 30 | ENV = 31 | 32 | # For Mac OS 33 | # ENV = MACOSX_DEPLOYMENT_TARGET=10.4 34 | # DLLFLAGS = -bundle -undefined dynamic_lookup 35 | 36 | 37 | FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o 38 | 39 | lpeg.so: $(FILES) 40 | env $(ENV) $(CC) $(DLLFLAGS) $(FILES) -o lpeg.so 41 | 42 | $(FILES): makefile 43 | 44 | test: test.lua re.lua lpeg.so 45 | test.lua 46 | 47 | 48 | lpcap.o: lpcap.c lpcap.h lptypes.h 49 | lpcode.o: lpcode.c lptypes.h lpcode.h lptree.h lpvm.h lpcap.h 50 | lpprint.o: lpprint.c lptypes.h lpprint.h lptree.h lpvm.h lpcap.h 51 | lptree.o: lptree.c lptypes.h lpcap.h lpcode.h lptree.h lpvm.h lpprint.h 52 | lpvm.o: lpvm.c lpcap.h lptypes.h lpvm.h lpprint.h lptree.h 53 | 54 | -------------------------------------------------------------------------------- /extension/luascript/luabind/LICENSE: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2003 Daniel Wallin and Arvid Norberg 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /extension/luascript/luabind/doc/adopt.rst: -------------------------------------------------------------------------------- 1 | adopt 2 | ---------------- 3 | 4 | Motivation 5 | ~~~~~~~~~~ 6 | 7 | Used to transfer ownership across language boundaries. 8 | 9 | Defined in 10 | ~~~~~~~~~~ 11 | 12 | .. parsed-literal:: 13 | 14 | #include 15 | 16 | Synopsis 17 | ~~~~~~~~ 18 | 19 | .. parsed-literal:: 20 | 21 | adopt(index) 22 | 23 | Parameters 24 | ~~~~~~~~~~ 25 | 26 | ============= =============================================================== 27 | Parameter Purpose 28 | ============= =============================================================== 29 | ``index`` The index which should transfer ownership, ``_N`` or ``result`` 30 | ============= =============================================================== 31 | 32 | Example 33 | ~~~~~~~ 34 | 35 | .. parsed-literal:: 36 | 37 | X* create() 38 | { 39 | return new X; 40 | } 41 | 42 | ... 43 | 44 | module(L) 45 | [ 46 | def("create", &create, **adopt(result)**) 47 | ]; 48 | 49 | -------------------------------------------------------------------------------- /extension/luascript/luabind/doc/copy.rst: -------------------------------------------------------------------------------- 1 | copy 2 | ---------------- 3 | 4 | Motivation 5 | ~~~~~~~~~~ 6 | 7 | This will make a copy of the parameter. This is the default behavior when 8 | passing parameters by-value. Note that this can only be used when passing from 9 | C++ to Lua. This policy requires that the parameter type has an accessible copy 10 | constructor. 11 | 12 | Defined in 13 | ~~~~~~~~~~ 14 | 15 | .. parsed-literal:: 16 | 17 | #include 18 | 19 | Synopsis 20 | ~~~~~~~~ 21 | 22 | .. parsed-literal:: 23 | 24 | copy(index) 25 | 26 | Parameters 27 | ~~~~~~~~~~ 28 | 29 | ============= =============================================================== 30 | Parameter Purpose 31 | ============= =============================================================== 32 | ``index`` The index to copy. ``result`` when used while wrapping C++ 33 | functions. ``_N`` when passing arguments to Lua. 34 | ============= =============================================================== 35 | 36 | Example 37 | ~~~~~~~ 38 | 39 | .. parsed-literal:: 40 | 41 | X* get() 42 | { 43 | static X instance; 44 | return &instance; 45 | } 46 | 47 | ... 48 | 49 | module(L) 50 | [ 51 | def("create", &create, **copy(result)**) 52 | ]; 53 | 54 | -------------------------------------------------------------------------------- /extension/luascript/luabind/doc/dependency.rst: -------------------------------------------------------------------------------- 1 | dependency 2 | ---------------- 3 | 4 | Motivation 5 | ~~~~~~~~~~ 6 | 7 | The dependency policy is used to create life-time dependencies between values. 8 | This is needed for example when returning internal references to some class. 9 | 10 | Defined in 11 | ~~~~~~~~~~ 12 | 13 | .. parsed-literal:: 14 | 15 | #include 16 | 17 | Synopsis 18 | ~~~~~~~~ 19 | 20 | .. parsed-literal:: 21 | 22 | dependency(nurse_index, patient_index) 23 | 24 | Parameters 25 | ~~~~~~~~~~ 26 | 27 | ================= ========================================================== 28 | Parameter Purpose 29 | ================= ========================================================== 30 | ``nurse_index`` The index which will keep the patient alive. 31 | ``patient_index`` The index which will be kept alive. 32 | ================= ========================================================== 33 | 34 | Example 35 | ~~~~~~~ 36 | 37 | .. parsed-literal:: 38 | 39 | struct X 40 | { 41 | B member; 42 | B& get() { return member; } 43 | }; 44 | 45 | module(L) 46 | [ 47 | class_("X") 48 | .def("get", &X::get, **dependency(result, _1)**) 49 | ]; 50 | 51 | -------------------------------------------------------------------------------- /extension/luascript/luabind/doc/discard_result.rst: -------------------------------------------------------------------------------- 1 | discard_result 2 | ---------------- 3 | 4 | Motivation 5 | ~~~~~~~~~~ 6 | 7 | This is a very simple policy which makes it possible to throw away 8 | the value returned by a C++ function, instead of converting it to 9 | Lua. 10 | 11 | Defined in 12 | ~~~~~~~~~~ 13 | 14 | .. parsed-literal:: 15 | 16 | #include 17 | 18 | Synopsis 19 | ~~~~~~~~ 20 | 21 | .. parsed-literal:: 22 | 23 | discard_result 24 | 25 | Example 26 | ~~~~~~~ 27 | 28 | .. parsed-literal:: 29 | 30 | struct X 31 | { 32 | X& set(T n) 33 | { 34 | ... 35 | return \*this; 36 | } 37 | }; 38 | 39 | ... 40 | 41 | module(L) 42 | [ 43 | class_("X") 44 | .def("set", &simple::set, **discard_result**) 45 | ]; 46 | 47 | -------------------------------------------------------------------------------- /extension/luascript/luabind/doc/luabind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/luabind/doc/luabind.png -------------------------------------------------------------------------------- /extension/luascript/luabind/doc/pure_out_value.rst: -------------------------------------------------------------------------------- 1 | pure_out_value 2 | ---------------- 3 | 4 | Motivation 5 | ~~~~~~~~~~ 6 | 7 | This works exactly like ``out_value``, except that it will pass a 8 | default constructed object instead of converting an argument from 9 | Lua. This means that the parameter will be removed from the lua 10 | signature. 11 | 12 | Defined in 13 | ~~~~~~~~~~ 14 | 15 | .. parsed-literal:: 16 | 17 | #include 18 | 19 | Synopsis 20 | ~~~~~~~~ 21 | 22 | .. parsed-literal:: 23 | 24 | pure_out_value(index, policies = none) 25 | 26 | 27 | Parameters 28 | ~~~~~~~~~~ 29 | 30 | =============== ============================================================= 31 | Parameter Purpose 32 | =============== ============================================================= 33 | ``index`` The index of the parameter to be used as an out parameter. 34 | ``policies`` The policies used internally to convert the out parameter 35 | to Lua. ``_1`` is used as the internal index. 36 | =============== ============================================================= 37 | 38 | Example 39 | ~~~~~~~ 40 | 41 | Note that no values are passed to the calls to ``f1`` and ``f2``. 42 | 43 | .. parsed-literal:: 44 | 45 | void f1(float& val) { val = 10.f; } 46 | void f2(float\* val) { \*val = 10.f; } 47 | 48 | module(L) 49 | [ 50 | def("f", &f, **pure_out_value(_1)**) 51 | ]; 52 | 53 | Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio 54 | > print(f1()) 55 | 10 56 | > print(f2()) 57 | 10 58 | 59 | -------------------------------------------------------------------------------- /extension/luascript/luabind/doc/raw.rst: -------------------------------------------------------------------------------- 1 | raw 2 | --- 3 | 4 | .. note:: 5 | 6 | ``raw()`` has been deprecated. ``lua_State*`` parameters are 7 | automatically handled by luabind. 8 | 9 | Motivation 10 | ~~~~~~~~~~ 11 | 12 | This converter policy will pass through the ``lua_State*`` unmodified. 13 | This can be useful for example when binding functions that need to 14 | return a ``luabind::object``. The parameter will be removed from the 15 | function signature, decreasing the function arity by one. 16 | 17 | Defined in 18 | ~~~~~~~~~~ 19 | 20 | .. parsed-literal:: 21 | 22 | #include 23 | 24 | Synopsis 25 | ~~~~~~~~ 26 | 27 | .. parsed-literal:: 28 | 29 | raw(index) 30 | 31 | Parameters 32 | ~~~~~~~~~~ 33 | 34 | ============= =============================================================== 35 | Parameter Purpose 36 | ============= =============================================================== 37 | ``index`` The index of the lua_State* parameter. 38 | ============= =============================================================== 39 | 40 | Example 41 | ~~~~~~~ 42 | 43 | .. parsed-literal:: 44 | 45 | void greet(lua_State* L) 46 | { 47 | lua_pushstring(L, "hello"); 48 | } 49 | 50 | ... 51 | 52 | module(L) 53 | [ 54 | def("greet", &greet, **raw(_1)**) 55 | ]; 56 | 57 | > print(greet()) 58 | hello 59 | 60 | -------------------------------------------------------------------------------- /extension/luascript/luabind/doc/return_stl_iterator.rst: -------------------------------------------------------------------------------- 1 | return_stl_iterator 2 | ------------------- 3 | 4 | Motivation 5 | ~~~~~~~~~~ 6 | 7 | This policy converts an STL container to a generator function that can be used 8 | in lua to iterate over the container. It works on any container that defines 9 | ``begin()`` and ``end()`` member functions (they have to return iterators). 10 | 11 | Defined in 12 | ~~~~~~~~~~ 13 | 14 | .. parsed-literal:: 15 | 16 | #include 17 | 18 | Synopsis 19 | ~~~~~~~~ 20 | 21 | .. parsed-literal:: 22 | 23 | return_stl_iterator 24 | 25 | Example 26 | ~~~~~~~ 27 | 28 | .. parsed-literal:: 29 | 30 | struct X 31 | { 32 | std::vector names; 33 | }; 34 | 35 | ... 36 | 37 | module(L) 38 | [ 39 | class_("A") 40 | .def_readwrite("names", &X::names, **return_stl_iterator**) 41 | ]; 42 | 43 | ... 44 | 45 | > a = A() 46 | > for name in a.names do 47 | > print(name) 48 | > end 49 | 50 | -------------------------------------------------------------------------------- /extension/luascript/luabind/doc/version.rst: -------------------------------------------------------------------------------- 1 | .. |version| replace:: 0.9.1 2 | -------------------------------------------------------------------------------- /extension/luascript/luabind/doc/yield.rst: -------------------------------------------------------------------------------- 1 | yield 2 | ---------------- 3 | 4 | Motivation 5 | ~~~~~~~~~~ 6 | 7 | Makes a C++ function yield when returning. 8 | 9 | Defined in 10 | ~~~~~~~~~~ 11 | 12 | .. parsed-literal:: 13 | 14 | #include 15 | 16 | Synopsis 17 | ~~~~~~~~ 18 | 19 | .. parsed-literal:: 20 | 21 | yield 22 | 23 | Example 24 | ~~~~~~~ 25 | 26 | .. parsed-literal:: 27 | 28 | void do_thing_that_takes_time() 29 | { 30 | ... 31 | } 32 | 33 | ... 34 | 35 | module(L) 36 | [ 37 | def("do_thing_that_takes_time", &do_thing_that_takes_time, **yield**) 38 | ]; 39 | 40 | -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/any_converter/Jamfile: -------------------------------------------------------------------------------- 1 | import modules ; 2 | 3 | exe any_converter 4 | : any_converter.cpp 5 | /luabind//luabind 6 | ; 7 | 8 | -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/cln/README: -------------------------------------------------------------------------------- 1 | To build this example you need to have CLN installed. It can be found at 2 | 3 | http://www.ginac.de/CLN/ 4 | 5 | -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/cln/cln_test.lua: -------------------------------------------------------------------------------- 1 | 2 | a = factorial(41) 3 | b = factorial(42) 4 | 5 | print('a = fac(41) = ' .. tostring(a)) 6 | print('b = fac(42) = ' .. tostring(b)) 7 | print('b / a = ' .. tostring(b / a)) 8 | 9 | c = a * 42 10 | 11 | d = sqrt(cl_R(10)) 12 | 13 | print('d = sqrt(10) = ' .. tostring(d)) 14 | 15 | if c == b then print('equality operator test: ok') else print('equality operator test: failed') end 16 | 17 | -- prints 18 | -- a = fac(41) = 33452526613163807108170062053440751665152000000000 19 | -- b = fac(42) = 1405006117752879898543142606244511569936384000000000 20 | -- b / a = 42 21 | -- d = sqrt(10) = 3.1622777 22 | -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/filesystem/Jamfile: -------------------------------------------------------------------------------- 1 | import modules ; 2 | 3 | BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; 4 | 5 | use-project /boost : $(BOOST_ROOT) ; 6 | 7 | exe filesystem 8 | : filesystem.cpp 9 | /boost/filesystem//boost_filesystem/static 10 | /luabind//luabind 11 | ; 12 | 13 | -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/glut/Jamfile: -------------------------------------------------------------------------------- 1 | import modules ; 2 | 3 | lib glut : : glut ; 4 | lib glu : : glu ; 5 | lib gl : : gl ; 6 | 7 | exe glut_bind 8 | : glut_bind.cpp gl glu glut 9 | /luabind//lualib 10 | /luabind//luabind 11 | ; 12 | 13 | stage . : glut_bind ; 14 | 15 | -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/hello_world/Jamfile: -------------------------------------------------------------------------------- 1 | import modules ; 2 | 3 | use-project /luabind : ../../ ; 4 | 5 | lib hello_world 6 | : hello_world.cpp /luabind//luabind/static /luabind//lua ; 7 | 8 | stage . : hello_world ; 9 | 10 | -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/hello_world/README: -------------------------------------------------------------------------------- 1 | this example will build an extension module as a shared library, use 2 | loadlib() from within the lua interpreter to load the library, it will 3 | then export a function named greet() which you can call. 4 | 5 | > loadlib('hello_world.dll', 'init')() 6 | > greet() 7 | Hello world! 8 | > 9 | 10 | -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/hello_world/project-root.jam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/luabind/examples/hello_world/project-root.jam -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/intrusive_ptr/Jamfile: -------------------------------------------------------------------------------- 1 | import modules ; 2 | 3 | exe intrusive_ptr 4 | : intrusive_ptr.cpp 5 | /luabind//luabind 6 | ; 7 | 8 | stage . : intrusive_ptr ; 9 | 10 | -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/regexp/Jamfile: -------------------------------------------------------------------------------- 1 | import modules ; 2 | 3 | BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; 4 | 5 | use-project /boost : $(BOOST_ROOT) ; 6 | 7 | exe regexp 8 | : regex_wrap.cpp 9 | /boost/regex//boost_regex/static 10 | /luabind//luabind 11 | ; 12 | 13 | -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/regexp/regex.lua: -------------------------------------------------------------------------------- 1 | 2 | html_tag = regex("<(.*?)>") 3 | src = 'dadasdsa' 4 | 5 | while html_tag:search(src) do 6 | print('tag: ' .. html_tag:what(1)) 7 | src = string.sub(src, html_tag:position(0) + html_tag:length(0)) 8 | end 9 | 10 | print('-------------') 11 | 12 | 13 | -------------------------------------------------------------------------------- /extension/luascript/luabind/examples/regexp/regex_wrap.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern "C" 4 | { 5 | #include "lua.h" 6 | #include "lauxlib.h" 7 | #include "lualib.h" 8 | } 9 | 10 | #include 11 | 12 | namespace 13 | { 14 | bool match(boost::RegEx& r, const char* s) 15 | { 16 | return r.Match(s); 17 | } 18 | 19 | bool search(boost::RegEx& r, const char* s) 20 | { 21 | return r.Search(s); 22 | } 23 | } // namespace unnamed 24 | 25 | 26 | void wrap_regex(lua_State* L) 27 | { 28 | using boost::RegEx; 29 | using namespace luabind; 30 | 31 | module(L) 32 | [ 33 | class_("regex") 34 | .def(constructor()) 35 | .def(constructor()) 36 | .def("match", match) 37 | .def("search", search) 38 | .def("what", &RegEx::What) 39 | .def("matched", &RegEx::Matched) 40 | .def("length", &RegEx::Length) 41 | .def("position", &RegEx::Position) 42 | ]; 43 | } 44 | 45 | int main() 46 | { 47 | lua_State* L = lua_open(); 48 | lua_baselibopen(L); 49 | lua_strlibopen(L); 50 | luabind::open(L); 51 | 52 | wrap_regex(L); 53 | 54 | lua_dofile(L, "regex.lua"); 55 | 56 | lua_close(L); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/back_reference_fwd.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004 Daniel Wallin and Arvid Norberg 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #ifndef LUABIND_BACK_REFERENCE_FWD_040510_HPP 24 | #define LUABIND_BACK_REFERENCE_FWD_040510_HPP 25 | 26 | namespace luabind { 27 | 28 | template 29 | bool get_back_reference(lua_State* L, T const& x); 30 | 31 | template 32 | bool move_back_reference(lua_State* L, T const& x); 33 | 34 | } // namespace luabind 35 | 36 | #endif // LUABIND_BACK_REFERENCE_FWD_040510_HPP 37 | 38 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/copy_policy.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2008. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef LUABIND_COPY_POLICY_081021_HPP 6 | # define LUABIND_COPY_POLICY_081021_HPP 7 | 8 | # include 9 | 10 | namespace luabind { 11 | 12 | namespace detail 13 | { 14 | 15 | struct copy_converter 16 | { 17 | template 18 | void apply(lua_State* L, T const& x) 19 | { 20 | value_converter().apply(L, x); 21 | } 22 | 23 | template 24 | void apply(lua_State* L, T* x) 25 | { 26 | if (!x) 27 | lua_pushnil(L); 28 | else 29 | apply(L, *x); 30 | } 31 | }; 32 | 33 | template 34 | struct copy_policy : conversion_policy 35 | { 36 | static void precall(lua_State*, index_map const&) 37 | {} 38 | 39 | static void postcall(lua_State*, index_map const&) 40 | {} 41 | 42 | template 43 | struct apply 44 | { 45 | typedef copy_converter type; 46 | }; 47 | }; 48 | 49 | } // namespace detail 50 | 51 | template 52 | detail::policy_cons, detail::null_type> 53 | copy(LUABIND_PLACEHOLDER_ARG(N)) 54 | { 55 | return detail::policy_cons, detail::null_type>(); 56 | } 57 | 58 | } // namespace luabind 59 | 60 | #endif // LUABIND_COPY_POLICY_081021_HPP 61 | 62 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/detail/conversion_storage.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2008. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef LUABIND_CONVERSION_STORAGE_080930_HPP 6 | # define LUABIND_CONVERSION_STORAGE_080930_HPP 7 | 8 | # include 9 | # include 10 | 11 | namespace luabind { namespace detail { 12 | 13 | typedef void(*destruction_function)(void*); 14 | 15 | // This is used by the converters in policy.hpp, and 16 | // class_rep::convert_to as temporary storage when constructing 17 | // holders. 18 | 19 | struct conversion_storage 20 | { 21 | conversion_storage() 22 | : destructor(0) 23 | {} 24 | 25 | ~conversion_storage() 26 | { 27 | if (destructor) 28 | destructor(&data); 29 | } 30 | 31 | // Unfortunately the converters currently doesn't have access to 32 | // the actual type being converted when this is instantiated, so 33 | // we have to guess a max size. 34 | boost::aligned_storage<128> data; 35 | destruction_function destructor; 36 | }; 37 | 38 | }} // namespace luabind::detail 39 | 40 | #endif // LUABIND_CONVERSION_STORAGE_080930_HPP 41 | 42 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/detail/pcall.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2003 Daniel Wallin and Arvid Norberg 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #ifndef LUABIND_PCALL_HPP_INCLUDED 24 | #define LUABIND_PCALL_HPP_INCLUDED 25 | 26 | #include 27 | 28 | struct lua_State; 29 | 30 | namespace luabind { namespace detail 31 | { 32 | LUABIND_API int pcall(lua_State *L, int nargs, int nresults); 33 | LUABIND_API int resume_impl(lua_State *L, int nargs, int nresults); 34 | }} 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/detail/pointee_typeid.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004 Daniel Wallin 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #ifndef POINTEE_TYPEID_040211_HPP 24 | #define POINTEE_TYPEID_040211_HPP 25 | 26 | #include 27 | #include 28 | 29 | namespace luabind { namespace detail { 30 | 31 | template 32 | type_id pointee_typeid(T*) 33 | { 34 | return typeid(T); 35 | } 36 | 37 | }} // namespace luabind::detail 38 | 39 | #endif // POINTEE_TYPEID_040211_HPP 40 | 41 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/detail/property.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2008. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef LUABIND_PROPERTY_081020_HPP 6 | # define LUABIND_PROPERTY_081020_HPP 7 | 8 | namespace luabind { namespace detail { 9 | 10 | template 11 | struct access_member_ptr 12 | { 13 | access_member_ptr(T Class::* mem_ptr) 14 | : mem_ptr(mem_ptr) 15 | {} 16 | 17 | Result operator()(Class const& x) const 18 | { 19 | return const_cast(x).*mem_ptr; 20 | } 21 | 22 | void operator()(Class& x, T const& value) const 23 | { 24 | x.*mem_ptr = value; 25 | } 26 | 27 | T Class::* mem_ptr; 28 | }; 29 | 30 | }} // namespace luabind::detail 31 | 32 | #endif // LUABIND_PROPERTY_081020_HPP 33 | 34 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/detail/yes_no.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004 Daniel Wallin 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #ifndef YES_NO_040211_HPP 24 | #define YES_NO_040211_HPP 25 | 26 | namespace luabind { namespace detail { 27 | 28 | typedef char(&yes_t)[1]; 29 | typedef char(&no_t)[2]; 30 | 31 | }} // namespace luabind::detail 32 | 33 | #endif // YES_NO_040211_HPP 34 | 35 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/from_stack.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005 Daniel Wallin and Arvid Norberg 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #ifndef LUABIND_FROM_STACK_050715_HPP 24 | #define LUABIND_FROM_STACK_050715_HPP 25 | 26 | namespace luabind { 27 | 28 | struct from_stack 29 | { 30 | from_stack(lua_State* interpreter, int index) 31 | : interpreter(interpreter) 32 | , index(index) 33 | {} 34 | 35 | lua_State* interpreter; 36 | int index; 37 | }; 38 | 39 | } // namespace luabind 40 | 41 | #endif // LUABIND_FROM_STACK_050715_HPP 42 | 43 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/get_main_thread.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef LUABIND_GET_MAIN_THREAD_090321_HPP 6 | # define LUABIND_GET_MAIN_THREAD_090321_HPP 7 | 8 | # include 9 | 10 | namespace luabind { 11 | 12 | LUABIND_API lua_State* get_main_thread(lua_State* L); 13 | 14 | } // namespace luabind 15 | 16 | #endif // LUABIND_GET_MAIN_THREAD_090321_HPP 17 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/get_pointer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005 Daniel Wallin 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #ifndef LUABIND_GET_POINTER_051023_HPP 24 | # define LUABIND_GET_POINTER_051023_HPP 25 | 26 | // 27 | // We need these overloads in the luabind namespace. 28 | // 29 | 30 | # include 31 | 32 | namespace luabind { 33 | 34 | using boost::get_pointer; 35 | 36 | } // namespace luabind 37 | 38 | #endif // LUABIND_GET_POINTER_051023_HPP 39 | 40 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/lua_include.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2003 Daniel Wallin and Arvid Norberg 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #ifndef LUA_INCLUDE_HPP_INCLUDED 24 | #define LUA_INCLUDE_HPP_INCLUDED 25 | 26 | #ifndef LUABIND_CPLUSPLUS_LUA 27 | extern "C" 28 | { 29 | #endif 30 | 31 | #include "lua.h" 32 | #include "lauxlib.h" 33 | 34 | #ifndef LUABIND_CPLUSPLUS_LUA 35 | } 36 | #endif 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/luabind.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2003 Daniel Wallin and Arvid Norberg 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | #ifndef LUABIND_BIND_HPP_INCLUDED 25 | #define LUABIND_BIND_HPP_INCLUDED 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #endif // LUABIND_BIND_HPP_INCLUDED 33 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/nil.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004 Daniel Wallin and Arvid Norberg 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #ifndef LUABIND_NIL_HPP 24 | #define LUABIND_NIL_HPP 25 | 26 | #include 27 | 28 | namespace luabind 29 | { 30 | namespace detail 31 | { 32 | struct nil_type {}; 33 | } 34 | 35 | // defined in class.cpp 36 | extern LUABIND_API detail::nil_type nil; 37 | } 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/open.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2003 Daniel Wallin and Arvid Norberg 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | #ifndef LUABIND_OPEN_HPP_INCLUDED 25 | #define LUABIND_OPEN_HPP_INCLUDED 26 | 27 | #include 28 | 29 | namespace luabind { 30 | 31 | LUABIND_API void open(lua_State* L); 32 | 33 | } 34 | 35 | #endif // LUABIND_OPEN_HPP_INCLUDED 36 | 37 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/prefix.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004 Daniel Wallin 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #ifndef PREFIX_040218_HPP 24 | #define PREFIX_040218_HPP 25 | 26 | #ifdef LUABIND_PREFIX_INCLUDE 27 | # include LUABIND_PREFIX_INCLUDE 28 | #endif 29 | 30 | #endif // PREFIX_040218_HPP 31 | 32 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/typeid.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2008. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef LUABIND_TYPEID_081227_HPP 6 | # define LUABIND_TYPEID_081227_HPP 7 | 8 | # include 9 | # include 10 | # include 11 | 12 | namespace luabind { 13 | 14 | # ifdef BOOST_MSVC 15 | # pragma warning(push) 16 | // std::type_info::before() returns int, rather than bool. 17 | // At least on MSVC7.1, this is true for the comparison 18 | // operators as well. 19 | # pragma warning(disable:4800) 20 | # endif 21 | 22 | class type_id 23 | : public boost::less_than_comparable 24 | { 25 | public: 26 | type_id() 27 | : id(&typeid(detail::null_type)) 28 | {} 29 | 30 | type_id(std::type_info const& id) 31 | : id(&id) 32 | {} 33 | 34 | bool operator!=(type_id const& other) const 35 | { 36 | return *id != *other.id; 37 | } 38 | 39 | bool operator==(type_id const& other) const 40 | { 41 | return *id == *other.id; 42 | } 43 | 44 | bool operator<(type_id const& other) const 45 | { 46 | return id->before(*other.id); 47 | } 48 | 49 | char const* name() const 50 | { 51 | return id->name(); 52 | } 53 | 54 | private: 55 | std::type_info const* id; 56 | }; 57 | 58 | # ifdef BOOST_MSVC 59 | # pragma warning(pop) 60 | # endif 61 | 62 | } // namespace luabind 63 | 64 | #endif // LUABIND_TYPEID_081227_HPP 65 | 66 | -------------------------------------------------------------------------------- /extension/luascript/luabind/luabind/version.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef LUABIND_VERSION_090216_HPP 6 | # define LUABIND_VERSION_090216_HPP 7 | 8 | # define LUABIND_VERSION 900 9 | 10 | // Each component uses two digits, so: 11 | // 12 | // major = LUABIND_VERSION / 10000 13 | // minor = LUABIND_VERSION / 100 % 100 14 | // patch = LUABIND_VERSION % 100 15 | 16 | #endif // LUABIND_VERSION_090216_HPP 17 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_adopt_wrapper.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2008. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | #include 8 | 9 | struct X 10 | { 11 | virtual ~X() 12 | {} 13 | }; 14 | 15 | struct X_wrap : X, luabind::wrap_base 16 | {}; 17 | 18 | X* make() 19 | { 20 | return new X; 21 | } 22 | 23 | void take(X* p) 24 | { 25 | delete p; 26 | } 27 | 28 | void test_main(lua_State* L) 29 | { 30 | using namespace luabind; 31 | 32 | module(L) [ 33 | class_("X"), 34 | def("make", &make, adopt(result)), 35 | def("take", &take, adopt(_1)) 36 | ]; 37 | 38 | DOSTRING(L, 39 | "take(make())\n" 40 | ); 41 | } 42 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_class_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | #include 8 | 9 | struct X 10 | { 11 | void f() 12 | {} 13 | 14 | int x; 15 | int y; 16 | }; 17 | 18 | void test_main(lua_State* L) 19 | { 20 | using namespace luabind; 21 | 22 | bind_class_info(L); 23 | 24 | module(L) [ 25 | class_("X") 26 | .def(constructor<>()) 27 | .def("f", &X::f) 28 | .def_readonly("x", &X::x) 29 | .def_readonly("y", &X::y) 30 | ]; 31 | 32 | DOSTRING(L, 33 | "x = X()\n" 34 | "info = class_info(x)\n" 35 | "assert(info.name == 'X')\n" 36 | "assert(info.methods['f'] == x.f)\n" 37 | "assert(info.methods['__init'] == x.__init)\n" 38 | "assert(info.attributes[1] == 'y')\n" 39 | "assert(info.attributes[2] == 'x')\n" 40 | "info = class_info(2)\n" 41 | "assert(info.name == 'number')\n" 42 | "assert(#info.methods == 0)\n" 43 | "assert(#info.attributes == 0)\n" 44 | "names = class_names()\n" 45 | "assert(type(names) == 'table')\n" 46 | "assert(#names == 2)\n" 47 | "assert(names[1] == 'X' or names[2] == 'X')\n" 48 | "assert(names[1] == 'class_info_data' or names[2] == 'class_info_data')\n" 49 | ); 50 | } 51 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_collapse_converter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | 8 | struct X 9 | { 10 | X(int x, int y) 11 | : x(x) 12 | , y(y) 13 | {} 14 | 15 | int x; 16 | int y; 17 | }; 18 | 19 | namespace luabind { 20 | 21 | int combine_score(int s1, int s2) 22 | { 23 | if (s1 < 0 || s2 < 0) return -1; 24 | return s1 + s2; 25 | } 26 | 27 | template <> 28 | struct default_converter 29 | : native_converter_base 30 | { 31 | int const consumed_args(...) 32 | { 33 | return 2; 34 | } 35 | 36 | int compute_score(lua_State* L, int index) 37 | { 38 | return combine_score( 39 | c1.compute_score(L, index), c2.compute_score(L, index + 1)); 40 | } 41 | 42 | X from(lua_State* L, int index) 43 | { 44 | return X(lua_tonumber(L, index), lua_tonumber(L, index + 1)); 45 | } 46 | 47 | default_converter c1; 48 | default_converter c2; 49 | }; 50 | 51 | } // namespace luabind 52 | 53 | int take(X x) 54 | { 55 | return x.x + x.y; 56 | } 57 | 58 | void test_main(lua_State* L) 59 | { 60 | using namespace luabind; 61 | 62 | module(L) [ 63 | def("take", &take) 64 | ]; 65 | 66 | DOSTRING(L, 67 | "assert(take(1,1) == 2)\n" 68 | "assert(take(2,3) == 5)\n" 69 | ); 70 | } 71 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_create_in_thread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | 8 | int count = 0; 9 | 10 | struct X 11 | { 12 | X() 13 | { 14 | ++count; 15 | } 16 | 17 | ~X() 18 | { 19 | --count; 20 | } 21 | }; 22 | 23 | struct Y 24 | { 25 | virtual ~Y() 26 | {} 27 | }; 28 | 29 | struct Y_wrap : Y, luabind::wrap_base 30 | {}; 31 | 32 | void test_main(lua_State* L) 33 | { 34 | using namespace luabind; 35 | 36 | module(L) [ 37 | class_("X") 38 | .def(constructor<>()), 39 | 40 | class_("Y") 41 | .def(constructor<>()) 42 | ]; 43 | 44 | DOSTRING(L, 45 | "class 'Y_lua' (Y)\n" 46 | " function Y_lua.__init(self)\n" 47 | " Y.__init(self)\n" 48 | " end\n" 49 | ); 50 | 51 | for (int i = 0; i < 100; ++i) 52 | { 53 | lua_State* thread = lua_newthread(L); 54 | int ref = luaL_ref(L, LUA_REGISTRYINDEX); 55 | 56 | DOSTRING(thread, 57 | "local x = X()\n" 58 | ); 59 | 60 | DOSTRING(thread, 61 | "local y = Y_lua()\n" 62 | ); 63 | 64 | luaL_unref(L, LUA_REGISTRYINDEX, ref); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_dynamic_type.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | 8 | struct Base 9 | { 10 | Base(int value) 11 | : value(value) 12 | {} 13 | 14 | virtual ~Base() 15 | {} 16 | 17 | int g() const 18 | { 19 | return value; 20 | } 21 | 22 | int value; 23 | }; 24 | 25 | struct Derived : Base 26 | { 27 | Derived() 28 | : Base(2) 29 | {} 30 | 31 | int f() const 32 | { 33 | return 1; 34 | } 35 | }; 36 | 37 | struct Unregistered : Base 38 | { 39 | Unregistered() 40 | : Base(3) 41 | {} 42 | }; 43 | 44 | std::auto_ptr make_derived() 45 | { 46 | return std::auto_ptr(new Derived); 47 | } 48 | 49 | std::auto_ptr make_unregistered() 50 | { 51 | return std::auto_ptr(new Unregistered); 52 | } 53 | 54 | void test_main(lua_State* L) 55 | { 56 | using namespace luabind; 57 | 58 | module(L) [ 59 | class_("Base") 60 | .def("g", &Base::g), 61 | class_("Derived") 62 | .def("f", &Derived::f), 63 | def("make_derived", &make_derived), 64 | def("make_unregistered", &make_unregistered) 65 | ]; 66 | 67 | DOSTRING(L, 68 | "x = make_derived()\n" 69 | "assert(x:f() == 1)\n" 70 | ); 71 | 72 | DOSTRING(L, 73 | "x = make_unregistered()\n" 74 | "assert(x:g() == 3)\n" 75 | ); 76 | } 77 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_extend_class_in_lua.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | 8 | struct CppClass 9 | { 10 | int f(int x) 11 | { 12 | return x; 13 | } 14 | }; 15 | 16 | void test_main(lua_State* L) 17 | { 18 | using namespace luabind; 19 | 20 | module(L) [ 21 | class_("CppClass") 22 | .def(constructor<>()) 23 | .def("f", &CppClass::f) 24 | ]; 25 | 26 | DOSTRING(L, 27 | "function CppClass:f_in_lua(x)\n" 28 | " return self:f(x) * 2\n" 29 | "end\n" 30 | ); 31 | 32 | DOSTRING(L, 33 | "x = CppClass()\n" 34 | "assert(x:f(1) == 1)\n" 35 | "assert(x:f_in_lua(1) == 2)\n" 36 | ); 37 | } 38 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_implicit_raw.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | 8 | void raw_function(lua_State* L) 9 | {} 10 | 11 | void raw_function2(int, lua_State* L, int) 12 | {} 13 | 14 | void test_main(lua_State* L) 15 | { 16 | using namespace luabind; 17 | 18 | module(L) [ 19 | def("raw_function", &raw_function), 20 | def("raw_function2", &raw_function2) 21 | ]; 22 | 23 | DOSTRING(L, 24 | "raw_function()\n" 25 | "raw_function2(1,2)\n" 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_set_instance_value.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | 8 | void test_main(lua_State* L) 9 | { 10 | DOSTRING(L, 11 | "class 'X'\n" 12 | " function X:__init()\n" 13 | " self.value = 1\n" 14 | " self.second = 2\n" 15 | " end\n" 16 | "\n" 17 | "x = X()\n" 18 | "assert(x.value == 1)\n" 19 | "assert(x.second == 2)\n" 20 | "x.value = 2\n" 21 | "assert(x.value == 2)\n" 22 | "assert(x.second == 2)\n" 23 | "x.second = 3\n" 24 | "y = X()\n" 25 | "assert(y.value == 1)\n" 26 | "assert(y.second == 2)\n" 27 | "assert(x.value == 2)\n" 28 | "assert(x.second == 3)\n" 29 | ); 30 | } 31 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_shadow.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2008. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | 8 | using namespace luabind; 9 | 10 | struct X 11 | { 12 | void f() 13 | {} 14 | }; 15 | 16 | struct Y : X 17 | { 18 | void f() 19 | {} 20 | }; 21 | 22 | void test_main(lua_State* L) 23 | { 24 | module(L) [ 25 | class_("X") 26 | .def(constructor<>()) 27 | .def("f", &X::f), 28 | 29 | class_("Y") 30 | .def(constructor<>()) 31 | .def("f", &Y::f) 32 | ]; 33 | 34 | DOSTRING(L, 35 | "x = X()\n" 36 | "x:f()\n" 37 | ); 38 | 39 | DOSTRING(L, 40 | "x = Y()\n" 41 | "x:f()\n" 42 | ); 43 | } 44 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_shared_ptr.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | #include 8 | 9 | struct X 10 | { 11 | X(int value) 12 | : value(value) 13 | {} 14 | 15 | int value; 16 | }; 17 | 18 | int get_value(boost::shared_ptr const& p) 19 | { 20 | return p->value; 21 | } 22 | 23 | boost::shared_ptr filter(boost::shared_ptr const& p) 24 | { 25 | return p; 26 | } 27 | 28 | void test_main(lua_State* L) 29 | { 30 | using namespace luabind; 31 | 32 | module(L) [ 33 | class_("X") 34 | .def(constructor()), 35 | def("get_value", &get_value), 36 | def("filter", &filter) 37 | ]; 38 | 39 | DOSTRING(L, 40 | "x = X(1)\n" 41 | "assert(get_value(x) == 1)\n" 42 | ); 43 | 44 | DOSTRING(L, 45 | "assert(x == filter(x))\n" 46 | ); 47 | } 48 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_smart_ptr_attributes.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | struct Foo 12 | { 13 | Foo() : m_baz(0) {} 14 | int m_baz; 15 | }; 16 | 17 | struct Bar 18 | { 19 | boost::shared_ptr getFoo() const { return m_foo; } 20 | void setFoo( boost::shared_ptr foo ) { m_foo = foo; } 21 | 22 | boost::shared_ptr m_foo; 23 | }; 24 | 25 | void test_main(lua_State* L) 26 | { 27 | using namespace luabind; 28 | 29 | bind_class_info(L); 30 | 31 | module( L ) 32 | [ 33 | class_ >( "Foo" ) 34 | .def( constructor<>() ) 35 | .def_readwrite("baz", &Foo::m_baz), 36 | class_ >( "Bar" ) 37 | .def( constructor<>() ) 38 | .property("fooz", &Bar::getFoo, &Bar::setFoo) 39 | .def_readwrite("foo", &Bar::m_foo) 40 | ]; 41 | dostring( L, "foo = Foo();"); 42 | dostring( L, "foo.baz = 42;"); 43 | dostring( L, "x = Bar();"); 44 | dostring( L, "x.fooz = foo;"); 45 | dostring( L, "print(type(x), class_info(x).name);"); 46 | dostring( L, "print(type(x.fooz), class_info(x.fooz).name);"); 47 | dostring( L, "print(type(x.foo), class_info(x.foo).name);"); // crashes here); 48 | } 49 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_super_leak.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | 6 | #include "test.hpp" 7 | #include 8 | 9 | struct Foo 10 | { 11 | static std::size_t count; 12 | 13 | Foo() 14 | { 15 | ++count; 16 | } 17 | 18 | ~Foo() 19 | { 20 | --count; 21 | } 22 | }; 23 | 24 | std::size_t Foo::count = 0; 25 | 26 | void test_main(lua_State* L) 27 | { 28 | using namespace luabind; 29 | 30 | module(L) [ 31 | class_("Foo") 32 | .def(constructor<>()) 33 | ]; 34 | 35 | // This used to leak the last created instance in one of the 36 | // upvalues to the "super" function. 37 | 38 | disable_super_deprecation(); 39 | 40 | DOSTRING(L, 41 | "class 'Bar' (Foo)\n" 42 | "function Bar.__init(self)\n" 43 | " Foo.__init(self)\n" 44 | "end\n" 45 | ); 46 | 47 | DOSTRING(L, 48 | "x = Bar()\n" 49 | ); 50 | 51 | assert(Foo::count == 1); 52 | 53 | DOSTRING(L, 54 | "x = nil\n" 55 | ); 56 | 57 | lua_gc(L, LUA_GCCOLLECT, 0); 58 | 59 | assert(Foo::count == 0); 60 | } 61 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_table.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | 8 | void f(luabind::table<> const& x) 9 | { 10 | TEST_CHECK(luabind::type(x) == LUA_TTABLE); 11 | } 12 | 13 | void g(luabind::table const& x) 14 | { 15 | TEST_CHECK(luabind::type(x) == LUA_TTABLE); 16 | } 17 | 18 | void test_main(lua_State* L) 19 | { 20 | using namespace luabind; 21 | 22 | module(L) [ 23 | def("f", &f), 24 | def("g", &g) 25 | ]; 26 | 27 | DOSTRING(L, 28 | "f {1,2,3}\n" 29 | "g {1,2,3}\n" 30 | ); 31 | 32 | DOSTRING_EXPECTED(L, 33 | "f(1)\n", 34 | "No matching overload found, candidates:\n" 35 | "void f(table const&)" 36 | ); 37 | 38 | DOSTRING_EXPECTED(L, 39 | "g(1)\n", 40 | "No matching overload found, candidates:\n" 41 | "void g(table const&)" 42 | ); 43 | } 44 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_tag_function.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2008. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | #include 8 | #include 9 | 10 | int f(int x, int y) 11 | { 12 | return x + y; 13 | } 14 | 15 | struct X 16 | { 17 | int f(int x, int y) 18 | { 19 | return x + y; 20 | } 21 | }; 22 | 23 | void test_main(lua_State* L) 24 | { 25 | using namespace luabind; 26 | 27 | module(L) [ 28 | def("f", tag_function(boost::bind(&f, 5, _1))), 29 | 30 | class_("X") 31 | .def(constructor<>()) 32 | .def("f", tag_function(boost::bind(&X::f, _1, 10, _2))) 33 | ]; 34 | 35 | DOSTRING(L, 36 | "assert(f(0) == 5)\n" 37 | "assert(f(1) == 6)\n" 38 | "assert(f(5) == 10)\n" 39 | ); 40 | 41 | DOSTRING(L, 42 | "x = X()\n" 43 | "assert(x:f(0) == 10)\n" 44 | "assert(x:f(1) == 11)\n" 45 | "assert(x:f(5) == 15)\n" 46 | ); 47 | } 48 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_unsigned_int.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | 8 | void test_main(lua_State* L) 9 | { 10 | DOSTRING(L, "x = 4294967295"); 11 | 12 | unsigned int x = luabind::object_cast( 13 | luabind::globals(L)["x"]); 14 | 15 | unsigned int y = 4294967295UL; 16 | 17 | TEST_CHECK(x == y); 18 | } 19 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_user_defined_converter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2008. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "test.hpp" 6 | #include 7 | 8 | struct X 9 | { 10 | X(int value) 11 | : value(value) 12 | {} 13 | 14 | int value; 15 | }; 16 | 17 | namespace luabind { 18 | 19 | template <> 20 | struct default_converter 21 | : native_converter_base 22 | { 23 | int compute_score(lua_State* L, int index) 24 | { 25 | return cv.compute_score(L, index); 26 | } 27 | 28 | X from(lua_State* L, int index) 29 | { 30 | return X(lua_tonumber(L, index)); 31 | } 32 | 33 | void to(lua_State* L, X const& x) 34 | { 35 | lua_pushnumber(L, x.value); 36 | } 37 | 38 | default_converter cv; 39 | }; 40 | 41 | } // namespace luabind 42 | 43 | int take(X x) 44 | { 45 | return x.value; 46 | } 47 | 48 | X get(int value) 49 | { 50 | return X(value); 51 | } 52 | 53 | void test_main(lua_State* L) 54 | { 55 | using namespace luabind; 56 | 57 | module(L) [ 58 | def("take", &take), 59 | def("get", &get) 60 | ]; 61 | 62 | DOSTRING(L, 63 | "assert(take(1) == 1)\n" 64 | "assert(take(2) == 2)\n" 65 | ); 66 | 67 | DOSTRING(L, 68 | "assert(get(1) == 1)\n" 69 | "assert(get(2) == 2)\n" 70 | ); 71 | } 72 | -------------------------------------------------------------------------------- /extension/luascript/luabind/test/test_vector_of_object.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005 Daniel Wallin 2 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the "Software"), 5 | // to deal in the Software without restriction, including without limitation 6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | // and/or sell copies of the Software, and to permit persons to whom the 8 | // Software is furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included 11 | // in all copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 | // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 | // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 | // OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #include "test.hpp" 24 | #include 25 | 26 | using namespace luabind; 27 | 28 | void test_main(lua_State* L) 29 | { 30 | std::vector v; 31 | v.push_back(object(L, 0)); 32 | 33 | for (std::vector::iterator i(v.begin()), e(v.end()); i != e; ++i) 34 | {} 35 | } 36 | 37 | -------------------------------------------------------------------------------- /extension/luascript/luainclude/luajit-2.0/lua.hpp: -------------------------------------------------------------------------------- 1 | // C++ wrapper for LuaJIT header files. 2 | 3 | extern "C" { 4 | #include "lua.h" 5 | #include "lauxlib.h" 6 | #include "lualib.h" 7 | #include "luajit.h" 8 | } 9 | 10 | -------------------------------------------------------------------------------- /extension/luascript/luainclude/luajit-2.0/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Standard library header. 3 | ** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LUALIB_H 7 | #define _LUALIB_H 8 | 9 | #include "lua.h" 10 | 11 | #define LUA_FILEHANDLE "FILE*" 12 | 13 | #define LUA_COLIBNAME "coroutine" 14 | #define LUA_MATHLIBNAME "math" 15 | #define LUA_STRLIBNAME "string" 16 | #define LUA_TABLIBNAME "table" 17 | #define LUA_IOLIBNAME "io" 18 | #define LUA_OSLIBNAME "os" 19 | #define LUA_LOADLIBNAME "package" 20 | #define LUA_DBLIBNAME "debug" 21 | #define LUA_BITLIBNAME "bit" 22 | #define LUA_JITLIBNAME "jit" 23 | #define LUA_FFILIBNAME "ffi" 24 | 25 | LUALIB_API int luaopen_base(lua_State *L); 26 | LUALIB_API int luaopen_math(lua_State *L); 27 | LUALIB_API int luaopen_string(lua_State *L); 28 | LUALIB_API int luaopen_table(lua_State *L); 29 | LUALIB_API int luaopen_io(lua_State *L); 30 | LUALIB_API int luaopen_os(lua_State *L); 31 | LUALIB_API int luaopen_package(lua_State *L); 32 | LUALIB_API int luaopen_debug(lua_State *L); 33 | LUALIB_API int luaopen_bit(lua_State *L); 34 | LUALIB_API int luaopen_jit(lua_State *L); 35 | LUALIB_API int luaopen_ffi(lua_State *L); 36 | 37 | LUALIB_API void luaL_openlibs(lua_State *L); 38 | 39 | #ifndef lua_assert 40 | #define lua_assert(x) ((void)0) 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /extension/luascript/luascript.hpp: -------------------------------------------------------------------------------- 1 |  2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | extern "C"{ 14 | #include 15 | #include 16 | #include 17 | } 18 | 19 | #include "../extension.hpp" 20 | 21 | class callluascript 22 | { 23 | boost::asio::io_service &io_service; 24 | std::function m_sender; 25 | std::string channel_name_; 26 | 27 | mutable boost::shared_ptr m_lua_State; 28 | 29 | void load_lua() const; 30 | void call_lua(std::string jsondata) const ; 31 | 32 | public: 33 | callluascript(boost::asio::io_service &_io_service, std::string channel_name, std::function sender); 34 | ~callluascript(); 35 | // on_message 回调. 36 | void operator()(channel_identifier cid, avbotmsg msg, send_avchannel_message_t sender, boost::asio::yield_context yield_context) const; 37 | }; 38 | 39 | avbot_extension make_luascript(std::string channel_name, boost::asio::io_service &_io_service, std::function sender); 40 | -------------------------------------------------------------------------------- /extension/luascript/msvc_x64/lua.def: -------------------------------------------------------------------------------- 1 | ; dlltool --export-all-symbols --output-def lua.def lua51.dll 2 | EXPORTS 3 | -------------------------------------------------------------------------------- /extension/luascript/msvc_x64/lua51.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/msvc_x64/lua51.exp -------------------------------------------------------------------------------- /extension/luascript/msvc_x64/lua51.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/msvc_x64/lua51.lib -------------------------------------------------------------------------------- /extension/luascript/msvc_x86/lua51.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/msvc_x86/lua51.exp -------------------------------------------------------------------------------- /extension/luascript/msvc_x86/lua51.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/extension/luascript/msvc_x86/lua51.lib -------------------------------------------------------------------------------- /extension/pythonscriptengine.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | namespace asio = boost::asio; 6 | using boost::property_tree::ptree; 7 | #include 8 | #include 9 | 10 | #include "extension.hpp" 11 | 12 | avbot_extension make_python_script_engine(asio::io_service& io, std::string channel_name, std::function sender); 13 | -------------------------------------------------------------------------------- /extension/staticcontent.hpp: -------------------------------------------------------------------------------- 1 |  2 | #include "extension.hpp" 3 | 4 | avbot_extension make_static_content(boost::asio::io_service& io, std::string channel_name); 5 | -------------------------------------------------------------------------------- /extension/urlpreview.hpp: -------------------------------------------------------------------------------- 1 |  2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | #include "extension.hpp" 20 | 21 | class urlpreview 22 | { 23 | typedef std::pair urllist_item_type; 24 | typedef boost::circular_buffer_space_optimized urllist_type; 25 | std::shared_ptr urllist; 26 | boost::asio::io_service &io_service; 27 | boost::function m_sender; 28 | 29 | public: 30 | template 31 | urlpreview( boost::asio::io_service &_io_service, MsgSender sender) 32 | : m_sender(sender) 33 | , io_service(_io_service) 34 | , urllist(std::make_shared > >(20)) 35 | { 36 | } 37 | // on_message 回调. 38 | void operator()(channel_identifier cid, avbotmsg msg, send_avchannel_message_t sender, boost::asio::yield_context yield_context); 39 | private: 40 | bool can_preview(std::string speaker, std::string url); 41 | void do_urlpreview(std::string speaker, std::string url, boost::posix_time::ptime current); 42 | }; 43 | -------------------------------------------------------------------------------- /input.hpp: -------------------------------------------------------------------------------- 1 |  2 | #include 3 | #include 4 | 5 | void start_stdinput(boost::asio::io_service &); 6 | void connect_stdinput(boost::function cb); 7 | -------------------------------------------------------------------------------- /libavbot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | project(libavbot) 3 | 4 | 5 | add_library(libavbot STATIC 6 | avbot.hpp avbot.cpp 7 | avchannel.hpp avchannel.cpp 8 | ) 9 | 10 | target_include_directories(libavbot PUBLIC 11 | $) 12 | 13 | target_link_libraries(libavbot irc xmpp mailexchange avim_group) 14 | 15 | if(NOT NO_WEBQQ) 16 | target_link_libraries(libavbot webqq) 17 | endif() 18 | 19 | set_target_properties(libavbot 20 | PROPERTIES 21 | OUTPUT_NAME avbot 22 | PREFIX "lib" 23 | CLEAN_DIRECT_OUTPUT 1) 24 | -------------------------------------------------------------------------------- /libavbot/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /libavbot/avaccount.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "avchannel.hpp" 10 | 11 | // 一个基类, 用于实现用户自定义帐号, 以支持非 qq/xmpp/irc/avim 帐号 12 | class avaccount 13 | { 14 | public: 15 | // 这个就是子类里必须要发射的信号 16 | boost::signals2::signal on_message; 17 | 18 | // 这个是子类里必须要实现的用于发送消息 19 | std::function send_message; 20 | }; 21 | -------------------------------------------------------------------------------- /libavlog/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 2.6) 3 | project(libavlog) 4 | 5 | add_library(avlog STATIC avlog.hpp avlog.cpp) 6 | 7 | -------------------------------------------------------------------------------- /protocols/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | if(NOT NO_WEBQQ) 3 | add_subdirectory(libwebqq) 4 | endif() 5 | 6 | add_subdirectory(libirc) 7 | add_subdirectory(libxmpp) 8 | add_subdirectory(libmailexchange) 9 | add_subdirectory(libavim_group) 10 | -------------------------------------------------------------------------------- /protocols/libavim_group/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory(avproto) 3 | 4 | add_library(avim_group STATIC src/avim_group.cpp src/avim_group_impl.cpp) 5 | target_link_libraries(avim_group avim++) 6 | 7 | target_include_directories(avim_group PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) 8 | -------------------------------------------------------------------------------- /protocols/libavim_group/include/avim_group.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | class avim_group_impl; 7 | 8 | struct avim_msg{ 9 | std::string text; 10 | std::string image, image_cname; 11 | std::string url; 12 | }; 13 | 14 | class avim 15 | { 16 | public: 17 | avim(boost::asio::io_service& io, std::string key, std::string cert, std::string groupdeffile); 18 | ~avim(); 19 | 20 | void on_message(std::function)>); 21 | void on_group_created(std::function); 22 | void send_group_message(std::string speaker, std::vector); 23 | 24 | private: 25 | boost::asio::io_service& m_io_service; 26 | std::shared_ptr m_impl; 27 | }; 28 | -------------------------------------------------------------------------------- /protocols/libavim_group/src/avim_group.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "avim_group.hpp" 3 | #include "avim_group_impl.hpp" 4 | 5 | avim::avim(boost::asio::io_service& io, std::string key, std::string cert, std::string groupdeffile) 6 | : m_io_service(io) 7 | { 8 | m_impl.reset(new avim_group_impl(io, key, cert, groupdeffile)); 9 | m_impl->start(); 10 | } 11 | 12 | avim::~avim() 13 | { 14 | m_impl->m_quitting = true; 15 | } 16 | 17 | void avim::on_message(std::function)> cb) 18 | { 19 | m_impl->on_message.connect(cb); 20 | } 21 | 22 | void avim::on_group_created(std::function cb) 23 | { 24 | m_impl->on_group_created.connect(cb); 25 | } 26 | 27 | void avim::send_group_message(std::string speaker, std::vector m) 28 | { 29 | m_impl->send_group_message(speaker, m); 30 | } 31 | -------------------------------------------------------------------------------- /protocols/libavim_group/src/avim_group_impl.hpp: -------------------------------------------------------------------------------- 1 |  2 | #pragma once 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #include "avim_group.hpp" 11 | 12 | class avim_group_impl : public std::enable_shared_from_this 13 | { 14 | public: 15 | avim_group_impl(boost::asio::io_service& io, std::string key, std::string cert, std::string groupdeffile); 16 | ~avim_group_impl(); 17 | 18 | public: 19 | void start(); 20 | 21 | void start_login(); 22 | 23 | void send_group_message(std::string sender, std::vector); 24 | 25 | // callback when there is a message 26 | boost::signals2::signal)> on_message; 27 | boost::signals2::signal on_group_created; 28 | boost::atomic m_quitting; 29 | 30 | private: 31 | void internal_login_coroutine(boost::asio::yield_context); 32 | void internal_loop_coroutine(boost::asio::yield_context); 33 | 34 | void forward_client_message( std::string ); 35 | 36 | private: 37 | boost::asio::io_service& m_io_service; 38 | 39 | std::shared_ptr m_key; 40 | std::shared_ptr m_cert; 41 | 42 | avkernel m_core; 43 | 44 | std::shared_ptr m_con; 45 | std::string m_me_addr; 46 | 47 | std::string m_groupdef; 48 | 49 | boost::signals2::signal recive_client_message; 50 | }; 51 | -------------------------------------------------------------------------------- /protocols/libirc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | project(libirc) 3 | 4 | find_package(Boost 1.54 REQUIRED COMPONENTS date_time system regex thread) 5 | 6 | include_directories(${Boost_INCLUDE_DIRS}) 7 | 8 | add_library(irc STATIC include/irc.hpp src/irc.cpp) 9 | 10 | if( ENABLE_TEST ) 11 | 12 | add_executable(irc3test EXCLUDE_FROM_ALL test.cpp ) 13 | target_link_libraries(irc3test irc ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) 14 | 15 | endif() 16 | 17 | target_include_directories(irc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) 18 | -------------------------------------------------------------------------------- /protocols/libirc/test.cpp: -------------------------------------------------------------------------------- 1 | #define ASIO_DISABLE_THREADS 2 | #include "irc.hpp" 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | using namespace irc; 8 | 9 | // int n2u(const char *in, size_t in_len, char *out, size_t out_len) 10 | // { 11 | // std::vector wbuf(in_len+1); 12 | // int wlen = MultiByteToWideChar(CP_ACP, 0, in, (int)in_len, &wbuf[0], (int)in_len); 13 | // if( wlen < 0) return -1; 14 | // wbuf[wlen] = 0; 15 | // 16 | // int len = WideCharToMultiByte(CP_UTF8, 0, &wbuf[0], (int)wlen, out, (int)out_len, NULL, FALSE); 17 | // if(len < 0) return -1; 18 | // out[len] = 0; 19 | // 20 | // return len; 21 | // }; 22 | 23 | 24 | void my_cb( const irc_msg pMsg ) 25 | { 26 | std::cout << pMsg.msg << std::endl; 27 | } 28 | 29 | int 30 | main( int argc, char **argv ) 31 | { 32 | boost::asio::io_service io_service; 33 | 34 | client irc_client( io_service, "testbot1234", "" ); 35 | irc_client.on_privmsg_message( my_cb ); 36 | irc_client.join( "#avplayer" ); 37 | 38 | io_service.run(); 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /protocols/libmailexchange/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(libpop3) 2 | find_package(Boost 1.54 COMPONENTS regex system locale) 3 | 4 | file(GLOB MAILEXCHANGE_IMPL_HEADERS "*.hpp") 5 | 6 | include_directories(${OPENSSL_INCLUDE_DIR}) 7 | 8 | add_library(mailexchange STATIC pop3.cpp smtp.cpp ${MAILEXCHANGE_IMPL_HEADERS}) 9 | target_link_libraries(mailexchange ${Boost_LIBRARIES}) 10 | 11 | if(ENABLE_STATIC) 12 | 13 | set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) 14 | if( EXISTS /usr/lib/libicuuc.a AND EXISTS /usr/lib/libicudata.a) 15 | target_link_libraries(mailexchange /usr/lib/libicuuc.a /usr/lib/libicudata.a) 16 | else() 17 | find_package(ICU ) 18 | if(ICU_FOUND) 19 | target_link_libraries(mailexchange ${ICU_LIBRARIES}) 20 | endif() 21 | endif() 22 | endif() 23 | 24 | target_include_directories(mailexchange PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 25 | 26 | if(WIN32 AND WITH_ICONV) 27 | if(MSVC) 28 | target_link_libraries(mailexchange crypt32.lib ws2_32.lib) 29 | else() 30 | target_link_libraries(mailexchange -liconv -lcrypt32 -lws2_32 ) 31 | endif() 32 | endif() 33 | 34 | if( ENABLE_TEST ) 35 | add_definitions(-DDEBUG) 36 | add_executable(pop3test pop3test.cpp) 37 | target_link_libraries(pop3test mailexchange ${CMAKE_THREAD_LIBS_INIT} ) 38 | 39 | add_executable(smtptest smtptest.cpp) 40 | target_link_libraries(smtptest mailexchange ${CMAKE_THREAD_LIBS_INIT} ) 41 | 42 | endif() 43 | -------------------------------------------------------------------------------- /protocols/libmailexchange/mx.hpp: -------------------------------------------------------------------------------- 1 |  2 | #pragma once 3 | 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "boost/timedcall.hpp" 12 | #include "boost/avproxy.hpp" 13 | 14 | #include "internet_mail_format.hpp" 15 | 16 | #include "pop3.hpp" 17 | #include "smtp.hpp" 18 | 19 | namespace mx { 20 | 21 | // ------------------------- 22 | 23 | // 用于邮件的发送 & 接收. 24 | class mx { 25 | boost::scoped_ptr m_pop3; 26 | boost::scoped_ptr m_smtp; 27 | std::string m_mailaddres; 28 | public: 29 | mx( ::boost::asio::io_service & _io_service, std::string user, std::string passwd, std::string _pop3server = "", std::string _smtpserver = "" ) 30 | : m_mailaddres( user ) { 31 | if( !user.empty() && ! passwd.empty() ) { 32 | m_pop3.reset( new pop3( _io_service, user, passwd, _pop3server ) ); 33 | m_smtp.reset( new smtp( _io_service, user, passwd, _smtpserver ) ); 34 | } 35 | } 36 | 37 | void async_fetch_mail( pop3::on_mail_function handler ) { 38 | if( m_pop3 ) 39 | m_pop3->async_fetch_mail( handler ); 40 | } 41 | 42 | template 43 | void async_send_mail( InternetMailFormat imf, Handler handler ) { 44 | if( m_smtp ) 45 | m_smtp->async_sendmail( imf, handler ); 46 | } 47 | 48 | bool enable() const { 49 | return m_smtp.get(); 50 | } 51 | 52 | std::string mailaddres() const { 53 | return m_mailaddres; 54 | } 55 | }; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /protocols/libwebqq/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | project(libwebqq) 3 | 4 | find_package(Boost 1.54 REQUIRED COMPONENTS system thread regex filesystem) 5 | 6 | include_directories(${OPENSSL_INCLUDE_DIR}) 7 | include_directories(${Boost_INCLUDE_DIRS}) 8 | include_directories(../avhttp/include/) 9 | include_directories(..) 10 | 11 | include_directories(${PROJECT_SOURCE_DIR}/include) 12 | 13 | file(GLOB AVHTTP_IMPL_SOURCES "src/impl/*.cpp") 14 | file(GLOB AVHTTP_IMPL_HEADERS "src/impl/*.hpp") 15 | 16 | add_library(webqq STATIC 17 | include/libwebqq/webqq.hpp include/libwebqq/error_code.hpp 18 | src/error_code.cpp src/webqq.cpp 19 | ${AVHTTP_IMPL_SOURCES} 20 | ${AVHTTP_IMPL_HEADERS} 21 | ) 22 | 23 | target_link_libraries(webqq ${Boost_LIBRARIES} ${SOCI_LIBRARY}) 24 | INCLUDE (CheckLibraryExists) 25 | if(NOT WIN32) 26 | check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME) 27 | if(HAVE_CLOCK_GETTIME) 28 | target_link_libraries(webqq -lrt) 29 | endif(HAVE_CLOCK_GETTIME) 30 | endif() 31 | 32 | target_link_libraries(webqq ${OPENSSL_LIBRARIES}) 33 | 34 | target_include_directories(webqq PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) 35 | 36 | -------------------------------------------------------------------------------- /protocols/libwebqq/README.en.md: -------------------------------------------------------------------------------- 1 | libwebqq = The ultimate async webqq protocol implememtation 2 | == 3 | 4 | libwebqq is designed arround Boost.Asio. To understand libwebqq, you have to understand Boost.Asio. 5 | 6 | # desigen patten 7 | 8 | libwebqq is fully asynchronous. It employ Asio and coroutine to do all the asynchronous stuff. 9 | 10 | -------------------------------------------------------------------------------- /protocols/libwebqq/README.md: -------------------------------------------------------------------------------- 1 | libwebqq = 终极 webqq 协议实现 2 | == 3 | 4 | libwebqq 围绕 Boost.Asio 展开设计, 要了解 libwebqq 需要首先具有 Asio 的相关知识. 5 | 6 | 7 | # Overview 8 | 9 | libwebqq 设计为一个异步的 webqq 协议实现. 10 | libwebqq 的用法非常简单, 构造一个 webqq 对象, 当 io\_service::run() 下次执行的时候, libwebqq 即开始启动登录过程. 11 | 如果需要设定和修改什么的话, 需要在下次 io\_service::run() 执行前就做好, 如设定消息回调, 验证码回调等. 12 | 13 | 例如 14 | 15 | ```c++ 16 | 17 | boost::asio::io_service io_service; 18 | 19 | webqq myqq(io_service, "your qqnum", "your qqpassword"); 20 | 21 | myqq.on_group_msg(&my_qq_message_callback); 22 | myqq.on_verify_code(&my_qq\_vcode_decoder); 23 | 24 | io_service.run(); 25 | 26 | ``` 27 | 28 | 当程序流程走到 io\_service.run() 的时候, libwebqq 内部的循环即被带动起来了. 29 | libwebqq 会自动处理登录, 掉线自动重新登录等过程. 用户只要在 消息回调里处理收到的消息即可. 30 | 如果QQ需要验证码, 则用户需要在 验证码回调里解码, 然后调用 webqq::feed\_vc() 将解码的验证码喂过去. 31 | 32 | > 注意, 出现验证码问题后, libwebqq 内部的循环即停止, 一直等待喂一个有效的验证码. 33 | 34 | 35 | 如果需要发送消息, 调用 webqq::send\_group\_message 即可. 那个 group 号码并不是 QQ 号码, 而是每次登录都会获得的一个随机的 id. 36 | 消息回调里的 id 即是. 37 | 38 | libwebqq 设计为简单的使用, 并没有提供退出登录的直接 API . 因为只要webqq对象简单的退出作用域即可向其内部循环发起退出登录的操作! 39 | webqq对象可以*随时撤销*, libwebqq 内部的循环并不依赖 webqq 对象, 当然这个对象的消失确实给内部循环发送了撤消信息. 40 | 于是收到撤销信息后, libwebqq 的内部循环就可以安全的退出了, 并释放一切占用的资源. 41 | 42 | # 实现 43 | 44 | libwebqq 采用了 pimpl 的技术, 将内部实现完全隔离开来. 也让头文件的依赖变得简单. 45 | -------------------------------------------------------------------------------- /protocols/libwebqq/js/compat.js: -------------------------------------------------------------------------------- 1 | 2 | avbotuserAgent = function(){ 3 | 4 | function toLowerCase(){} 5 | 6 | return { 7 | toLowerCase : toLowerCase 8 | } 9 | 10 | }(); 11 | 12 | navigator = {appName:"Netscape", userAgent: avbotuserAgent }; 13 | 14 | g_appid = 501004106; 15 | 16 | g_href = ""; 17 | 18 | g_domain = "qq.com"; 19 | 20 | g_begTime = new Date; 21 | 22 | $ = {} 23 | 24 | window = { $ : {} }; 25 | 26 | document = {}; 27 | 28 | document.loginform = {}; 29 | 30 | document.loginform.regmaster = {}; 31 | 32 | loginform = [ 33 | { name : "u" , value : "2082029534" }, 34 | { name : "p" , value : "txwqnmlgb" } 35 | ]; 36 | 37 | 38 | loginform.p = {}; 39 | 40 | loginform.p.value ="txwqnmlgb"; 41 | loginform.verifycode = { value : "abcd" }; 42 | 43 | document.forms = [ loginform ]; 44 | 45 | 46 | document.getElementById = function(id){ 47 | return {}; 48 | } 49 | 50 | document.cookie = {}; 51 | 52 | document.cookie.match = function(regex){} 53 | -------------------------------------------------------------------------------- /protocols/libwebqq/js/md.js: -------------------------------------------------------------------------------- 1 | u = function(x, K) { 2 | x += ""; 3 | for (var N = [], T = 0; T < K.length; T++) N[T % 4] ^= K.charCodeAt(T); 4 | var U = ["EC", "OK"], 5 | V = []; 6 | V[0] = x >> 24 & 255 ^ U[0].charCodeAt(0); 7 | V[1] = x >> 16 & 255 ^ U[0].charCodeAt(1); 8 | V[2] = x >> 8 & 255 ^ U[1].charCodeAt(0); 9 | V[3] = x & 255 ^ U[1].charCodeAt(1); 10 | U = []; 11 | for (T = 0; T < 8; T++) U[T] = T % 2 == 0 ? N[T >> 1] : V[T >> 1]; 12 | N = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]; 13 | V = ""; 14 | for (T = 0; T < U.length; T++) { 15 | V += N[U[T] >> 4 & 15]; 16 | V += N[U[T] & 15] 17 | } 18 | return V 19 | } 20 | -------------------------------------------------------------------------------- /protocols/libwebqq/js/test.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs") 2 | var vm = require('vm') 3 | 4 | var content = fs.readFileSync("./compat.js") 5 | vm.runInThisContext(content) 6 | 7 | var content = fs.readFileSync("./comm.js") 8 | vm.runInThisContext(content) 9 | 10 | loginform = { 11 | ptqrlogin : "1", 12 | u : "464893490", 13 | p : "552164545612" 14 | } 15 | 16 | TEA = window.TEA; 17 | 18 | console.log(getSubmitUrl("login")); 19 | -------------------------------------------------------------------------------- /protocols/libwebqq/src/impl/lwqq_status.hpp: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /protocols/libwebqq/src/impl/webqq_loop.hpp: -------------------------------------------------------------------------------- 1 |  2 | #include 3 | #include "libwebqq/webqq.hpp" 4 | 5 | namespace webqq{ 6 | namespace qqimpl{ 7 | 8 | void webqq_loop_start(boost::asio::io_service& io_service, std::shared_ptr _webqq); 9 | 10 | } // namespace qqimpl 11 | } // namespace webqq 12 | -------------------------------------------------------------------------------- /protocols/libxmpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(FindPackageHandleStandardArgs) 2 | 3 | find_package(Boost 1.55 REQUIRED COMPONENTS date_time regex system coroutine context atomic thread) 4 | 5 | include_directories(${Boost_INCLUDE_DIRS}) 6 | 7 | add_library(xmpp STATIC src/xmpp_impl.hpp src/xmpp_impl.cpp include/libxmpp/xmpp.hpp src/xmpp.cpp) 8 | 9 | target_include_directories(xmpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) 10 | 11 | include_directories(${GLOOX_INCLUDE_DIR}) 12 | 13 | if(NOT GLOOX_FOUND) 14 | target_include_directories(xmpp PRIVATE src/gloox) 15 | else() 16 | target_include_directories(xmpp PRIVATE ${GLOOX_INCLUDE_DIR}) 17 | endif() 18 | 19 | target_link_libraries(xmpp ${Boost_LIBRARIES}) 20 | 21 | target_link_libraries(xmpp ${GLOOX_LIBRARIES}) 22 | 23 | if(ENABLE_TEST) 24 | add_executable(xmpptest test.cpp) 25 | target_link_libraries(xmpptest xmpp) 26 | endif() 27 | -------------------------------------------------------------------------------- /protocols/libxmpp/include/libxmpp/xmpp.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 微蔡 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | */ 18 | 19 | #ifndef XMPP_H 20 | #define XMPP_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace xmppimpl { 28 | class xmpp; 29 | } 30 | 31 | class BOOST_SYMBOL_VISIBLE xmpp { 32 | public: 33 | xmpp( boost::asio::io_service & asio, std::string xmppuser, std::string xmpppasswd, std::string xmppserver = "", std::string xmppnick = "avbot" ); 34 | void join( std::string roomjid ); 35 | ~xmpp(); 36 | void on_room_message( std::function cb ); 37 | void on_room_joined(std::function); 38 | void send_room_message( std::string xmpproom, std::string message ); 39 | boost::asio::io_service& get_ioservice(); 40 | private: 41 | std::shared_ptr impl; 42 | }; 43 | 44 | #endif // XMPP_H 45 | -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by avbot.rc 4 | // 5 | #define IDD_AVSETTINGS_DIALOG 101 6 | #define IDI_ICON1 102 7 | #define IDI_AVBOT_ICON 102 8 | #define IDD_DIALOG1 103 9 | #define IDC_EDIT_USER_NAME 1001 10 | #define IDC_VERCODE_DISPLAY 1001 11 | #define IDC_EDIT_PWD 1002 12 | #define IDC_EDIT1 1002 13 | #define IDC_INPUT_VERYCODE 1002 14 | #define IDC_EDIT_IRC_CHANNEL 1003 15 | #define IDC_EDIT_IRC_NICK 1004 16 | #define IDC_EDIT_IRC_PWD 1005 17 | #define IDC_EDIT_XMPP_CHANNEL 1006 18 | #define IDC_EDIT_XMPP_NICK 1007 19 | #define IDC_EDIT_XMPP_PWD 1008 20 | #define IDC_CHECK_IRC 1009 21 | #define IDC_CHECK_XMPP 1010 22 | #define IDD_INPUT_VERCODE 28442 23 | 24 | // Next default values for new objects 25 | // 26 | #ifdef APSTUDIO_INVOKED 27 | #ifndef APSTUDIO_READONLY_SYMBOLS 28 | #define _APS_NEXT_RESOURCE_VALUE 104 29 | #define _APS_NEXT_COMMAND_VALUE 40001 30 | #define _APS_NEXT_CONTROL_VALUE 1003 31 | #define _APS_NEXT_SYMED_VALUE 101 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /rpc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 2 | include_directories(../soci/src/core) 3 | include_directories(../soci/src/backends/sqlite3) 4 | include_directories(${SQLITE3_INCLUDE_DIR}) 5 | 6 | set(CMAKE_AUTOMOC ON) 7 | 8 | if (Qt5DBus_FOUND) 9 | SET(RPC_SOURCE dbusrpc.cpp dbusrpc.hpp avbotrpc_adaptor.cpp avbotrpc_adaptor.h) 10 | endif() 11 | 12 | add_library(avbotrpc STATIC server.cpp ${RPC_SOURCE}) 13 | 14 | if (Qt5DBus_FOUND) 15 | target_link_libraries(avbotrpc Qt5::Core Qt5::DBus) 16 | endif() 17 | 18 | target_link_libraries(avbotrpc libavbot) 19 | -------------------------------------------------------------------------------- /rpc/dbusrpc.hpp: -------------------------------------------------------------------------------- 1 |  2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | namespace pt = boost::property_tree; 11 | 12 | struct SearchResultData 13 | { 14 | QString data; 15 | QString channel; 16 | QString nick; 17 | QString message; 18 | QString id; 19 | }; 20 | 21 | struct SearchResult 22 | { 23 | int resoult_count; 24 | QList data; 25 | double time_used; 26 | }; 27 | 28 | Q_DECLARE_METATYPE(SearchResult) 29 | Q_DECLARE_METATYPE(SearchResultData) 30 | 31 | #include "../libavbot/avchannel.hpp" 32 | 33 | class DBusRPC : public QObject 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | typedef boost::signals2::signal < 39 | void( channel_identifier, avbotmsg ) 40 | > on_message_signal_type; 41 | 42 | DBusRPC(boost::asio::io_service& io, on_message_signal_type & on_message, std::function 47 | )> do_search_func); 48 | 49 | Q_SIGNALS: 50 | void quit(); 51 | 52 | public Q_SLOTS: 53 | 54 | SearchResult search(QString searchstring); 55 | 56 | private: 57 | std::function 62 | )> do_search; 63 | }; 64 | 65 | -------------------------------------------------------------------------------- /rpc/server.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 microcai 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | * 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | 25 | #include "libavbot/avbot.hpp" 26 | 27 | bool avbot_start_rpc(boost::asio::io_service & io_service, boost::logger& logger, int port, avbot & bot, soci::session & avlogdb); 28 | -------------------------------------------------------------------------------- /third_party/gloox/AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/third_party/gloox/AUTHORS -------------------------------------------------------------------------------- /third_party/gloox/COPYING: -------------------------------------------------------------------------------- 1 | see the file LICENSE for the license of this distribution. 2 | 3 | -------------------------------------------------------------------------------- /third_party/gloox/INSTALL: -------------------------------------------------------------------------------- 1 | 2 | usual installation 3 | ------------------ 4 | 5 | ./configure 6 | make 7 | make install 8 | 9 | 10 | building from svn 11 | ----------------- 12 | 13 | ./autogen.sh 14 | ./configure 15 | make 16 | make install 17 | 18 | 19 | relevant configure options 20 | -------------------------- 21 | 22 | By default, GnuTLS will be used for stream encryption if it is found. If not, 23 | the system will be checked for OpenSSL. If you don't want to use GnuTLS even 24 | though you have it installed, use the --without-gnutls switch to configure. 25 | 26 | Also by default, unit tests and example programs will be built. To save some time, 27 | specify --without-examples and --without-tests to disable building the examples and 28 | tests, respectively. 29 | -------------------------------------------------------------------------------- /third_party/gloox/Makefile.am: -------------------------------------------------------------------------------- 1 | ## 2 | ## Process this file with automake to produce Makefile.in 3 | ## 4 | 5 | SUBDIRS = src 6 | 7 | EXTRA_DIST = LICENSE Doxyfile gloox.pc.in gloox.cbp gloox.dsp gloox.vcproj README README.win32 README.wince README.symbian INSTALL config.h.win config.h.symbian UPGRADING bld.inf gloox.mmp 8 | 9 | pkgconfigdir=$(libdir)/pkgconfig 10 | pkgconfig_DATA = gloox.pc 11 | 12 | bin_SCRIPTS = gloox-config 13 | 14 | apidox: 15 | doxygen 16 | 17 | check: test 18 | 19 | test: 20 | make -C src test 21 | 22 | leakcheck: leaktest 23 | 24 | leaktest: 25 | make -C src leaktest 26 | 27 | includetest: 28 | make -C src includetest 29 | -------------------------------------------------------------------------------- /third_party/gloox/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/third_party/gloox/NEWS -------------------------------------------------------------------------------- /third_party/gloox/README: -------------------------------------------------------------------------------- 1 | 2 | For build instructions on *NIX/Linux/BSD-like systems see INSTALL. 3 | For build instructions on Windows see README.win32. 4 | For build instructions on Windows CE/Mobile see README.wince. 5 | For build instructions on Symbian/Nokia S60 see README.symbian. 6 | 7 | 8 | For API documentation run make apidox, run doxygen directly, or go to http://camaya.net/api/gloox/ 9 | 10 | If you plan to contribute to gloox, please be aware of the following: 11 | 12 | Due to the commercial licensing which is available for the gloox library, 13 | I have to request the copyright to any modifications which go into the 14 | official distribution. I will not include code for which I don't have the 15 | copyright. If you do not agree with this, please don't send any code to me 16 | or the mailing list. 17 | 18 | Thanks, 19 | Jakob 20 | -------------------------------------------------------------------------------- /third_party/gloox/README.symbian: -------------------------------------------------------------------------------- 1 | Building on Symbian/Nokia S60 using S60 SDK 3rd Edition 2 | ------------------------------------------------------- 3 | 4 | gloox compiles (at least) on: 5 | - Linux cross-compile environment (see http://martin.st/symbian) 6 | - Carbide.c++ 2.0 7 | 8 | You will need the Open C/C++ plugin for the S60 SDK. 9 | 10 | No other compilers are officially supported at this point. Please let me know about 11 | your experiences with other compilers. 12 | 13 | Project files (bld.inf, gloox.mmp) are included. They can be imported into Carbide.c++. 14 | 15 | - Edit config.h.symbian to suit your needs. The defaults should be fine. 16 | - build 17 | 18 | 19 | NOTE WELL 20 | --------- 21 | The code has not been tested on Symbian/S60 by the author. It has only been compiled. 22 | Feedback is welcome. 23 | 24 | The OpenSSL server code (class OpenSSLServer from tlsopensslserver.h/cpp) does not 25 | compile at this point. 26 | -------------------------------------------------------------------------------- /third_party/gloox/README.wince: -------------------------------------------------------------------------------- 1 | Note: The following is not currently verified to be true for gloox 1.0-alpha1. 2 | 3 | Building on Win CE/Pocket PC 2003 4 | --------------------------------- 5 | 6 | gloox compiles (at least) on 7 | - eMbedded Visual C++ 4.0 8 | 9 | No other compilers have been tested. 10 | 11 | A project file for eVC++4 is included. 12 | 13 | For eVC++ 4 you will need: 14 | - the STL update from http://users.libero.it/g.govi/ or 15 | http://www.pocketpcdn.com/libraries/stl.html 16 | - RTTI fixes from http://support.microsoft.com/kb/830482 17 | 18 | - Edit config.h.win to suit your needs. As far as I know you should comment out everything. 19 | 20 | disabled features: 21 | - SRV record support 22 | - In-Band Bytestreams 23 | -------------------------------------------------------------------------------- /third_party/gloox/bld.inf: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009-2013 by Jakob Schroeter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | prj_mmpfiles 14 | 15 | gloox.mmp 16 | -------------------------------------------------------------------------------- /third_party/gloox/config.h.symbian: -------------------------------------------------------------------------------- 1 | /** 2 | * Uncomment whichever lib you have installed. 3 | */ 4 | 5 | /* Comment out if you don't have zlib available or don't want to use it */ 6 | #define HAVE_ZLIB 1 7 | 8 | /* Comment out if you don't have OpenSSL available or don't want to use it */ 9 | #define HAVE_OPENSSL 1 10 | 11 | /* Uncomment if you have LibIDN available and want to use it */ 12 | // #define HAVE_LIBIDN 1 13 | 14 | /* Comment out if you don't have the `setsockopt' function. Usually available. */ 15 | #define HAVE_SETSOCKOPT 1 16 | -------------------------------------------------------------------------------- /third_party/gloox/gloox-config.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # gloox-config 4 | 5 | prefix="@prefix@" 6 | exec_prefix="@prefix@/bin" 7 | version="@VERSION@" 8 | 9 | include_dir="@prefix@/include" 10 | lib_dir="@prefix@/lib" 11 | 12 | usage() 13 | { 14 | cat <&2 29 | fi 30 | 31 | while test $# -gt 0; do 32 | case $1 in 33 | --prefix) 34 | echo_prefix=yes 35 | ;; 36 | 37 | --cflags) 38 | echo_cflags=yes 39 | ;; 40 | 41 | --cxxflags) 42 | echo_cxxflags=yes 43 | ;; 44 | 45 | --libs) 46 | echo_libs=yes 47 | ;; 48 | 49 | --version) 50 | echo_version=yes 51 | ;; 52 | 53 | *) 54 | usage 1 1>&2 55 | ;; 56 | esac 57 | shift 58 | done 59 | 60 | if test "$echo_prefix" = "yes"; then 61 | echo $prefix 62 | fi 63 | 64 | cxxflags="-I$include_dir" 65 | cflags=$cxxflags 66 | 67 | if test "$lib_dir" != "/usr/lib"; then 68 | libs="-L$lib_dir" 69 | else 70 | libs="" 71 | fi 72 | 73 | libs="$libs @LIBS@ -lgloox" 74 | 75 | if test "$echo_cflags" = "yes"; then 76 | echo $cflags 77 | fi 78 | 79 | if test "$echo_cxxflags" = "yes"; then 80 | echo $cxxflags 81 | fi 82 | 83 | if test "$echo_libs" = "yes"; then 84 | echo $libs 85 | fi 86 | 87 | if test "$echo_version" = "yes"; then 88 | echo $version 89 | fi 90 | -------------------------------------------------------------------------------- /third_party/gloox/gloox.dsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/third_party/gloox/gloox.dsp -------------------------------------------------------------------------------- /third_party/gloox/gloox.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: gloox 7 | Description: A high-level XMPP/Jabber library for C++ 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lgloox @LIBS@ 10 | Cflags: -I${includedir} @CPPFLAGS@ 11 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/attention.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #include "attention.h" 16 | #include "tag.h" 17 | 18 | namespace gloox 19 | { 20 | 21 | Attention::Attention() 22 | : StanzaExtension( ExtAttention ) 23 | { 24 | } 25 | 26 | Attention::~Attention() 27 | { 28 | } 29 | 30 | const std::string& Attention::filterString() const 31 | { 32 | static const std::string filter = "/message/attention[@xmlns='" + XMLNS_ATTENTION + "']"; 33 | return filter; 34 | } 35 | 36 | Tag* Attention::tag() const 37 | { 38 | Tag* t = new Tag( "attention" ); 39 | t->setXmlns( XMLNS_ATTENTION ); 40 | return t; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #ifndef BASE64_H__ 15 | #define BASE64_H__ 16 | 17 | #include "macros.h" 18 | 19 | #include 20 | 21 | namespace gloox 22 | { 23 | 24 | /** 25 | * @brief An implementation of the Base64 data encoding (RFC 3548) 26 | * 27 | * @author Jakob Schröter 28 | * @since 0.8 29 | */ 30 | namespace Base64 31 | { 32 | 33 | /** 34 | * Base64-encodes the input according to RFC 3548. 35 | * @param input The data to encode. 36 | * @return The encoded string. 37 | */ 38 | GLOOX_API const std::string encode64( const std::string& input ); 39 | 40 | /** 41 | * Base64-decodes the input according to RFC 3548. 42 | * @param input The encoded data. 43 | * @return The decoded data. 44 | */ 45 | GLOOX_API const std::string decode64( const std::string& input ); 46 | 47 | } 48 | 49 | } 50 | 51 | #endif // BASE64_H__ 52 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/chatstatehandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #ifndef CHATSTATEHANDLER_H__ 15 | #define CHATSTATEHANDLER_H__ 16 | 17 | #include "gloox.h" 18 | 19 | namespace gloox 20 | { 21 | 22 | class JID; 23 | 24 | /** 25 | * @brief A virtual interface that enables an object to be notified about 26 | * a remote entity's Chat States (@xep{0085}). 27 | * 28 | * @author Jakob Schröter 29 | * @since 0.8 30 | */ 31 | class GLOOX_API ChatStateHandler 32 | { 33 | public: 34 | /** 35 | * Virtual Destructor. 36 | */ 37 | virtual ~ChatStateHandler() {} 38 | 39 | /** 40 | * Notifies the ChatStateHandler that a different chat state has been set by the remote 41 | * contact. 42 | * @param from The originator of the Event. 43 | * @param state The chat state set by the remote entity. 44 | */ 45 | virtual void handleChatState( const JID& from, ChatStateType state ) = 0; 46 | 47 | }; 48 | 49 | } 50 | 51 | #endif // CHATSTATEHANDLER_H__ 52 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/component.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #include "component.h" 16 | 17 | #include "disco.h" 18 | #include "stanza.h" 19 | #include "prep.h" 20 | #include "sha.h" 21 | 22 | #include 23 | 24 | namespace gloox 25 | { 26 | 27 | Component::Component( const std::string& ns, const std::string& server, 28 | const std::string& component, const std::string& password, int port ) 29 | : ClientBase( ns, password, server, port ) 30 | { 31 | m_jid.setServer( component ); 32 | m_disco->setIdentity( "component", "generic" ); 33 | } 34 | 35 | void Component::handleStartNode( const Tag* /*start*/ ) 36 | { 37 | if( m_sid.empty() ) 38 | return; 39 | 40 | notifyStreamEvent( StreamEventAuthentication ); 41 | 42 | SHA sha; 43 | sha.feed( m_sid + m_password ); 44 | sha.finalize(); 45 | 46 | Tag* h = new Tag( "handshake", sha.hex() ); 47 | send( h ); 48 | } 49 | 50 | bool Component::handleNormalNode( Tag* tag ) 51 | { 52 | if( tag->name() != "handshake" ) 53 | return false; 54 | 55 | m_authed = true; 56 | notifyStreamEvent( StreamEventFinished ); 57 | notifyOnConnect(); 58 | 59 | return true; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/compressiondatahandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2007-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #ifndef COMPRESSIONDATAHANDLER_H__ 16 | #define COMPRESSIONDATAHANDLER_H__ 17 | 18 | #include "macros.h" 19 | 20 | #include 21 | 22 | namespace gloox 23 | { 24 | 25 | /** 26 | * @brief An abstract base class used to receive de/compressed data from a 27 | * CompressionBase-derived object. 28 | * 29 | * You should not need to use this class directly. 30 | * 31 | * @author Jakob Schröter 32 | * @since 0.9 33 | */ 34 | class GLOOX_API CompressionDataHandler 35 | { 36 | public: 37 | /** 38 | * Virtual Destructor. 39 | */ 40 | virtual ~CompressionDataHandler() {} 41 | 42 | /** 43 | * This function is called when compression is finished. 44 | * @param data The compressed data. 45 | */ 46 | virtual void handleCompressedData( const std::string& data ) = 0; 47 | 48 | /** 49 | * This function is called when decompression is finished. 50 | * @param data The decompressed data. 51 | */ 52 | virtual void handleDecompressedData( const std::string& data ) = 0; 53 | 54 | }; 55 | 56 | } 57 | 58 | #endif // COMPRESSIONDATAHANDLER_H__ 59 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #ifndef CONFIG_H__ 15 | #define CONFIG_H__ 16 | 17 | #if ( defined _WIN32 ) && !defined( __SYMBIAN32__ ) 18 | # include "../config.h.win" 19 | #elif defined( _WIN32_WCE ) 20 | # include "../config.h.win" 21 | #elif defined( __SYMBIAN32__ ) 22 | # include "../config.h.symbian" 23 | #else 24 | # include "config.h.unix" // run ./configure to create config.h.unix 25 | #endif 26 | 27 | #endif // CONFIG_H__ 28 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/connectionhandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2007-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #ifndef CONNECTIONHANDLER_H__ 16 | #define CONNECTIONHANDLER_H__ 17 | 18 | #include "connectionbase.h" 19 | 20 | namespace gloox 21 | { 22 | 23 | /** 24 | * @brief This is an abstract base class to receive incoming connection attempts. Do not 25 | * confuse this with ConnectionListener, which is used with XMPP streams and has a 26 | * completely different meaning. 27 | * 28 | * You should not need to use this class directly. 29 | * 30 | * @author Jakob Schröter 31 | * @since 0.9 32 | */ 33 | class GLOOX_API ConnectionHandler 34 | { 35 | public: 36 | /** 37 | * Virtual Destructor. 38 | */ 39 | virtual ~ConnectionHandler() {} 40 | 41 | /** 42 | * This function is called to receive an incoming connection. 43 | * @param server The server that the connection was made to. 44 | * @param connection The incoming connection. 45 | */ 46 | virtual void handleIncomingConnection( ConnectionBase* server, ConnectionBase* connection ) = 0; 47 | 48 | }; 49 | 50 | } 51 | 52 | #endif // CONNECTIONHANDLER_H__ 53 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/connectiontlsserver.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2015 by Jakob Schröter 3 | * This file is part of the gloox library. http://camaya.net/gloox 4 | * 5 | * This software is distributed under a license. The full license 6 | * agreement can be found in the file LICENSE in this distribution. 7 | * This software may not be copied, modified, sold or distributed 8 | * other than expressed in the named license agreement. 9 | * 10 | * This software is distributed without any warranty. 11 | */ 12 | 13 | #include "connectiontlsserver.h" 14 | 15 | namespace gloox 16 | { 17 | 18 | ConnectionTLSServer::ConnectionTLSServer( ConnectionDataHandler* cdh, ConnectionBase* conn, 19 | const LogSink& log ) 20 | : ConnectionTLS( cdh, conn, log ) 21 | { 22 | } 23 | 24 | ConnectionTLSServer::ConnectionTLSServer( ConnectionBase* conn, const LogSink& log ) 25 | : ConnectionTLS( conn, log ) 26 | { 27 | } 28 | 29 | ConnectionTLSServer::~ConnectionTLSServer() 30 | { 31 | } 32 | 33 | TLSBase* ConnectionTLSServer::getTLSBase( TLSHandler* th, const std::string server ) 34 | { 35 | return new TLSDefault( th, server, TLSDefault::VerifyingServer ); 36 | } 37 | 38 | ConnectionBase* ConnectionTLSServer::newInstance() const 39 | { 40 | ConnectionBase* newConn = 0; 41 | if( m_connection ) 42 | newConn = m_connection->newInstance(); 43 | return new ConnectionTLSServer( m_handler, newConn, m_log ); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/dataformfieldcontainer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #include "dataformfieldcontainer.h" 15 | #include "util.h" 16 | 17 | 18 | namespace gloox 19 | { 20 | 21 | DataFormFieldContainer::DataFormFieldContainer() 22 | { 23 | } 24 | 25 | DataFormFieldContainer::DataFormFieldContainer( const DataFormFieldContainer& dffc ) 26 | { 27 | FieldList::const_iterator it = dffc.m_fields.begin(); 28 | for( ; it != dffc.m_fields.end(); ++it ) 29 | { 30 | m_fields.push_back( new DataFormField( *(*it) ) ); 31 | } 32 | } 33 | 34 | DataFormFieldContainer::~DataFormFieldContainer() 35 | { 36 | util::clearList( m_fields ); 37 | } 38 | 39 | DataFormField* DataFormFieldContainer::field( const std::string& field ) const 40 | { 41 | FieldList::const_iterator it = m_fields.begin(); 42 | for( ; it != m_fields.end() && (*it)->name() != field; ++it ) 43 | ; 44 | return it != m_fields.end() ? (*it) : 0; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/dataformitem.cpp: -------------------------------------------------------------------------------- 1 |  /* 2 | Copyright (c) 2006-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #include "dataformitem.h" 15 | 16 | #include "tag.h" 17 | 18 | namespace gloox 19 | { 20 | 21 | DataFormItem::DataFormItem() 22 | { 23 | } 24 | 25 | DataFormItem::DataFormItem( const Tag* tag ) 26 | { 27 | if( tag->name() != "item" ) 28 | return; 29 | 30 | const TagList &l = tag->children(); 31 | TagList::const_iterator it = l.begin(); 32 | for( ; it != l.end(); ++it ) 33 | { 34 | DataFormField* f = new DataFormField( (*it) ); 35 | m_fields.push_back( f ); 36 | } 37 | } 38 | 39 | DataFormItem::~DataFormItem() 40 | { 41 | } 42 | 43 | Tag* DataFormItem::tag() const 44 | { 45 | Tag* i = new Tag ( "item" ); 46 | DataFormFieldContainer::FieldList::const_iterator it = m_fields.begin(); 47 | for( ; it != m_fields.end(); ++it ) 48 | { 49 | i->addChild( (*it)->tag() ); 50 | } 51 | return i; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/dataformreported.cpp: -------------------------------------------------------------------------------- 1 |  /* 2 | Copyright (c) 2006-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #include "dataformreported.h" 15 | 16 | #include "tag.h" 17 | 18 | namespace gloox 19 | { 20 | 21 | DataFormReported::DataFormReported() 22 | { 23 | } 24 | 25 | DataFormReported::DataFormReported( Tag* tag ) 26 | { 27 | if( tag->name() != "reported" ) 28 | return; 29 | 30 | const TagList &l = tag->children(); 31 | TagList::const_iterator it = l.begin(); 32 | for( ; it != l.end(); ++it ) 33 | { 34 | DataFormField* f = new DataFormField( (*it) ); 35 | m_fields.push_back( f ); 36 | } 37 | } 38 | 39 | DataFormReported::~DataFormReported() 40 | { 41 | } 42 | 43 | Tag* DataFormReported::tag() const 44 | { 45 | Tag* r = new Tag ( "reported" ); 46 | DataFormFieldContainer::FieldList::const_iterator it = m_fields.begin(); 47 | for( ; it != m_fields.end(); ++it ) 48 | { 49 | r->addChild( (*it)->tag() ); 50 | } 51 | return r; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/eventhandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #ifndef EVENTHANDLER_H__ 15 | #define EVENTHANDLER_H__ 16 | 17 | namespace gloox 18 | { 19 | 20 | class Event; 21 | 22 | /** 23 | * @brief An base class for event handlers. 24 | * 25 | * @author Jakob Schröter 26 | * @since 1.0 27 | */ 28 | class EventHandler 29 | { 30 | 31 | public: 32 | /** 33 | * Virtual Destructor. 34 | */ 35 | virtual ~EventHandler() {} 36 | 37 | /** 38 | * This function gets called for Events this handler was registered for. 39 | * @param event The Event. 40 | */ 41 | virtual void handleEvent( const Event& event ) = 0; 42 | 43 | }; 44 | 45 | } 46 | 47 | #endif // EVENTHANDLER_H__ 48 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/glooxversion.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | #define GLOOXVERSION 0x010013 14 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/gpgencrypted.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2006-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #include "gpgencrypted.h" 15 | #include "tag.h" 16 | 17 | namespace gloox 18 | { 19 | 20 | GPGEncrypted::GPGEncrypted( const std::string& encrypted ) 21 | : StanzaExtension( ExtGPGEncrypted ), 22 | m_encrypted( encrypted ), m_valid( true ) 23 | { 24 | if( m_encrypted.empty() ) 25 | m_valid = false; 26 | } 27 | 28 | GPGEncrypted::GPGEncrypted( const Tag* tag ) 29 | : StanzaExtension( ExtGPGEncrypted ), 30 | m_valid( false ) 31 | { 32 | if( tag && tag->name() == "x" && tag->hasAttribute( XMLNS, XMLNS_X_GPGENCRYPTED ) ) 33 | { 34 | m_valid = true; 35 | m_encrypted = tag->cdata(); 36 | } 37 | } 38 | 39 | GPGEncrypted::~GPGEncrypted() 40 | { 41 | } 42 | 43 | const std::string& GPGEncrypted::filterString() const 44 | { 45 | static const std::string filter = "/message/x[@xmlns='" + XMLNS_X_GPGENCRYPTED + "']"; 46 | return filter; 47 | } 48 | 49 | Tag* GPGEncrypted::tag() const 50 | { 51 | if( !m_valid ) 52 | return 0; 53 | 54 | Tag* x = new Tag( "x", m_encrypted ); 55 | x->addAttribute( XMLNS, XMLNS_X_GPGENCRYPTED ); 56 | 57 | return x; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/gpgsigned.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2006-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #include "gpgsigned.h" 15 | #include "tag.h" 16 | 17 | namespace gloox 18 | { 19 | 20 | GPGSigned::GPGSigned( const std::string& signature ) 21 | : StanzaExtension( ExtGPGSigned ), 22 | m_signature( signature ), m_valid( true ) 23 | { 24 | if( m_signature.empty() ) 25 | m_valid = false; 26 | } 27 | 28 | GPGSigned::GPGSigned( const Tag* tag ) 29 | : StanzaExtension( ExtGPGSigned ), 30 | m_valid( false ) 31 | { 32 | if( tag && tag->name() == "x" && tag->hasAttribute( XMLNS, XMLNS_X_GPGSIGNED ) ) 33 | { 34 | m_valid = true; 35 | m_signature = tag->cdata(); 36 | } 37 | } 38 | 39 | GPGSigned::~GPGSigned() 40 | { 41 | } 42 | 43 | const std::string& GPGSigned::filterString() const 44 | { 45 | static const std::string filter = 46 | "/presence/x[@xmlns='" + XMLNS_X_GPGSIGNED + "']" 47 | "|/message/x[@xmlns='" + XMLNS_X_GPGSIGNED + "']"; 48 | return filter; 49 | } 50 | 51 | Tag* GPGSigned::tag() const 52 | { 53 | if( !m_valid ) 54 | return 0; 55 | 56 | Tag* x = new Tag( "x", m_signature ); 57 | x->addAttribute( XMLNS, XMLNS_X_GPGSIGNED ); 58 | 59 | return x; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/instantmucroom.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2007-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #include "instantmucroom.h" 16 | #include "clientbase.h" 17 | #include "jid.h" 18 | 19 | namespace gloox 20 | { 21 | 22 | InstantMUCRoom::InstantMUCRoom( ClientBase* parent, const JID& nick, MUCRoomHandler* mrh ) 23 | : MUCRoom( parent, nick, mrh, 0 ) 24 | { 25 | } 26 | 27 | InstantMUCRoom::~InstantMUCRoom() 28 | { 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/loghandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #ifndef LOGHANDLER_H__ 16 | #define LOGHANDLER_H__ 17 | 18 | #include "gloox.h" 19 | 20 | #include 21 | 22 | namespace gloox 23 | { 24 | 25 | /** 26 | * @brief A virtual interface which can be reimplemented to receive debug and log messages. 27 | * 28 | * @ref handleLog() is called for log messages. 29 | * 30 | * @author Jakob Schröter 31 | * @since 0.5 32 | */ 33 | class GLOOX_API LogHandler 34 | { 35 | public: 36 | /** 37 | * Virtual Destructor. 38 | */ 39 | virtual ~LogHandler() {} 40 | 41 | /** 42 | * Reimplement this function if you want to receive the chunks of the conversation 43 | * between gloox and server or other debug info from gloox. 44 | * @param level The log message's severity. 45 | * @param area The log message's origin. 46 | * @param message The log message. 47 | */ 48 | virtual void handleLog( LogLevel level, LogArea area, const std::string& message ) = 0; 49 | }; 50 | 51 | } 52 | 53 | #endif // LOGHANDLER_H__ 54 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/logsink.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #include "logsink.h" 16 | 17 | namespace gloox 18 | { 19 | 20 | LogSink::LogSink() 21 | { 22 | } 23 | 24 | LogSink::~LogSink() 25 | { 26 | } 27 | 28 | void LogSink::log( LogLevel level, LogArea area, const std::string& message ) const 29 | { 30 | LogHandlerMap::const_iterator it = m_logHandlers.begin(); 31 | for( ; it != m_logHandlers.end(); ++it ) 32 | { 33 | if( (*it).first && ( (*it).second.level <= level ) && ( (*it).second.areas & area ) ) 34 | (*it).first->handleLog( level, area, message ); 35 | } 36 | } 37 | 38 | void LogSink::registerLogHandler( LogLevel level, int areas, LogHandler* lh ) 39 | { 40 | LogInfo info = { level, areas }; 41 | m_logHandlers[lh] = info; 42 | } 43 | 44 | void LogSink::removeLogHandler( LogHandler* lh ) 45 | { 46 | m_logHandlers.erase( lh ); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #ifndef GLOOX_MACROS_H__ 15 | #define GLOOX_MACROS_H__ 16 | 17 | #if defined( _MSC_VER ) || defined( _WIN32_WCE ) 18 | # pragma warning( disable:4251 ) 19 | # pragma warning( disable:4786 ) 20 | #endif 21 | 22 | #if defined( _WIN32 ) && !defined( __SYMBIAN32__ ) 23 | # if defined( GLOOX_EXPORTS ) || defined( DLL_EXPORT ) 24 | # define GLOOX_API __declspec( dllexport ) 25 | # else 26 | # if defined( GLOOX_IMPORTS ) || defined( DLL_IMPORT ) 27 | # define GLOOX_API __declspec( dllimport ) 28 | # endif 29 | # endif 30 | #endif 31 | 32 | #ifndef GLOOX_API 33 | # define GLOOX_API 34 | #endif 35 | 36 | 37 | #if defined( __GNUC__ ) && ( __GNUC__ - 0 > 3 || ( __GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2 ) ) 38 | # define GLOOX_DEPRECATED __attribute__ ( (__deprecated__) ) 39 | # define GLOOX_DEPRECATED_CTOR explicit GLOOX_DEPRECATED 40 | #elif defined( _MSC_VER ) && ( _MSC_VER >= 1300 ) 41 | # define GLOOX_DEPRECATED __declspec( deprecated ) 42 | # define GLOOX_DEPRECATED_CTOR explicit GLOOX_DEPRECATED 43 | #else 44 | # define GLOOX_DEPRECATED 45 | # define GLOOX_DEPRECATED_CTOR 46 | #endif 47 | 48 | 49 | #endif // GLOOX_MACROS_H__ 50 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/messageeventhandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #ifndef MESSAGEEVENTHANDLER_H__ 15 | #define MESSAGEEVENTHANDLER_H__ 16 | 17 | #include "gloox.h" 18 | 19 | namespace gloox 20 | { 21 | 22 | class JID; 23 | 24 | /** 25 | * @brief A virtual interface that enables an object to be notified about 26 | * Message Events (@xep{0022}). 27 | * 28 | * @author Jakob Schröter 29 | * @since 0.8 30 | */ 31 | class GLOOX_API MessageEventHandler 32 | { 33 | public: 34 | /** 35 | * Virtual Destructor. 36 | */ 37 | virtual ~MessageEventHandler() {} 38 | 39 | /** 40 | * Notifies the MessageEventHandler that an event has been raised by the remote 41 | * contact. 42 | * @param from The originator of the Event. 43 | * @param event The Event which has been raised. 44 | */ 45 | virtual void handleMessageEvent( const JID& from, MessageEventType event ) = 0; 46 | 47 | }; 48 | 49 | } 50 | 51 | #endif // MESSAGEEVENTHANDLER_H__ 52 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/messagefilter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #include "messagefilter.h" 15 | 16 | 17 | namespace gloox 18 | { 19 | 20 | MessageFilter::MessageFilter( MessageSession* parent ) 21 | : m_parent( 0 ) 22 | { 23 | if( parent ) 24 | attachTo( parent ); 25 | } 26 | 27 | MessageFilter::~MessageFilter() 28 | { 29 | } 30 | 31 | void MessageFilter::attachTo( MessageSession* session ) 32 | { 33 | if( m_parent ) 34 | m_parent->removeMessageFilter( this ); 35 | 36 | if( session ) 37 | session->registerMessageFilter( this ); 38 | 39 | m_parent = session; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/mucinvitationhandler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2006-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #include "mucinvitationhandler.h" 16 | #include "mucroom.h" 17 | 18 | namespace gloox 19 | { 20 | 21 | MUCInvitationHandler::MUCInvitationHandler( ClientBase* parent ) 22 | { 23 | if( parent ) 24 | parent->registerStanzaExtension( new MUCRoom::MUCUser() ); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/mucmessagesession.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2006-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #include "mucmessagesession.h" 15 | #include "clientbase.h" 16 | #include "message.h" 17 | #include "messagehandler.h" 18 | 19 | namespace gloox 20 | { 21 | 22 | MUCMessageSession::MUCMessageSession( ClientBase* parent, const JID& jid ) 23 | : MessageSession( parent, jid, false, Message::Groupchat | Message::Chat 24 | | Message::Normal | Message::Error, 25 | false ) 26 | { 27 | } 28 | 29 | MUCMessageSession::~MUCMessageSession() 30 | { 31 | } 32 | 33 | void MUCMessageSession::handleMessage( Message& msg ) 34 | { 35 | if( m_messageHandler ) 36 | m_messageHandler->handleMessage( msg ); 37 | } 38 | 39 | void MUCMessageSession::send( const std::string& message ) 40 | { 41 | Message m( Message::Groupchat, m_target, message ); 42 | 43 | // decorate( m ); 44 | 45 | m_parent->send( m ); 46 | } 47 | 48 | void MUCMessageSession::setSubject( const std::string& subject ) 49 | { 50 | Message m( Message::Groupchat, m_target.bareJID(), EmptyString, subject ); 51 | m_parent->send( m ); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/nickname.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2007-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | #include "nickname.h" 14 | #include "tag.h" 15 | 16 | namespace gloox 17 | { 18 | 19 | Nickname::Nickname( const Tag* tag ) 20 | : StanzaExtension( ExtNickname ) 21 | { 22 | if( tag ) 23 | m_nick = tag->cdata(); 24 | } 25 | 26 | const std::string& Nickname::filterString() const 27 | { 28 | static const std::string filter = 29 | "/presence/nick[@xmlns='" + XMLNS_NICKNAME + "']" 30 | "|/message/nick[@xmlns='" + XMLNS_NICKNAME + "']"; 31 | return filter; 32 | } 33 | 34 | Tag* Nickname::tag() const 35 | { 36 | if( m_nick.empty() ) 37 | return 0; 38 | 39 | Tag* n = new Tag( "nick", XMLNS, XMLNS_NICKNAME ); 40 | n->setCData( m_nick ); 41 | return n; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/presencehandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2004-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #ifndef PRESENCEHANDLER_H__ 16 | #define PRESENCEHANDLER_H__ 17 | 18 | #include "presence.h" 19 | 20 | namespace gloox 21 | { 22 | 23 | /** 24 | * @brief A virtual interface which can be reimplemented to receive presence stanzas. 25 | * 26 | * Derived classes can be registered as PresenceHandlers with the Client. 27 | * Upon an incoming Presence packet @ref handlePresence() will be called. 28 | * @author Jakob Schröter 29 | */ 30 | class GLOOX_API PresenceHandler 31 | { 32 | public: 33 | /** 34 | * Virtual Destructor. 35 | */ 36 | virtual ~PresenceHandler() {} 37 | 38 | /** 39 | * Reimplement this function if you want to be updated on 40 | * incoming presence notifications. 41 | * @param presence The complete stanza. 42 | * @since 1.0 43 | */ 44 | virtual void handlePresence( const Presence& presence ) = 0; 45 | 46 | }; 47 | 48 | } 49 | 50 | #endif // PRESENCEHANDLER_H__ 51 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/privacyitem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #include "privacyitem.h" 16 | 17 | namespace gloox 18 | { 19 | 20 | PrivacyItem::PrivacyItem( const ItemType type, const ItemAction action, 21 | const int packetType, const std::string& value ) 22 | : m_type( type ), m_action( action ), m_packetType( packetType ), 23 | m_value( value ) 24 | { 25 | } 26 | 27 | PrivacyItem::~PrivacyItem() 28 | { 29 | } 30 | 31 | bool PrivacyItem::operator==( const PrivacyItem& item ) const 32 | { 33 | if( m_type == item.type() 34 | && m_action == item.action() 35 | && m_packetType == item.packetType() 36 | && m_value == item.value() ) 37 | return true; 38 | else 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/pubsubitem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #include "pubsubitem.h" 15 | #include "tag.h" 16 | 17 | namespace gloox 18 | { 19 | 20 | namespace PubSub 21 | { 22 | 23 | Item::Item() 24 | : m_payload( 0 ) 25 | { 26 | } 27 | 28 | Item::Item( const Tag* tag ) 29 | : m_payload( 0 ) 30 | { 31 | if( !tag || tag->name() != "item" ) 32 | return; 33 | 34 | m_id = tag->findAttribute( "id" ); 35 | 36 | if( tag->children().size() ) 37 | m_payload = tag->children().front()->clone(); 38 | } 39 | 40 | Item::Item( const Item& item ) 41 | : m_payload( item.m_payload ? item.m_payload->clone() : 0 ) 42 | { 43 | m_id = item.m_id; 44 | } 45 | 46 | Item::~Item() 47 | { 48 | delete m_payload; 49 | } 50 | 51 | Tag* Item::tag() const 52 | { 53 | Tag* t = new Tag( "item" ); 54 | t->addAttribute( "id", m_id ); 55 | if( m_payload ) 56 | t->addChild( m_payload->clone() ); 57 | 58 | return t; 59 | } 60 | 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/subscriptionhandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2004-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #ifndef SUBSCRIPTIONHANDLER_H__ 15 | #define SUBSCRIPTIONHANDLER_H__ 16 | 17 | #include "subscription.h" 18 | 19 | namespace gloox 20 | { 21 | 22 | /** 23 | * @brief A virtual interface which can be reimplemented to receive incoming subscription stanzas. 24 | * 25 | * Derived classes can be registered as SubscriptionHandlers with the Client. 26 | * Upon an incoming Subscription packet @ref handleSubscription() will be called. 27 | * @author Jakob Schröter 28 | */ 29 | class GLOOX_API SubscriptionHandler 30 | { 31 | public: 32 | /** 33 | * Virtual destructor. 34 | */ 35 | virtual ~SubscriptionHandler() {} 36 | 37 | /** 38 | * Reimplement this function if you want to be notified about incoming 39 | * subscriptions/subscription requests. 40 | * @param subscription The complete Subscription stanza. 41 | * @since 1.0 42 | */ 43 | virtual void handleSubscription( const Subscription& subscription ) = 0; 44 | 45 | }; 46 | 47 | } 48 | 49 | #endif // SUBSCRIPTIONHANDLER_H__ 50 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/taghandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #ifndef TAGHANDLER_H__ 15 | #define TAGHANDLER_H__ 16 | 17 | #include "tag.h" 18 | 19 | namespace gloox 20 | { 21 | 22 | /** 23 | * @brief A virtual interface which can be reimplemented to receive non-XMPP Core stanzas. 24 | * 25 | * Derived classes can be registered as TagHandlers with the ClientBase. 26 | * A TagHandler can handle arbitrary elements not defined by RFC 3920, XMPP Core. 27 | * 28 | * It can also be used to handle Tags emitted by Parser. 29 | * 30 | * @author Jakob Schröter 31 | */ 32 | class GLOOX_API TagHandler 33 | { 34 | public: 35 | /** 36 | * Virtual Destructor. 37 | */ 38 | virtual ~TagHandler() {} 39 | 40 | /** 41 | * This function is called when a registered XML element arrives. 42 | * As with every handler in gloox, the Tag is going to be deleted after this function returned. 43 | * If you need a copy afterwards, create it using Tag::clone(). 44 | * @param tag The complete Tag. 45 | */ 46 | virtual void handleTag( Tag* tag ) = 0; 47 | }; 48 | 49 | } 50 | 51 | #endif // TAGHANDLER_H__ 52 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/tlsopensslclient.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #include "tlsopensslclient.h" 16 | 17 | #ifdef HAVE_OPENSSL 18 | 19 | namespace gloox 20 | { 21 | 22 | OpenSSLClient::OpenSSLClient( TLSHandler* th, const std::string& server ) 23 | : OpenSSLBase( th, server ) 24 | { 25 | } 26 | 27 | OpenSSLClient::~OpenSSLClient() 28 | { 29 | } 30 | 31 | bool OpenSSLClient::setType() 32 | { 33 | m_ctx = SSL_CTX_new( TLSv1_client_method() ); 34 | if( !m_ctx ) 35 | return false; 36 | 37 | return true; 38 | } 39 | 40 | bool OpenSSLClient::hasChannelBinding() const 41 | { 42 | return true; 43 | } 44 | 45 | const std::string OpenSSLClient::channelBinding() const 46 | { 47 | unsigned char* buf[128]; 48 | int res = SSL_get_finished( m_ssl, buf, 128 ); 49 | return std::string( (char*)buf, res ); 50 | } 51 | 52 | int OpenSSLClient::handshakeFunction() 53 | { 54 | return SSL_connect( m_ssl ); 55 | } 56 | 57 | } 58 | 59 | #endif // HAVE_OPENSSL 60 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/tlsopensslserver.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | 15 | #ifndef TLSOPENSSLSERVER_H__ 16 | #define TLSOPENSSLSERVER_H__ 17 | 18 | #include "tlsopensslbase.h" 19 | 20 | #include "config.h" 21 | 22 | #ifdef HAVE_OPENSSL 23 | 24 | #include 25 | 26 | namespace gloox 27 | { 28 | 29 | /** 30 | * This class implements a TLS server backend using OpenSSL. 31 | * 32 | * @author Jakob Schröter 33 | * @since 1.0 34 | */ 35 | class OpenSSLServer : public OpenSSLBase 36 | { 37 | public: 38 | /** 39 | * Constructor. 40 | * @param th The TLSHandler to handle TLS-related events. 41 | */ 42 | OpenSSLServer( TLSHandler* th ); 43 | 44 | /** 45 | * Virtual destructor. 46 | */ 47 | virtual ~OpenSSLServer(); 48 | 49 | private: 50 | // reimplemented from OpenSSLBase 51 | virtual bool privateInit(); 52 | // reimplemented from OpenSSLBase 53 | virtual bool setType(); 54 | 55 | // reimplemented from OpenSSLBase 56 | virtual int handshakeFunction(); 57 | 58 | }; 59 | 60 | } 61 | 62 | #endif // HAVE_OPENSSL 63 | 64 | #endif // TLSOPENSSLSERVER_H__ 65 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/version.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION 1,0,13,0 6 | PRODUCTVERSION 1,0,13,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | FILEFLAGS 0 9 | FILEOS VOS__WINDOWS32 10 | FILETYPE VFT_DLL 11 | BEGIN 12 | BLOCK "StringFileInfo" 13 | BEGIN 14 | BLOCK "040904b0" 15 | BEGIN 16 | VALUE "FileDescription", "gloox Jabber/XMPP library\0" 17 | VALUE "ProductVersion", "1.0.13\0" 18 | VALUE "FileVersion", "1.0.13\0" 19 | VALUE "InternalName", "gloox\0" 20 | VALUE "OriginalFilename", "gloox.dll\0" 21 | VALUE "CompanyName", "Jakob Schroeter\0" 22 | VALUE "LegalCopyright", "Copyright (C) 2004-2015 Jakob Schroeter\0" 23 | VALUE "Licence", "GPLv3\0" 24 | VALUE "Info", "http://camaya.net/gloox\0" 25 | END 26 | END 27 | BLOCK "VarFileInfo" 28 | BEGIN 29 | VALUE "Translation", 0x409, 1200 30 | END 31 | END 32 | -------------------------------------------------------------------------------- /third_party/gloox/gloox/xhtmlim.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2007-2015 by Jakob Schröter 3 | This file is part of the gloox library. http://camaya.net/gloox 4 | 5 | This software is distributed under a license. The full license 6 | agreement can be found in the file LICENSE in this distribution. 7 | This software may not be copied, modified, sold or distributed 8 | other than expressed in the named license agreement. 9 | 10 | This software is distributed without any warranty. 11 | */ 12 | 13 | 14 | #include "xhtmlim.h" 15 | 16 | #include "tag.h" 17 | 18 | namespace gloox 19 | { 20 | 21 | XHtmlIM::XHtmlIM( const Tag* xhtml ) 22 | : StanzaExtension( ExtXHtmlIM ), m_xhtml( 0 ) 23 | { 24 | if( !xhtml|| xhtml->name() != "html" || xhtml->xmlns() != XMLNS_XHTML_IM ) 25 | return; 26 | 27 | if( !xhtml->hasChild( "body", XMLNS, "http://www.w3.org/1999/xhtml" ) ) 28 | return; 29 | 30 | m_xhtml = xhtml->clone(); 31 | } 32 | 33 | XHtmlIM::~XHtmlIM() 34 | { 35 | delete m_xhtml; 36 | } 37 | 38 | const std::string& XHtmlIM::filterString() const 39 | { 40 | static const std::string filter = "/message/html[@xmlns='" + XMLNS_XHTML_IM + "']"; 41 | return filter; 42 | } 43 | 44 | Tag* XHtmlIM::tag() const 45 | { 46 | return m_xhtml->clone(); 47 | } 48 | 49 | StanzaExtension* XHtmlIM::clone() const 50 | { 51 | XHtmlIM* x = new XHtmlIM(); 52 | x->m_xhtml = m_xhtml ? m_xhtml->clone() : 0; 53 | return x; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /third_party/qqwry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | project(qqwry) 3 | 4 | include_directories(include) 5 | 6 | add_executable(getip test/test.cpp include/qqwry/ipdb.hpp) 7 | 8 | find_package(ZLIB 1.2) 9 | 10 | if (ZLIB_FOUND) 11 | add_definitions(-DHAVE_ZLIB) 12 | target_link_libraries(getip ${ZLIB_LIBRARIES}) 13 | else() 14 | #add_library(miniz STATIC miniz.c) 15 | #target_link_libraries(getip miniz) 16 | endif() 17 | 18 | if(MSVC) 19 | target_link_libraries(getip ws2_32.lib wininet.lib) 20 | endif() 21 | -------------------------------------------------------------------------------- /third_party/qqwry/License.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/third_party/qqwry/License.txt -------------------------------------------------------------------------------- /third_party/qqwry/README.md: -------------------------------------------------------------------------------- 1 | 纯真IP数据库 解析 库使用说明 2 | 3 | 首先实例化 QQWry::ipdb 类 4 | 构造函数就是 QQwry.Dat 文件名 5 | 6 | 也可以自己读入QQwry.Dat 文件,然后将文件在内存中的起始位置和大小传递进来。 7 | 8 | 就这么2个重载的构造函数,呵呵 9 | 10 | 如果文件打开失败,将抛出异常,异常类型为 std::runtime_error 11 | 12 | 13 | 要查询ip所对应的地址 14 | 调用 GetIPLocation 15 | 16 | 传递 in_addr 结构 17 | 作为参数, 18 | 19 | 结果返回 IPLocation 。 20 | 内部使用了折半查找法,所以查找很迅速 (最多20次比较),不用担心性能问题 21 | 22 | 23 | 要查询 地址所对应的ip范围 24 | 调用GetIPs 25 | -------------------------------------------------------------------------------- /third_party/qqwry/qqwry.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "getip", "vcproject\getip\getip.vcxproj", "{2928596A-8A21-4423-9476-AC089A88D48B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {2928596A-8A21-4423-9476-AC089A88D48B}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {2928596A-8A21-4423-9476-AC089A88D48B}.Debug|Win32.Build.0 = Debug|Win32 18 | {2928596A-8A21-4423-9476-AC089A88D48B}.Debug|x64.ActiveCfg = Debug|x64 19 | {2928596A-8A21-4423-9476-AC089A88D48B}.Debug|x64.Build.0 = Debug|x64 20 | {2928596A-8A21-4423-9476-AC089A88D48B}.Release|Win32.ActiveCfg = Release|Win32 21 | {2928596A-8A21-4423-9476-AC089A88D48B}.Release|Win32.Build.0 = Release|Win32 22 | {2928596A-8A21-4423-9476-AC089A88D48B}.Release|x64.ActiveCfg = Release|x64 23 | {2928596A-8A21-4423-9476-AC089A88D48B}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /third_party/qqwry/vcproject/getip/getip.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /third_party/qqwry/说明.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/third_party/qqwry/说明.txt -------------------------------------------------------------------------------- /third_party/sqlite/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | project(sqlite3) 3 | 4 | include_directories(include) 5 | 6 | add_library(sqlite3 STATIC lib/sqlite3.c) 7 | -------------------------------------------------------------------------------- /tweakvcflasgs.cmake: -------------------------------------------------------------------------------- 1 | if(MSVC) 2 | set (CMAKE_CONFIGURATION_TYPES "Release;Debug") 3 | set(CompilerFlags 4 | CMAKE_CXX_FLAGS 5 | CMAKE_CXX_FLAGS_DEBUG 6 | CMAKE_CXX_FLAGS_RELEASE 7 | CMAKE_CXX_FLAGS_MinSizeRel 8 | CMAKE_C_FLAGS 9 | CMAKE_C_FLAGS_DEBUG 10 | CMAKE_C_FLAGS_RELEASE 11 | CMAKE_C_FLAGS_MinSizeRel 12 | ) 13 | 14 | foreach(CompilerFlag ${CompilerFlags}) 15 | string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") 16 | endforeach() 17 | 18 | foreach(CompilerFlag ${CompilerFlags}) 19 | string(REPLACE "/W3" "/W1" ${CompilerFlag} "${${CompilerFlag}}") 20 | endforeach() 21 | 22 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /MP") 23 | 24 | #set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") 25 | set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /ignore:4099 /NODEFAULTLIB:libcmt.lib") 26 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER} /SAFESEH:NO") 27 | 28 | endif(MSVC) 29 | 30 | -------------------------------------------------------------------------------- /tweet.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/avbot/ccbc7e53b8eedd52a879626c00e3f0ca26e4605d/tweet.wav -------------------------------------------------------------------------------- /ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 2 | 3 | find_package(Qt5Widgets) 4 | 5 | add_library(avbotui_base STATIC src/avbotui.cpp) 6 | 7 | if (Qt5Widgets_FOUND AND WITH_QT_GUI) 8 | add_definitions(-DWITH_QT_GUI) 9 | add_definitions(-DSTATIC_QT5) 10 | set(ENABLE_QT_STATIC ON) 11 | add_subdirectory(src/qt-gui) 12 | else() 13 | add_subdirectory(src/cli) 14 | endif() 15 | 16 | target_include_directories(avbotui_base PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) 17 | 18 | add_library(avbotui STATIC uifactory.cpp) 19 | 20 | target_link_libraries(avbotui avbotui_base avbotgui) 21 | -------------------------------------------------------------------------------- /ui/src/avbotui.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "avbotui.hpp" 3 | 4 | #include 5 | 6 | avbotui::avbotui(boost::asio::io_service& io_service) 7 | : m_io_service(io_service) 8 | { 9 | } 10 | 11 | avbotui::~avbotui() 12 | { 13 | 14 | } 15 | 16 | void avbotui::append_log(int logleve, const char* msg) 17 | { 18 | } 19 | 20 | void avbotui::report_fatal_error(std::string text) 21 | { 22 | exit(1); 23 | } 24 | 25 | void avbotui::show_vc_and_get_input_with_timeout(std::string imgdata, int timeout_sec, vc_result_call_back cb) 26 | { 27 | m_io_service.post(std::bind(cb, std::string())); 28 | } 29 | 30 | void avbotui::run() 31 | { 32 | avloop_run_gui(m_io_service); 33 | } 34 | 35 | void avbotui::quit() 36 | { 37 | } 38 | -------------------------------------------------------------------------------- /ui/src/cli/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(Boost 1.55 REQUIRED COMPONENTS system thread) 3 | 4 | add_library(avbotgui STATIC avbotcli.cpp) 5 | target_link_libraries(avbotgui avbotui_base) 6 | target_link_libraries(avbotgui Qt5::Core) 7 | 8 | target_link_libraries(avbotgui ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) 9 | -------------------------------------------------------------------------------- /ui/src/cli/avbotcli.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include 3 | #include 4 | #include "avbotcli.hpp" 5 | 6 | #include 7 | #include 8 | 9 | avbotcliui::avbotcliui(boost::asio::io_service& io_service, boost::logger& logger, int& argc, char* argv[]) 10 | : avbotui(io_service) 11 | { 12 | if (QCoreApplication::instance() == nullptr) 13 | app = new QCoreApplication(argc, argv); 14 | } 15 | 16 | avbotcliui::~avbotcliui() 17 | { 18 | 19 | } 20 | 21 | std::string timedout_cin(int timeout_sec) 22 | { 23 | // 如何实现超时的输入? 24 | std::string line; 25 | 26 | std::cin >> line; 27 | 28 | return line; 29 | } 30 | 31 | void avbotcliui::show_vc_and_get_input_with_timeout(std::string imgdata, int timeout_sec, avbotui::vc_result_call_back cb) 32 | { 33 | // 在控制台输出提示. 34 | std::cout << "请查看log目录下的vercode.jpeg 然后输入验证码:" ; 35 | std::cout.flush(); 36 | 37 | std::ofstream vercode("vercode.jpeg", std::ofstream::binary); 38 | vercode.write(imgdata.c_str(), imgdata.size()); 39 | vercode.close(); 40 | 41 | boost::async(boost::launch::async, [timeout_sec, cb]() 42 | { 43 | cb(timedout_cin(timeout_sec)); 44 | }); 45 | } 46 | 47 | void avbotcliui::report_fatal_error(std::string text) 48 | { 49 | std::cerr << text << std::endl; 50 | exit(1); 51 | } 52 | 53 | void avbotcliui::run() 54 | { 55 | // 创建 IO 线程 56 | m_io_thread = boost::thread([this]() 57 | { 58 | avbotui::run(); 59 | }); 60 | 61 | app->exec(); 62 | m_io_service.stop(); 63 | m_io_thread.join(); 64 | } 65 | -------------------------------------------------------------------------------- /ui/src/cli/avbotcli.hpp: -------------------------------------------------------------------------------- 1 |  2 | #pragma once 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class QCoreApplication; 9 | class avbotcliui : public avbotui 10 | { 11 | public: 12 | avbotcliui(boost::asio::io_service&, boost::logger& logger, int& argc, char* argv[]); 13 | ~avbotcliui(); 14 | 15 | virtual void show_vc_and_get_input_with_timeout(std::string imgdata, int timeout_sec, vc_result_call_back cb); 16 | 17 | virtual void report_fatal_error(std::string text); 18 | 19 | virtual void run(); 20 | 21 | QCoreApplication* app; 22 | boost::thread m_io_thread; 23 | }; 24 | -------------------------------------------------------------------------------- /ui/src/qt-gui/qcenteredimageview.hpp: -------------------------------------------------------------------------------- 1 |  2 | #pragma once 3 | #include 4 | #include 5 | #include 6 | 7 | class QCenteredImageView : public QWidget 8 | { 9 | public: 10 | explicit QCenteredImageView(QWidget* parent = 0, Qt::WindowFlags f = 0) 11 | : QWidget(parent, f) 12 | { 13 | m_label = new QLabel(this); 14 | m_label->setScaledContents(true); 15 | } 16 | 17 | virtual void resizeEvent(QResizeEvent* e) 18 | { 19 | if (pixmap()) 20 | { 21 | auto s = pixmap()->size(); 22 | s.scale(e->size().width(), e->size().height(), Qt::KeepAspectRatio); 23 | 24 | int left, top, right, bottom; 25 | getContentsMargins(&left, &top, &right, &bottom); 26 | 27 | QRect effectiveRect(QPoint(0,0), e->size()); 28 | effectiveRect.adjust(+left, +top, -right, -bottom); 29 | 30 | QRect label_rect(QPoint(0,0), s); 31 | 32 | label_rect.moveCenter(effectiveRect.center()); 33 | 34 | m_label->setGeometry(label_rect); 35 | 36 | e->accept(); 37 | } 38 | else 39 | { 40 | QWidget::resizeEvent(e); 41 | } 42 | 43 | } 44 | 45 | const QPixmap* pixmap() const 46 | { 47 | return m_label->pixmap(); 48 | } 49 | 50 | virtual QSize sizeHint() const 51 | { 52 | if (pixmap()) 53 | { 54 | auto s = pixmap()->size(); 55 | return s*2; 56 | }else return QWidget::sizeHint(); 57 | } 58 | 59 | public Q_SLOTS: 60 | void setPixmap(const QPixmap &p) 61 | { 62 | m_label->setPixmap(p); 63 | } 64 | 65 | 66 | private: 67 | QLabel* m_label; 68 | }; 69 | -------------------------------------------------------------------------------- /ui/src/qt-gui/qtgui.cpp: -------------------------------------------------------------------------------- 1 | #include "qtgui.hpp" 2 | #include "avbotqtui_impl.hpp" 3 | 4 | avbotqtui::~avbotqtui() 5 | { 6 | delete impl; 7 | } 8 | 9 | avbotqtui::avbotqtui(boost::asio::io_service& io_service, boost::logger& logger, int& argc, char* argv[]) 10 | : avbotui(io_service) 11 | { 12 | app = new QApplication(argc, argv); 13 | app->setQuitOnLastWindowClosed(false); 14 | impl = new avbotqtui_impl(io_service, logger, argc, argv); 15 | } 16 | 17 | void avbotqtui::report_fatal_error(std::string text) 18 | { 19 | impl->report_fatal_error(text); 20 | } 21 | 22 | void avbotqtui::run() 23 | { 24 | impl->run(); 25 | } 26 | 27 | void avbotqtui::show_vc_and_get_input_with_timeout(std::string imgdata, int timeout_sec, avbotui::vc_result_call_back cb) 28 | { 29 | impl->show_vc_and_get_input_with_timeout(imgdata, timeout_sec, cb); 30 | } 31 | 32 | void avbotqtui::quit() 33 | { 34 | impl->quit(); 35 | } 36 | 37 | #ifdef _WIN32 38 | 39 | #ifdef STATIC_QT5 40 | #include 41 | #include 42 | 43 | Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); 44 | 45 | Q_IMPORT_PLUGIN(QICOPlugin); 46 | 47 | #ifdef _DEBUG 48 | #pragma comment(lib, "Qt5PlatformSupportd.lib") 49 | #pragma comment(lib, "qwindowsd.lib") 50 | #pragma comment(lib, "qicod.lib") 51 | #else 52 | #pragma comment(lib, "Qt5PlatformSupport.lib") 53 | #pragma comment(lib, "qwindows.lib") 54 | #pragma comment(lib, "qico.lib") 55 | #endif 56 | 57 | #pragma comment(lib, "opengl32.lib") 58 | #pragma comment(lib, "Imm32.lib") 59 | #pragma comment(lib, "winmm.lib") 60 | #endif 61 | #endif 62 | -------------------------------------------------------------------------------- /ui/src/qt-gui/qtgui.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "avbotui.hpp" 6 | 7 | class QApplication; 8 | class avbotqtui_impl; 9 | class avbotqtui : public avbotui 10 | { 11 | public: 12 | avbotqtui(boost::asio::io_service& io_service, boost::logger& logger, int& argc, char* argv[]); 13 | ~avbotqtui(); 14 | 15 | virtual void run(); 16 | virtual void report_fatal_error(std::string text); 17 | virtual void show_vc_and_get_input_with_timeout(std::string imgdata, int timeout_sec, avbotui::vc_result_call_back cb); 18 | virtual void quit(); 19 | 20 | avbotqtui_impl* impl; 21 | QApplication* app; 22 | }; 23 | -------------------------------------------------------------------------------- /ui/src/qt-gui/vc_input_dialog.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "avbotui.hpp" 4 | #include "avbotqtui_impl.hpp" 5 | 6 | #include "ui_vc_input_dialog.h" 7 | 8 | class vc_input_dialog : public QDialog 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit vc_input_dialog(avbotqtui_impl* ui_impl, std::string imgdata, int timeout_sec, avbotui::vc_result_call_back cb, QWidget *parent = 0); 14 | 15 | ~vc_input_dialog(); 16 | 17 | protected Q_SLOTS: 18 | void changeEvent(QEvent *e); 19 | 20 | void timer_update(); 21 | 22 | void on_vc_input_dialog_accepted(); 23 | void on_vc_input_dialog_rejected(); 24 | 25 | private: 26 | Ui::vc_input_dialog ui; 27 | 28 | avbotui::vc_result_call_back m_handler; 29 | avbotqtui_impl* ui_impl; 30 | 31 | int m_time_remains; 32 | bool m_posted; 33 | }; 34 | 35 | -------------------------------------------------------------------------------- /ui/uifactory.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "avbotui.hpp" 3 | 4 | #if defined(WITH_QT_GUI) 5 | #include "./src/qt-gui/qtgui.hpp" 6 | #else 7 | #include "./src/cli/avbotcli.hpp" 8 | #endif 9 | 10 | static std::shared_ptr static_avbot_ui_instance; 11 | 12 | void ui_init(boost::asio::io_service& io_service, boost::logger& logger, int& argc, char* argv[]) 13 | { 14 | // 好了, 根据需要返回 15 | #if defined(WITH_QT_GUI) 16 | static_avbot_ui_instance.reset(new avbotqtui(io_service, logger, argc, argv)); 17 | #else 18 | static_avbot_ui_instance.reset(new avbotcliui(io_service, logger, argc, argv)); 19 | #endif 20 | } 21 | 22 | std::shared_ptr ui_get_instance() 23 | { 24 | return static_avbot_ui_instance; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /version.c.in: -------------------------------------------------------------------------------- 1 | 2 | extern const char * avbot_version() 3 | { 4 | return "@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@"; 5 | } 6 | 7 | extern const char * avbot_version_build_time() 8 | { 9 | return __DATE__ " " __TIME__; 10 | } 11 | --------------------------------------------------------------------------------