{"action":"created","comment":{"url":"https://api.github.com/repos/teamagam/GGSmtp/pulls/comments/65151377","id":65151377,"diff_hunk":"@@ -0,0 +1,153 @@\n+﻿using GGSmtp.Properties;\n+using MimeKit;\n+using Newtonsoft.Json;\n+using RestSharp;\n+using RestSharp.Serializers;\n+using Simple.MailServer.Logging;\n+using Simple.MailServer.Smtp;\n+using Simple.MailServer.Smtp.Config;\n+using System;\n+using System.Collections.Generic;\n+using System.IO;\n+using System.Linq;\n+using System.Net;\n+using System.Text;\n+using System.Threading.Tasks;\n+\n+namespace GGSmtp\n+{\n+    public class DefaultDataResponder : SmtpDataResponder\n+    {\n+        private IDictionary<ISmtpSessionInfo, Stream> mSessionsData;\n+        private IMailServerLogger mLogger;\n+        private Settings mSettings;\n+\n+        public DefaultDataResponder(ISmtpServerConfiguration config) :\n+            base(config)\n+        {\n+            mSessionsData = new Dictionary<ISmtpSessionInfo, Stream>();\n+            mLogger = MailServerLogger.Instance;\n+            mSettings = Settings.Default;\n+        }\n+\n+        public override SmtpResponse DataStart(ISmtpSessionInfo sessionInfo)\n+        {\n+            mLogger.Info(string.Format(\"Start receiving mail from: {0}\", sessionInfo.MailFrom));\n+\n+            mSessionsData[sessionInfo] = new MemoryStream();\n+\n+            return SmtpResponses.DataStart;\n+        }\n+\n+        /// <summary>\n+        /// Writes \"a line\" of data to a stream from the SMTP message\n+        /// </summary>\n+        /// <param name=\"sessionInfo\"></param>\n+        /// <param name=\"lineBuf\"></param>\n+        /// <returns></returns>\n+        public override SmtpResponse DataLine(ISmtpSessionInfo sessionInfo, byte[] lineBuf)\n+        {\n+            Stream currentStream = mSessionsData[sessionInfo];\n+\n+            currentStream.Seek(0, SeekOrigin.End);\n+            currentStream.Write(lineBuf, 0, lineBuf.Length);\n+\n+            currentStream.WriteByte(13);\n+            currentStream.WriteByte(10);\n+\n+            return SmtpResponses.None;\n+        }\n+\n+        public override SmtpResponse DataEnd(ISmtpSessionInfo sessionInfo)\n+        {\n+            Stream currentStream = mSessionsData[sessionInfo];\n+            long streamLength = currentStream.Length;\n+            string successMessage = string.Format(\"{0} bytes received\", streamLength);\n+\n+            // Write a success response to return, but don't return it yet\n+            SmtpResponse response = SmtpResponses.OK.CloneAndChange(successMessage);\n+\n+            try\n+            {\n+                currentStream.Seek(0, SeekOrigin.Begin);\n+\n+                // Read the mail message from the stream\n+                MimeMessage message = MimeMessage.Load(currentStream);\n+\n+                foreach (MimePart attatchment in message.Attachments)","path":"GGSmtp/GGSmtp/DefaultDataResponder.cs","position":77,"original_position":77,"commit_id":"b3575f61ee32e5fb1d2d3819a581238a071a977b","original_commit_id":"7a67f447257242b518470e7a3c3fbcdcfef2917a","user":{"login":"BarAgam","id":18549294,"avatar_url":"https://avatars.githubusercontent.com/u/18549294?v=3","gravatar_id":"","url":"https://api.github.com/users/BarAgam","html_url":"https://github.com/BarAgam","followers_url":"https://api.github.com/users/BarAgam/followers","following_url":"https://api.github.com/users/BarAgam/following{/other_user}","gists_url":"https://api.github.com/users/BarAgam/gists{/gist_id}","starred_url":"https://api.github.com/users/BarAgam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BarAgam/subscriptions","organizations_url":"https://api.github.com/users/BarAgam/orgs","repos_url":"https://api.github.com/users/BarAgam/repos","events_url":"https://api.github.com/users/BarAgam/events{/privacy}","received_events_url":"https://api.github.com/users/BarAgam/received_events","type":"User","site_admin":false},"body":"Should we expect more than one attachment?","created_at":"2016-05-31T09:43:03Z","updated_at":"2016-05-31T09:43:03Z","html_url":"https://github.com/teamagam/GGSmtp/pull/1#discussion_r65151377","pull_request_url":"https://api.github.com/repos/teamagam/GGSmtp/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/teamagam/GGSmtp/pulls/comments/65151377"},"html":{"href":"https://github.com/teamagam/GGSmtp/pull/1#discussion_r65151377"},"pull_request":{"href":"https://api.github.com/repos/teamagam/GGSmtp/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/teamagam/GGSmtp/pulls/1","id":71826338,"html_url":"https://github.com/teamagam/GGSmtp/pull/1","diff_url":"https://github.com/teamagam/GGSmtp/pull/1.diff","patch_url":"https://github.com/teamagam/GGSmtp/pull/1.patch","issue_url":"https://api.github.com/repos/teamagam/GGSmtp/issues/1","number":1,"state":"open","locked":false,"title":"Finished GGSmtp","user":{"login":"teamagam3","id":18391871,"avatar_url":"https://avatars.githubusercontent.com/u/18391871?v=3","gravatar_id":"","url":"https://api.github.com/users/teamagam3","html_url":"https://github.com/teamagam3","followers_url":"https://api.github.com/users/teamagam3/followers","following_url":"https://api.github.com/users/teamagam3/following{/other_user}","gists_url":"https://api.github.com/users/teamagam3/gists{/gist_id}","starred_url":"https://api.github.com/users/teamagam3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamagam3/subscriptions","organizations_url":"https://api.github.com/users/teamagam3/orgs","repos_url":"https://api.github.com/users/teamagam3/repos","events_url":"https://api.github.com/users/teamagam3/events{/privacy}","received_events_url":"https://api.github.com/users/teamagam3/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-29T12:42:16Z","updated_at":"2016-05-31T09:43:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"31b34b4f038e160d6ea9a1e35a2fdb46394729f7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/teamagam/GGSmtp/pulls/1/commits","review_comments_url":"https://api.github.com/repos/teamagam/GGSmtp/pulls/1/comments","review_comment_url":"https://api.github.com/repos/teamagam/GGSmtp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/teamagam/GGSmtp/issues/1/comments","statuses_url":"https://api.github.com/repos/teamagam/GGSmtp/statuses/b3575f61ee32e5fb1d2d3819a581238a071a977b","head":{"label":"teamagam:develop","ref":"develop","sha":"b3575f61ee32e5fb1d2d3819a581238a071a977b","user":{"login":"teamagam","id":16633359,"avatar_url":"https://avatars.githubusercontent.com/u/16633359?v=3","gravatar_id":"","url":"https://api.github.com/users/teamagam","html_url":"https://github.com/teamagam","followers_url":"https://api.github.com/users/teamagam/followers","following_url":"https://api.github.com/users/teamagam/following{/other_user}","gists_url":"https://api.github.com/users/teamagam/gists{/gist_id}","starred_url":"https://api.github.com/users/teamagam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamagam/subscriptions","organizations_url":"https://api.github.com/users/teamagam/orgs","repos_url":"https://api.github.com/users/teamagam/repos","events_url":"https://api.github.com/users/teamagam/events{/privacy}","received_events_url":"https://api.github.com/users/teamagam/received_events","type":"Organization","site_admin":false},"repo":{"id":59655385,"name":"GGSmtp","full_name":"teamagam/GGSmtp","owner":{"login":"teamagam","id":16633359,"avatar_url":"https://avatars.githubusercontent.com/u/16633359?v=3","gravatar_id":"","url":"https://api.github.com/users/teamagam","html_url":"https://github.com/teamagam","followers_url":"https://api.github.com/users/teamagam/followers","following_url":"https://api.github.com/users/teamagam/following{/other_user}","gists_url":"https://api.github.com/users/teamagam/gists{/gist_id}","starred_url":"https://api.github.com/users/teamagam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamagam/subscriptions","organizations_url":"https://api.github.com/users/teamagam/orgs","repos_url":"https://api.github.com/users/teamagam/repos","events_url":"https://api.github.com/users/teamagam/events{/privacy}","received_events_url":"https://api.github.com/users/teamagam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/teamagam/GGSmtp","description":"SMTP server for out sensor","fork":false,"url":"https://api.github.com/repos/teamagam/GGSmtp","forks_url":"https://api.github.com/repos/teamagam/GGSmtp/forks","keys_url":"https://api.github.com/repos/teamagam/GGSmtp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/teamagam/GGSmtp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/teamagam/GGSmtp/teams","hooks_url":"https://api.github.com/repos/teamagam/GGSmtp/hooks","issue_events_url":"https://api.github.com/repos/teamagam/GGSmtp/issues/events{/number}","events_url":"https://api.github.com/repos/teamagam/GGSmtp/events","assignees_url":"https://api.github.com/repos/teamagam/GGSmtp/assignees{/user}","branches_url":"https://api.github.com/repos/teamagam/GGSmtp/branches{/branch}","tags_url":"https://api.github.com/repos/teamagam/GGSmtp/tags","blobs_url":"https://api.github.com/repos/teamagam/GGSmtp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/teamagam/GGSmtp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/teamagam/GGSmtp/git/refs{/sha}","trees_url":"https://api.github.com/repos/teamagam/GGSmtp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/teamagam/GGSmtp/statuses/{sha}","languages_url":"https://api.github.com/repos/teamagam/GGSmtp/languages","stargazers_url":"https://api.github.com/repos/teamagam/GGSmtp/stargazers","contributors_url":"https://api.github.com/repos/teamagam/GGSmtp/contributors","subscribers_url":"https://api.github.com/repos/teamagam/GGSmtp/subscribers","subscription_url":"https://api.github.com/repos/teamagam/GGSmtp/subscription","commits_url":"https://api.github.com/repos/teamagam/GGSmtp/commits{/sha}","git_commits_url":"https://api.github.com/repos/teamagam/GGSmtp/git/commits{/sha}","comments_url":"https://api.github.com/repos/teamagam/GGSmtp/comments{/number}","issue_comment_url":"https://api.github.com/repos/teamagam/GGSmtp/issues/comments{/number}","contents_url":"https://api.github.com/repos/teamagam/GGSmtp/contents/{+path}","compare_url":"https://api.github.com/repos/teamagam/GGSmtp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/teamagam/GGSmtp/merges","archive_url":"https://api.github.com/repos/teamagam/GGSmtp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/teamagam/GGSmtp/downloads","issues_url":"https://api.github.com/repos/teamagam/GGSmtp/issues{/number}","pulls_url":"https://api.github.com/repos/teamagam/GGSmtp/pulls{/number}","milestones_url":"https://api.github.com/repos/teamagam/GGSmtp/milestones{/number}","notifications_url":"https://api.github.com/repos/teamagam/GGSmtp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/teamagam/GGSmtp/labels{/name}","releases_url":"https://api.github.com/repos/teamagam/GGSmtp/releases{/id}","deployments_url":"https://api.github.com/repos/teamagam/GGSmtp/deployments","created_at":"2016-05-25T10:49:41Z","updated_at":"2016-05-25T10:49:41Z","pushed_at":"2016-05-31T09:27:23Z","git_url":"git://github.com/teamagam/GGSmtp.git","ssh_url":"git@github.com:teamagam/GGSmtp.git","clone_url":"https://github.com/teamagam/GGSmtp.git","svn_url":"https://github.com/teamagam/GGSmtp","homepage":null,"size":106,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"teamagam:master","ref":"master","sha":"38ce7130b5e51c712497761a01393ea944f8bbf9","user":{"login":"teamagam","id":16633359,"avatar_url":"https://avatars.githubusercontent.com/u/16633359?v=3","gravatar_id":"","url":"https://api.github.com/users/teamagam","html_url":"https://github.com/teamagam","followers_url":"https://api.github.com/users/teamagam/followers","following_url":"https://api.github.com/users/teamagam/following{/other_user}","gists_url":"https://api.github.com/users/teamagam/gists{/gist_id}","starred_url":"https://api.github.com/users/teamagam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamagam/subscriptions","organizations_url":"https://api.github.com/users/teamagam/orgs","repos_url":"https://api.github.com/users/teamagam/repos","events_url":"https://api.github.com/users/teamagam/events{/privacy}","received_events_url":"https://api.github.com/users/teamagam/received_events","type":"Organization","site_admin":false},"repo":{"id":59655385,"name":"GGSmtp","full_name":"teamagam/GGSmtp","owner":{"login":"teamagam","id":16633359,"avatar_url":"https://avatars.githubusercontent.com/u/16633359?v=3","gravatar_id":"","url":"https://api.github.com/users/teamagam","html_url":"https://github.com/teamagam","followers_url":"https://api.github.com/users/teamagam/followers","following_url":"https://api.github.com/users/teamagam/following{/other_user}","gists_url":"https://api.github.com/users/teamagam/gists{/gist_id}","starred_url":"https://api.github.com/users/teamagam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamagam/subscriptions","organizations_url":"https://api.github.com/users/teamagam/orgs","repos_url":"https://api.github.com/users/teamagam/repos","events_url":"https://api.github.com/users/teamagam/events{/privacy}","received_events_url":"https://api.github.com/users/teamagam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/teamagam/GGSmtp","description":"SMTP server for out sensor","fork":false,"url":"https://api.github.com/repos/teamagam/GGSmtp","forks_url":"https://api.github.com/repos/teamagam/GGSmtp/forks","keys_url":"https://api.github.com/repos/teamagam/GGSmtp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/teamagam/GGSmtp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/teamagam/GGSmtp/teams","hooks_url":"https://api.github.com/repos/teamagam/GGSmtp/hooks","issue_events_url":"https://api.github.com/repos/teamagam/GGSmtp/issues/events{/number}","events_url":"https://api.github.com/repos/teamagam/GGSmtp/events","assignees_url":"https://api.github.com/repos/teamagam/GGSmtp/assignees{/user}","branches_url":"https://api.github.com/repos/teamagam/GGSmtp/branches{/branch}","tags_url":"https://api.github.com/repos/teamagam/GGSmtp/tags","blobs_url":"https://api.github.com/repos/teamagam/GGSmtp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/teamagam/GGSmtp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/teamagam/GGSmtp/git/refs{/sha}","trees_url":"https://api.github.com/repos/teamagam/GGSmtp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/teamagam/GGSmtp/statuses/{sha}","languages_url":"https://api.github.com/repos/teamagam/GGSmtp/languages","stargazers_url":"https://api.github.com/repos/teamagam/GGSmtp/stargazers","contributors_url":"https://api.github.com/repos/teamagam/GGSmtp/contributors","subscribers_url":"https://api.github.com/repos/teamagam/GGSmtp/subscribers","subscription_url":"https://api.github.com/repos/teamagam/GGSmtp/subscription","commits_url":"https://api.github.com/repos/teamagam/GGSmtp/commits{/sha}","git_commits_url":"https://api.github.com/repos/teamagam/GGSmtp/git/commits{/sha}","comments_url":"https://api.github.com/repos/teamagam/GGSmtp/comments{/number}","issue_comment_url":"https://api.github.com/repos/teamagam/GGSmtp/issues/comments{/number}","contents_url":"https://api.github.com/repos/teamagam/GGSmtp/contents/{+path}","compare_url":"https://api.github.com/repos/teamagam/GGSmtp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/teamagam/GGSmtp/merges","archive_url":"https://api.github.com/repos/teamagam/GGSmtp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/teamagam/GGSmtp/downloads","issues_url":"https://api.github.com/repos/teamagam/GGSmtp/issues{/number}","pulls_url":"https://api.github.com/repos/teamagam/GGSmtp/pulls{/number}","milestones_url":"https://api.github.com/repos/teamagam/GGSmtp/milestones{/number}","notifications_url":"https://api.github.com/repos/teamagam/GGSmtp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/teamagam/GGSmtp/labels{/name}","releases_url":"https://api.github.com/repos/teamagam/GGSmtp/releases{/id}","deployments_url":"https://api.github.com/repos/teamagam/GGSmtp/deployments","created_at":"2016-05-25T10:49:41Z","updated_at":"2016-05-25T10:49:41Z","pushed_at":"2016-05-31T09:27:23Z","git_url":"git://github.com/teamagam/GGSmtp.git","ssh_url":"git@github.com:teamagam/GGSmtp.git","clone_url":"https://github.com/teamagam/GGSmtp.git","svn_url":"https://github.com/teamagam/GGSmtp","homepage":null,"size":106,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/teamagam/GGSmtp/pulls/1"},"html":{"href":"https://github.com/teamagam/GGSmtp/pull/1"},"issue":{"href":"https://api.github.com/repos/teamagam/GGSmtp/issues/1"},"comments":{"href":"https://api.github.com/repos/teamagam/GGSmtp/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/teamagam/GGSmtp/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/teamagam/GGSmtp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/teamagam/GGSmtp/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/teamagam/GGSmtp/statuses/b3575f61ee32e5fb1d2d3819a581238a071a977b"}}}}
{"actor":{"display_login":"BarAgam"}}