{"action":"created","comment":{"url":"https://api.github.com/repos/ricochet-im/ricochet/pulls/comments/26814571","id":26814571,"diff_hunk":"@@ -233,6 +378,51 @@ void IncomingContactRequest::setNickname(const QString &nickname)\n     emit nicknameChanged();\n }\n \n+#ifdef PROTOCOL_NEW\n+void IncomingContactRequest::setChannel(Protocol::ContactRequestChannel *channel)\n+{\n+    if (connection) {\n+        qDebug() << \"Replacing connection on an IncomingContactRequest. Old connection is\" << connection->age() << \"seconds old.\";\n+        connection->close();\n+    }\n+\n+    // When the channel is closed, also close the connection\n+    connect(channel, &Protocol::Channel::invalidated, this,\n+        [this,channel]() {\n+            if (connection == channel->connection() &&\n+                connection->purpose() == Protocol::Connection::Purpose::InboundRequest)\n+            {\n+                qDebug() << \"Closing connection attached to an IncomingContactRequest because ContactRequestChannel was closed\";\n+                connection->close();\n+            }\n+        }\n+    );\n+\n+    qDebug() << \"Assigning connection to IncomingContactRequest from\" << m_hostname;\n+    connection = channel->connection();\n+    connection->setParent(this);\n+    if (!connection->setPurpose(Protocol::Connection::Purpose::InboundRequest)) {\n+        qDebug() << \"Setting purpose on incoming contact request connection failed; killing connection\";\n+        connection->close();\n+        connection = 0;\n+        return;","path":"src/core/IncomingRequestManager.cpp","position":271,"original_position":271,"commit_id":"a068a50ea0d0dbdf68ed973991966842e1430307","original_commit_id":"a068a50ea0d0dbdf68ed973991966842e1430307","user":{"login":"rburchell","id":125863,"avatar_url":"https://avatars.githubusercontent.com/u/125863?v=3","gravatar_id":"","url":"https://api.github.com/users/rburchell","html_url":"https://github.com/rburchell","followers_url":"https://api.github.com/users/rburchell/followers","following_url":"https://api.github.com/users/rburchell/following{/other_user}","gists_url":"https://api.github.com/users/rburchell/gists{/gist_id}","starred_url":"https://api.github.com/users/rburchell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rburchell/subscriptions","organizations_url":"https://api.github.com/users/rburchell/orgs","repos_url":"https://api.github.com/users/rburchell/repos","events_url":"https://api.github.com/users/rburchell/events{/privacy}","received_events_url":"https://api.github.com/users/rburchell/received_events","type":"User","site_admin":false},"body":"What is responsible for deleting connection, given it's parented to us already?","created_at":"2015-03-20T02:14:40Z","updated_at":"2015-03-20T02:14:40Z","html_url":"https://github.com/ricochet-im/ricochet/pull/144#discussion_r26814571","pull_request_url":"https://api.github.com/repos/ricochet-im/ricochet/pulls/144","_links":{"self":{"href":"https://api.github.com/repos/ricochet-im/ricochet/pulls/comments/26814571"},"html":{"href":"https://github.com/ricochet-im/ricochet/pull/144#discussion_r26814571"},"pull_request":{"href":"https://api.github.com/repos/ricochet-im/ricochet/pulls/144"}}},"pull_request":{"url":"https://api.github.com/repos/ricochet-im/ricochet/pulls/144","id":31491571,"html_url":"https://github.com/ricochet-im/ricochet/pull/144","diff_url":"https://github.com/ricochet-im/ricochet/pull/144.diff","patch_url":"https://github.com/ricochet-im/ricochet/pull/144.patch","issue_url":"https://api.github.com/repos/ricochet-im/ricochet/issues/144","number":144,"state":"open","locked":false,"title":"Contact requests in new protocol","user":{"login":"special","id":80188,"avatar_url":"https://avatars.githubusercontent.com/u/80188?v=3","gravatar_id":"","url":"https://api.github.com/users/special","html_url":"https://github.com/special","followers_url":"https://api.github.com/users/special/followers","following_url":"https://api.github.com/users/special/following{/other_user}","gists_url":"https://api.github.com/users/special/gists{/gist_id}","starred_url":"https://api.github.com/users/special/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/special/subscriptions","organizations_url":"https://api.github.com/users/special/orgs","repos_url":"https://api.github.com/users/special/repos","events_url":"https://api.github.com/users/special/events{/privacy}","received_events_url":"https://api.github.com/users/special/received_events","type":"User","site_admin":false},"body":"This one is a bit bigger, and complicated in parts.","created_at":"2015-03-19T02:53:46Z","updated_at":"2015-03-20T02:14:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"31c3dd38d4fd078d661f626db6a6d1605d0568ed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ricochet-im/ricochet/pulls/144/commits","review_comments_url":"https://api.github.com/repos/ricochet-im/ricochet/pulls/144/comments","review_comment_url":"https://api.github.com/repos/ricochet-im/ricochet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ricochet-im/ricochet/issues/144/comments","statuses_url":"https://api.github.com/repos/ricochet-im/ricochet/statuses/a068a50ea0d0dbdf68ed973991966842e1430307","head":{"label":"special:protocol-requests","ref":"protocol-requests","sha":"a068a50ea0d0dbdf68ed973991966842e1430307","user":{"login":"special","id":80188,"avatar_url":"https://avatars.githubusercontent.com/u/80188?v=3","gravatar_id":"","url":"https://api.github.com/users/special","html_url":"https://github.com/special","followers_url":"https://api.github.com/users/special/followers","following_url":"https://api.github.com/users/special/following{/other_user}","gists_url":"https://api.github.com/users/special/gists{/gist_id}","starred_url":"https://api.github.com/users/special/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/special/subscriptions","organizations_url":"https://api.github.com/users/special/orgs","repos_url":"https://api.github.com/users/special/repos","events_url":"https://api.github.com/users/special/events{/privacy}","received_events_url":"https://api.github.com/users/special/received_events","type":"User","site_admin":false},"repo":{"id":21765064,"name":"ricochet","full_name":"special/ricochet","owner":{"login":"special","id":80188,"avatar_url":"https://avatars.githubusercontent.com/u/80188?v=3","gravatar_id":"","url":"https://api.github.com/users/special","html_url":"https://github.com/special","followers_url":"https://api.github.com/users/special/followers","following_url":"https://api.github.com/users/special/following{/other_user}","gists_url":"https://api.github.com/users/special/gists{/gist_id}","starred_url":"https://api.github.com/users/special/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/special/subscriptions","organizations_url":"https://api.github.com/users/special/orgs","repos_url":"https://api.github.com/users/special/repos","events_url":"https://api.github.com/users/special/events{/privacy}","received_events_url":"https://api.github.com/users/special/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/special/ricochet","description":"Anonymous peer-to-peer instant messaging","fork":true,"url":"https://api.github.com/repos/special/ricochet","forks_url":"https://api.github.com/repos/special/ricochet/forks","keys_url":"https://api.github.com/repos/special/ricochet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/special/ricochet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/special/ricochet/teams","hooks_url":"https://api.github.com/repos/special/ricochet/hooks","issue_events_url":"https://api.github.com/repos/special/ricochet/issues/events{/number}","events_url":"https://api.github.com/repos/special/ricochet/events","assignees_url":"https://api.github.com/repos/special/ricochet/assignees{/user}","branches_url":"https://api.github.com/repos/special/ricochet/branches{/branch}","tags_url":"https://api.github.com/repos/special/ricochet/tags","blobs_url":"https://api.github.com/repos/special/ricochet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/special/ricochet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/special/ricochet/git/refs{/sha}","trees_url":"https://api.github.com/repos/special/ricochet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/special/ricochet/statuses/{sha}","languages_url":"https://api.github.com/repos/special/ricochet/languages","stargazers_url":"https://api.github.com/repos/special/ricochet/stargazers","contributors_url":"https://api.github.com/repos/special/ricochet/contributors","subscribers_url":"https://api.github.com/repos/special/ricochet/subscribers","subscription_url":"https://api.github.com/repos/special/ricochet/subscription","commits_url":"https://api.github.com/repos/special/ricochet/commits{/sha}","git_commits_url":"https://api.github.com/repos/special/ricochet/git/commits{/sha}","comments_url":"https://api.github.com/repos/special/ricochet/comments{/number}","issue_comment_url":"https://api.github.com/repos/special/ricochet/issues/comments{/number}","contents_url":"https://api.github.com/repos/special/ricochet/contents/{+path}","compare_url":"https://api.github.com/repos/special/ricochet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/special/ricochet/merges","archive_url":"https://api.github.com/repos/special/ricochet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/special/ricochet/downloads","issues_url":"https://api.github.com/repos/special/ricochet/issues{/number}","pulls_url":"https://api.github.com/repos/special/ricochet/pulls{/number}","milestones_url":"https://api.github.com/repos/special/ricochet/milestones{/number}","notifications_url":"https://api.github.com/repos/special/ricochet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/special/ricochet/labels{/name}","releases_url":"https://api.github.com/repos/special/ricochet/releases{/id}","created_at":"2014-07-12T10:50:37Z","updated_at":"2015-03-18T21:53:53Z","pushed_at":"2015-03-18T23:27:12Z","git_url":"git://github.com/special/ricochet.git","ssh_url":"git@github.com:special/ricochet.git","clone_url":"https://github.com/special/ricochet.git","svn_url":"https://github.com/special/ricochet","homepage":"https://ricochet.im/","size":2776,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"ricochet-im:master","ref":"master","sha":"8f7dbfd396fe20c32695f47dd8e2362afc3dbbd3","user":{"login":"ricochet-im","id":7889762,"avatar_url":"https://avatars.githubusercontent.com/u/7889762?v=3","gravatar_id":"","url":"https://api.github.com/users/ricochet-im","html_url":"https://github.com/ricochet-im","followers_url":"https://api.github.com/users/ricochet-im/followers","following_url":"https://api.github.com/users/ricochet-im/following{/other_user}","gists_url":"https://api.github.com/users/ricochet-im/gists{/gist_id}","starred_url":"https://api.github.com/users/ricochet-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricochet-im/subscriptions","organizations_url":"https://api.github.com/users/ricochet-im/orgs","repos_url":"https://api.github.com/users/ricochet-im/repos","events_url":"https://api.github.com/users/ricochet-im/events{/privacy}","received_events_url":"https://api.github.com/users/ricochet-im/received_events","type":"Organization","site_admin":false},"repo":{"id":762837,"name":"ricochet","full_name":"ricochet-im/ricochet","owner":{"login":"ricochet-im","id":7889762,"avatar_url":"https://avatars.githubusercontent.com/u/7889762?v=3","gravatar_id":"","url":"https://api.github.com/users/ricochet-im","html_url":"https://github.com/ricochet-im","followers_url":"https://api.github.com/users/ricochet-im/followers","following_url":"https://api.github.com/users/ricochet-im/following{/other_user}","gists_url":"https://api.github.com/users/ricochet-im/gists{/gist_id}","starred_url":"https://api.github.com/users/ricochet-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricochet-im/subscriptions","organizations_url":"https://api.github.com/users/ricochet-im/orgs","repos_url":"https://api.github.com/users/ricochet-im/repos","events_url":"https://api.github.com/users/ricochet-im/events{/privacy}","received_events_url":"https://api.github.com/users/ricochet-im/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ricochet-im/ricochet","description":"Anonymous peer-to-peer instant messaging","fork":false,"url":"https://api.github.com/repos/ricochet-im/ricochet","forks_url":"https://api.github.com/repos/ricochet-im/ricochet/forks","keys_url":"https://api.github.com/repos/ricochet-im/ricochet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ricochet-im/ricochet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ricochet-im/ricochet/teams","hooks_url":"https://api.github.com/repos/ricochet-im/ricochet/hooks","issue_events_url":"https://api.github.com/repos/ricochet-im/ricochet/issues/events{/number}","events_url":"https://api.github.com/repos/ricochet-im/ricochet/events","assignees_url":"https://api.github.com/repos/ricochet-im/ricochet/assignees{/user}","branches_url":"https://api.github.com/repos/ricochet-im/ricochet/branches{/branch}","tags_url":"https://api.github.com/repos/ricochet-im/ricochet/tags","blobs_url":"https://api.github.com/repos/ricochet-im/ricochet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ricochet-im/ricochet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ricochet-im/ricochet/git/refs{/sha}","trees_url":"https://api.github.com/repos/ricochet-im/ricochet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ricochet-im/ricochet/statuses/{sha}","languages_url":"https://api.github.com/repos/ricochet-im/ricochet/languages","stargazers_url":"https://api.github.com/repos/ricochet-im/ricochet/stargazers","contributors_url":"https://api.github.com/repos/ricochet-im/ricochet/contributors","subscribers_url":"https://api.github.com/repos/ricochet-im/ricochet/subscribers","subscription_url":"https://api.github.com/repos/ricochet-im/ricochet/subscription","commits_url":"https://api.github.com/repos/ricochet-im/ricochet/commits{/sha}","git_commits_url":"https://api.github.com/repos/ricochet-im/ricochet/git/commits{/sha}","comments_url":"https://api.github.com/repos/ricochet-im/ricochet/comments{/number}","issue_comment_url":"https://api.github.com/repos/ricochet-im/ricochet/issues/comments{/number}","contents_url":"https://api.github.com/repos/ricochet-im/ricochet/contents/{+path}","compare_url":"https://api.github.com/repos/ricochet-im/ricochet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ricochet-im/ricochet/merges","archive_url":"https://api.github.com/repos/ricochet-im/ricochet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ricochet-im/ricochet/downloads","issues_url":"https://api.github.com/repos/ricochet-im/ricochet/issues{/number}","pulls_url":"https://api.github.com/repos/ricochet-im/ricochet/pulls{/number}","milestones_url":"https://api.github.com/repos/ricochet-im/ricochet/milestones{/number}","notifications_url":"https://api.github.com/repos/ricochet-im/ricochet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ricochet-im/ricochet/labels{/name}","releases_url":"https://api.github.com/repos/ricochet-im/ricochet/releases{/id}","created_at":"2010-07-07T23:01:23Z","updated_at":"2015-03-18T23:07:04Z","pushed_at":"2015-03-18T23:07:04Z","git_url":"git://github.com/ricochet-im/ricochet.git","ssh_url":"git@github.com:ricochet-im/ricochet.git","clone_url":"https://github.com/ricochet-im/ricochet.git","svn_url":"https://github.com/ricochet-im/ricochet","homepage":"https://ricochet.im/","size":4964,"stargazers_count":722,"watchers_count":722,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":92,"mirror_url":null,"open_issues_count":57,"forks":92,"open_issues":57,"watchers":722,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ricochet-im/ricochet/pulls/144"},"html":{"href":"https://github.com/ricochet-im/ricochet/pull/144"},"issue":{"href":"https://api.github.com/repos/ricochet-im/ricochet/issues/144"},"comments":{"href":"https://api.github.com/repos/ricochet-im/ricochet/issues/144/comments"},"review_comments":{"href":"https://api.github.com/repos/ricochet-im/ricochet/pulls/144/comments"},"review_comment":{"href":"https://api.github.com/repos/ricochet-im/ricochet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ricochet-im/ricochet/pulls/144/commits"},"statuses":{"href":"https://api.github.com/repos/ricochet-im/ricochet/statuses/a068a50ea0d0dbdf68ed973991966842e1430307"}}}}