{"id":13343133,"url":"https://github.com/soroush-app/xmpp_utils","last_synced_at":"2025-03-12T04:32:23.599Z","repository":{"id":96224304,"uuid":"101545913","full_name":"soroush-app/xmpp_utils","owner":"soroush-app","description":"Fast and easy-to-use API for working on well-known XMPP data structures","archived":true,"fork":false,"pushed_at":"2017-11-07T15:54:56.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-24T15:38:26.475Z","etag":null,"topics":["erlang","erlang-library","erlang-otp","xmpp","xmpp-library"],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soroush-app.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-27T10:45:53.000Z","updated_at":"2023-10-07T02:31:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"1999f4f2-f478-4651-9cea-f24250b97538","html_url":"https://github.com/soroush-app/xmpp_utils","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroush-app%2Fxmpp_utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroush-app%2Fxmpp_utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroush-app%2Fxmpp_utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroush-app%2Fxmpp_utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soroush-app","download_url":"https://codeload.github.com/soroush-app/xmpp_utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243158977,"owners_count":20245668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["erlang","erlang-library","erlang-otp","xmpp","xmpp-library"],"created_at":"2024-07-29T19:30:40.274Z","updated_at":"2025-03-12T04:32:23.594Z","avatar_url":"https://github.com/soroush-app.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xmpp_utils\nThis library provides fast, atomic and easy-to-use API for encoding/decoding some well-known XMPP data structures (stanza and jid).  \n\n\n### Examples\n```erlang\nErlang/OTP 19 [erts-8.3] [source-d5c06c6] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]\nEshell V8.3  (abort with ^G)\n1\u003e Pkt = \u003c\u003c\"\u003cmessage from='1@domain.zone' to='domain' type='chat' id='12345'\u003e\u003cbody\u003efoo\u003c/body\u003e\u003c/message\u003e\"\u003e\u003e.\n\u003c\u003c\"\u003cmessage from='1@domain.zone' to='domain' type='chat' id='12345'\u003e\u003cbody\u003efoo\u003c/body\u003e\u003c/message\u003e\"\u003e\u003e\n\n2\u003e XMPP_XML = xmpp_utils:parse_pkt(Pkt).\n{xmpp_utils_xml,\u003c\u003c\"message\"\u003e\u003e,\n                {xmpp_utils_jid,\u003c\u003c\"1\"\u003e\u003e,\u003c\u003c\"domain.zone\"\u003e\u003e,\u003c\u003c\u003e\u003e},\n                {xmpp_utils_jid,\u003c\u003c\u003e\u003e,\u003c\u003c\"domain\"\u003e\u003e,\u003c\u003c\u003e\u003e},\n                \u003c\u003c\"chat\"\u003e\u003e,\u003c\u003c\"12345\"\u003e\u003e,\n                [{xmlel,\u003c\u003c\"body\"\u003e\u003e,[],[{xmlcdata,\u003c\u003c\"foo\"\u003e\u003e}]}]}\n%% This is an Erlang record and in code is equal to:\n%% #xmpp_utils_xml{kind = \u003c\u003c\"message\"\u003e\u003e\n%%                ,from = #xmpp_utils_jid{username = \u003c\u003c\"1\"\u003e\u003e, sever = \u003c\u003c\"domain.zone\"\u003e\u003e, resource = \u003c\u003c\u003e\u003e}\n%%                ,to = #xmpp_utils_jid{username = \u003c\u003c\u003e\u003e, server = \u003c\u003c\"domain\"\u003e\u003e, reource = \u003c\u003c\u003e\u003e}\n%%                ,type = \u003c\u003c\"chat\"\u003e\u003e\n%%                ,id = \u003c\u003c\"12345\"\u003e\u003e\n%%                ,children = [#xmlel{name = \u003c\u003c\"body\"\u003e\u003e\n%%                                   ,attrs = []\n%%                                   ,children = [#xmlcdata{content = \u003c\u003c\"foo\"\u003e\u003e}]}]}\n%% Just you need to include \"xmpp_utils.hrl\"\n\n\n3\u003e xmpp_utils:make_pkt(XMPP_XML).\n\u003c\u003c\"\u003cmessage from='1@domain.zone' to='domain' type='chat' id='12345'\u003e\u003cbody\u003efoo\u003c/body\u003e\u003c/message\u003e\"\u003e\u003e\n\n4\u003e xmpp_utils:make_pkt(xmpp_utils:change_from_to(XMPP_XML)).\n\u003c\u003c\"\u003cmessage from='domain' to='1@domain.zone' type='chat' id='12345'\u003e\u003cbody\u003efoo\u003c/body\u003e\u003c/message\u003e\"\u003e\u003e\n\n5\u003e xmpp_utils:make_pkt(xmpp_utils:set_from_to(\u003c\u003c\"u@s/r\"\u003e\u003e, \u003c\u003c\"g@conference.s\"\u003e\u003e, XMPP_XML)).\n\u003c\u003c\"\u003cmessage from='u@s/r' to='g@conference.s' type='chat' id='12345'\u003e\u003cbody\u003efoo\u003c/body\u003e\u003c/message\u003e\"\u003e\u003e\n\n6\u003e xmpp_utils:make_pkt(\u003c\u003c\"iq\"\u003e\u003e %% Kind of packet \u003c\u003c\"iq\"\u003e\u003e, \u003c\u003c\"presence\"\u003e\u003e, \u003c\u003c\"message\"\u003e\u003e, etc.\n                      ,\u003c\u003c\"me@ourserver/Client1\"\u003e\u003e %% From jid, can be binary or #xmpp_utils_jid{} record\n                      ,{xmpp_utils_jid, \u003c\u003c\"you\"\u003e\u003e, \u003c\u003c\"ourserver\"\u003e\u003e, \u003c\u003c\"Client2\"\u003e\u003e} %% Destination(to) jid, can be binary or #xmpp_utils_jid{} record\n                      ,\u003c\u003c\"get\"\u003e\u003e %% Type\n                      ,\u003c\u003c\"id1234567890\"\u003e\u003e %% ID\n                      ,[{xmlel, \u003c\u003c\"query\"\u003e\u003e, [{\u003c\u003c\"xmlns\"\u003e\u003e, \u003c\u003c\"urn:xmpp:ping\"\u003e\u003e}]}] %% Children\n                      ,[{\u003c\u003c\"xml:lang\"\u003e\u003e, \u003c\u003c\"en\"\u003e\u003e}] %% If packet has other attributes, defined them in this way\n                      ).\n\u003c\u003c\"\u003ciq xml:lang='en' from='me@ourserver/Client1' to='you@ourserver/Client2' type='get' id='id1234567890'\u003e\u003cquery xmlns='urn:xmpp:ping'/\u003e\u003c/iq\u003e\"\u003e\u003e\n\n7\u003e xmpp_utils:parse_jid(\u003c\u003c\"me@server/res\"\u003e\u003e).\n{xmpp_utils_jid,\u003c\u003c\"me\"\u003e\u003e,\u003c\u003c\"server\"\u003e\u003e,\u003c\u003c\"res\"\u003e\u003e}\n%% This is an Erlang record and in code is equal to:\n%% #xmpp_utils_jid{username = \u003c\u003c\"me\"\u003e\u003e, server = \u003c\u003c\"server\"\u003e\u003e, resource = \u003c\u003c\"res\"\u003e\u003e}\n\n8\u003e xmpp_utils:get_bare_jid(\u003c\u003c\"me@server/res\"\u003e\u003e).       \n\u003c\u003c\"me@server\"\u003e\u003e\n\n9\u003e xmpp_utils:get_bare_jid(J).                  \n\u003c\u003c\"me@server\"\u003e\u003e\n\n10\u003e xmpp_utils:make_xmpp_error(\u003c\u003c\"not-acceptable\"\u003e\u003e).\n{xmlel,\u003c\u003c\"error\"\u003e\u003e,\n       [{\u003c\u003c\"code\"\u003e\u003e,\u003c\u003c\"406\"\u003e\u003e},{\u003c\u003c\"type\"\u003e\u003e,\u003c\u003c\"modify\"\u003e\u003e}],\n       [{xmlel,\u003c\u003c\"not-acceptable\"\u003e\u003e,\n               [{\u003c\u003c\"xmlns\"\u003e\u003e,\u003c\u003c\"urn:ietf:params:xml:ns:xmpp-stanzas\"\u003e\u003e}],\n               []}]}\n\n\n11\u003e xmpp_utils:make_xmpp_error_pkt(\u003c\u003c\"not-acceptable\"\u003e\u003e).\n\u003c\u003c\"\u003cerror type='modify' code='406'\u003e\u003cnot-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/\u003e\u003c/error\u003e\"\u003e\u003e\n\n\n12\u003e xmpp_utils:make_xmpp_error_pkt(\u003c\u003c\"item-not-found\"\u003e\u003e, \u003c\u003c\"Why item not found\"\u003e\u003e).\n\u003c\u003c\"\u003cerror type='cancel' code='404'\u003e\u003citem-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/\u003e\u003ctext xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'\u003eWhy item not found\u003c/text\u003e\u003c/error\u003e\"\u003e\u003e\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoroush-app%2Fxmpp_utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoroush-app%2Fxmpp_utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoroush-app%2Fxmpp_utils/lists"}