{"id":20263790,"url":"https://github.com/profanity-im/stabber","last_synced_at":"2026-03-05T03:33:20.579Z","repository":{"id":31883020,"uuid":"35451653","full_name":"profanity-im/stabber","owner":"profanity-im","description":"Stubbed XMPP Server","archived":false,"fork":false,"pushed_at":"2023-11-18T09:46:48.000Z","size":120,"stargazers_count":12,"open_issues_count":6,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-21T16:46:26.843Z","etag":null,"topics":["mocking","stubbed-xmpp-server","testing","testing-tools","xmpp"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/profanity-im.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2015-05-11T21:40:59.000Z","updated_at":"2024-06-03T13:04:00.000Z","dependencies_parsed_at":"2024-11-14T11:37:53.854Z","dependency_job_id":"663d7041-b15f-476e-8a14-961819096cfa","html_url":"https://github.com/profanity-im/stabber","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/profanity-im/stabber","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profanity-im%2Fstabber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profanity-im%2Fstabber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profanity-im%2Fstabber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profanity-im%2Fstabber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/profanity-im","download_url":"https://codeload.github.com/profanity-im/stabber/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profanity-im%2Fstabber/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30108652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:32:43.378Z","status":"ssl_error","status_checked_at":"2026-03-05T03:32:22.667Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["mocking","stubbed-xmpp-server","testing","testing-tools","xmpp"],"created_at":"2024-11-14T11:36:18.363Z","updated_at":"2026-03-05T03:33:20.530Z","avatar_url":"https://github.com/profanity-im.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stabber\nStubbed XMPP (Jabber) Server.\n\n# Overview\nStabber acts as a stubbed XMPP service for testing purposes, supporting:\n* Sending of XMPP stanzas.\n* Responding to XMPP stanzas with stubbed responses, by id, and by query namespace\n* Verifying that XMPP stanzas were received.\n* C API\n* Python bindings https://github.com/boothj5/stabber-python\n* Java bindings https://github.com/boothj5/stabber-java\n* HTTP API\n\nThe project is work in progress, and is being developed alongside https://github.com/boothj5/profanity\n\n# Installing\n```\n./bootstrap.sh\n./configure\nmake\nmake install (as root)\n```\n# C API\nInclude the following header in your tests:\n```c\n#include \u003cstabber.h\u003e\n```\nInclude the following in the linker path when compiling tests:\n```\n-lstabber\n```\n\n### Starting\nTo start Stabber:\n```c\nstbbr_start(stbbr_log_t loglevel, int port, int httpport);\n```\n`loglevel` - Must be one of `STBBR_LOGDEBUG`, `STBBR_LOGINFO`, `STBBR_LOGWARN`, `STBBR_LOGERROR`.\n\n`port` - The port on which to run the stubbed XMPP server.\n\n`httpport` - The port on which to run the HTTP API, a value of `0` will not run the HTTP daemon.\n\n### Stopping\nTo stop Stabber:\n```c\nstbbr_stop();\n```\n\n### Authentication\nCurrently only legacy authentication is supported, to set the password that stabber expects when an account connects:\n```c\nstbbr_auth_passwd(\"mypassword\");\n```\nThe default if not set is \"password\".\n\n### Sending stanzas\nTo make Stabber send an XMPP stanza:\n```c\nstbbr_send(\n    \"\u003ciq id=\\\"ping1\\\" type=\\\"get\\\" to=\\\"stabber@localhost/profanity\\\" from=\\\"localhost\\\"\u003e\"\n        \"\u003cping xmlns=\\\"urn:xmpp:ping\\\"/\u003e\"\n    \"\u003c/iq\u003e\"\n);\n```\n\n### Responding to stanzas\nAs well as being able to send an XMPP stanza at any time, you can also respond to a stanza by its id attribute:\n```c\nstbbr_for_id(\"msg_21\",\n    \"\u003cmessage id=\\\"message17\\\" to=\\\"stabber@localhost\\\" from=\\\"buddy1@localhost/mobile\\\" type=\\\"chat\\\"\u003e\"\n        \"\u003cbody\u003eI'm not real!\u003c/body\u003e\"\n    \"\u003c/message\u003e\"\n);\n```\nTo respond to an IQ get query (for example a roster request), use the following:\n```c\nstbbr_for_query(\"jabber:iq:roster\",\n    \"\u003ciq type=\\\"result\\\" to=\\\"stabber@localhost/profanity\\\"\u003e\"\n        \"\u003cquery xmlns=\\\"jabber:iq:roster\\\" ver=\\\"362\\\"\u003e\"\n            \"\u003citem jid=\\\"buddy1@localhost\\\" subscription=\\\"both\\\" name=\\\"Buddy1\\\"/\u003e\"\n            \"\u003citem jid=\\\"buddy2@localhost\\\" subscription=\\\"both\\\" name=\\\"Buddy2\\\"/\u003e\"\n        \"\u003c/query\u003e\"\n    \"\u003c/iq\u003e\"\n);\n```\nNote that no ID is included in the stubbed response, Stabber will use the ID sent in the query. If an ID is supplied, it wil be overwitten by Stabber, again  using the ID sent in the query.\n\n### Verify sent stanzas\nTo verify that you sent a particular stanza to Stabber:\n```c\nstbbr_received(\n    \"\u003cmessage id=\\\"msg24415\\\" to=\\\"buddy1@localhost/mobile\\\" type=\\\"chat\\\"\u003e\"\n        \"\u003cbody\u003eI know, its a test.\u003c/body\u003e\"\n    \"\u003c/message\u003e\"\n);\n```\nThe above function returns 1 if the stanza has been received, and 0 if it hasn't.\nThe following function check that it was specifically the last stanza received:\n```c\nstbbr_last_received(\n    \"\u003cmessage id=\\\"msg24415\\\" to=\\\"buddy1@localhost/mobile\\\" type=\\\"chat\\\"\u003e\"\n        \"\u003cbody\u003eI know, its a test.\u003c/body\u003e\"\n    \"\u003c/message\u003e\"\n);\n```\nBoth verifications allow for wildcards (*) as attribute values, for example, if you don't know the id's that are generated by your client:\n```c\nstbbr_received(\n    \"\u003cmessage id=\\\"*\\\" to=\\\"buddy1@localhost/mobile\\\" type=\\\"chat\\\"\u003e\"\n        \"\u003cbody\u003eI know, its a test.\u003c/body\u003e\"\n    \"\u003c/message\u003e\"\n);\n```\nBy default the verification calls block for up to 10 seconds, the timeout in seconds can be set with:\n```c\nstbbr_set_timeout(3);\n```\nA value of 0 or less is non-blocking and will return immediately.\n\n### Waiting\nSometimes a test needs to wait until the client being tested has had time to send some specific stanzas. The following will block until a stanza with a particular ID has been received by Stabber:\n\n```c\nstbbr_wait_for(\"someid\");\n```\n\n# HTTP API\nTo start stabber in standalone mode:\n```\nstabber -p \u003cport\u003e -h \u003chttpport\u003e -l \u003cloglevel\u003e \n```\n\n`\u003cport\u003e` - The port on which to run the stubbed XMPP server.\n\n`\u003chttpport\u003e` - The port on which to run the HTTP API, optional.\n\n`\u003cloglevel\u003e` - The log level for Stabber, one of `DEBUG`, `INFO`, `WARN`, `ERROR`. Optional with a default of `INFO`.\n\n### Sending stanzas\nTo send a message to a client currently connected to Stabber on port 5230, send a POST request to `http://localhost:5231/send` with the body containing the stanza to send, e.g.:\n```\ncurl --data '\u003cmessage id=\"mesg10\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/laptop\" type=\"chat\"\u003e\u003cbody\u003eHere is a message sent from stabber, using the HTTP api\u003c/body\u003e\u003c/message\u003e' http://localhost:5231/send\n```\n\n### Responding to stanzas\nTo respond to a stanza with a specfic id sent from the client, send a POST request to `http://localhost:5231/for?id=\u003cid\u003e` where `\u003cid\u003e` is the the id you wish to respond to, e.g.:\n```\ncurl --data '\u003cmessage id=\"messageid1\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/work\" type=\"chat\"\u003e\u003cbody\u003eheres my answer!\u003c/body\u003e\u003c/message\u003e' http://localhost:5231/for?id=prof_msg_1\n```\nTo respond to a stanza with a specfic query namespace sent from the client, send a POST request to `http://localhost:5231/for?query=\u003cxmlns\u003e` where `\u003cxmlns\u003e` is the the query namespace you wish to respond to, e.g.:\n```\ncurl --data '\u003ciq type=\"result\" to=\"stabber@localhost/profanity\"\u003e\u003cquery xmlns=\"jabber:iq:roster\" ver=\"362\"\u003e\u003citem jid=\"buddy1@localhost\" subscription=\"both\" name=\"Buddy1\"/\u003e\u003citem jid=\"buddy2@localhost\" subscription=\"both\" name=\"Buddy2\"/\u003e\u003c/query\u003e\u003c/iq\u003e' http://localhost:5231/for?query=jabber:iq:roster\n```\n\n### Verify sent stanzas\nTo verify that a stanza was received by Stabber, send a POST request to `http://localhost:5231/verify` where the body is the expected stanza, e.g.:\n```\ncurl --data '\u003ciq id=\"*\" type=\"get\"\u003e\u003cping xmlns=\"urn:xmpp:ping\"/\u003e\u003c/iq\u003e' http://localhost:5231/verify\n```\nThe request will return immediately with a body containing either `true` or `false`.\n\n# Logs\nStabber logs to:\n```\n~/.local/share/stabber/logs/stabber.log\n```\n\n# Examples\nExample tests for Profanity can be found at: https://github.com/boothj5/profanity/tree/master/tests/functionaltests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprofanity-im%2Fstabber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprofanity-im%2Fstabber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprofanity-im%2Fstabber/lists"}