{"id":24992075,"url":"https://github.com/strophe/strophejs-plugin-message-carbons","last_synced_at":"2026-02-13T05:02:05.516Z","repository":{"id":75691463,"uuid":"80017725","full_name":"strophe/strophejs-plugin-message-carbons","owner":"strophe","description":null,"archived":false,"fork":false,"pushed_at":"2017-09-27T16:41:30.000Z","size":4,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-09-05T18:13:43.652Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strophe.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null}},"created_at":"2017-01-25T13:38:41.000Z","updated_at":"2020-09-18T07:45:51.000Z","dependencies_parsed_at":"2023-05-03T23:30:59.492Z","dependency_job_id":null,"html_url":"https://github.com/strophe/strophejs-plugin-message-carbons","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/strophe/strophejs-plugin-message-carbons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strophe%2Fstrophejs-plugin-message-carbons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strophe%2Fstrophejs-plugin-message-carbons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strophe%2Fstrophejs-plugin-message-carbons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strophe%2Fstrophejs-plugin-message-carbons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strophe","download_url":"https://codeload.github.com/strophe/strophejs-plugin-message-carbons/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strophe%2Fstrophejs-plugin-message-carbons/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29396847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T04:26:15.637Z","status":"ssl_error","status_checked_at":"2026-02-13T04:16:29.732Z","response_time":78,"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":[],"created_at":"2025-02-04T13:53:41.381Z","updated_at":"2026-02-13T05:02:05.502Z","avatar_url":"https://github.com/strophe.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# strophe.message-carbons.js\n\nstrophe.message-carbons.js is a plugin to provide simplified support for Message Carbons\n( [XEP-0280]( http://xmpp.org/extensions/xep-0280.html ) ).\n\n## Usage\n\n### Enabling message carbons\n\n`connection.messageCarbons.enable(onMessageCarbon)`\n\n`onMessageCarbon` is a function that gets called back when new message carbons are recieved.  More information about this handler is found in the section below.\n\nSometime after connecting to a server, call this function to send the proper IQ packet to the server to enable message carbons for this connection.  Additionally, pass in a callback that gets called when a carbon is recieved.\n\n### Disabling message carbons\n\n`connection.messageCarbons.disable()`\n\nThis call will send the proper IQ packet to the server to disable message carbons for this connection.  The only real use of this function is to save bandwidth for the remainder of the connection, as it's better to just not call `enable` in the first place if carbons are not desired.\n\n### Handling carbons\n\nThe function passed into the `enable` function is called whenever a Message Carbon is recieved.  It has the following prototype:\n\n`onMessageCarbon(carbon)`\n\n`carbon` is defined as follows:\n\n\t{\n\t\t// Direction of the carbon message\n\t\tdirection: 'sent' | 'received',\n\t\t\n\t\t// Type of message in the sub-message, usually 'chat'\n\t\t// Same as $(innerMessage).attr(\"type\")\n\t\ttype: '',\n\t\t\n\t\t// Receipient of the message.  \n\t\t// Same as $(innerMessage).attr(\"to\")\n\t\tto: '', \n\t\t\n\t\t// Sender of the message.  \n\t\t// Same as $(innerMessage).attr(\"from\")\n\t\tfrom: '', \n\t\t\n\t\t// The inner message object\n\t\tinnerMessage: {}\n\t}\n\n### Example\n\n\tfunction onConnected() {\n\t\t// ...\n\t\tconnection.messageCarbons.enable(onMessageCarbon);\n\t}\n\t\n\tfunction onMessageCarbon(carbon) {\n\t\t// Status messages are also sent as carbons.  Instead of filtering them \n\t\t// at a module level, we let you decide if you want to handle them.\n\t\tvar body = $(carbon.innerMessage).children(\"body\").text() || \"\";\n\t\tif (!body)\n\t\t\treturn;\n\n\t\tif (carbon.direction === 'sent') {\n\t\t\tvar contact = findContactInRoster(Strophe.getBareJidFromJid(carbon.to));\n\t\t\tif (contact \u0026\u0026 carbon.type == \"chat\") {\n\t\t\t\t// Handle a message sent FROM this user, but from another device\n\t\t\t\tvar conversationItem = { text: body, to: carbon.to, isMe: true, dt: new Date() };\n\t\t\t\tcontact.conversation.push(conversationItem);\n\t\t\t\t// Update view by sending a broadcast or event\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// On received messages, unless you have a special way to display them, \n\t\t\t// you can just call your original message handler\n\t\t\tonMessage(carbon.innerMessage);\n\t\t}\n\t}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrophe%2Fstrophejs-plugin-message-carbons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrophe%2Fstrophejs-plugin-message-carbons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrophe%2Fstrophejs-plugin-message-carbons/lists"}