public override void MailedSuccesfully(Mailbox box, IGameObject obj) { try { Metal metal = obj as Metal; Collecting collecting = Actor.SkillManager.AddElement(SkillNames.Collecting) as Collecting; if (metal != null) { // Custom if (!collecting.mMetalData.ContainsKey(metal.Guid)) { collecting.mMetalData.Add(metal.Guid, new Collecting.MetalStats(0)); } } base.MailedSuccesfully(box, obj); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); } }
public MailboxViewModel(Mailbox mailbox) { Mailbox = mailbox; MailboxViewModelSubTree = new ObservableCollection<MailboxViewModel>(); Mailbox.PropertyChanged += HandleModelPropertyChanged; }
public MailboxResponse Get(Mailbox request) { var mailboxPath = new DirectoryInfo(Path.Combine(this.Config.MailFolder, request.Name)); ValidateExists(request.Name, mailboxPath); string[] emails = Directory.GetFiles(mailboxPath.FullName, "*.eml"); var response = new MailboxResponse() { Name = request.Name, Links = new List<Link>(new[] { this.GetMailboxLink(request.Name) }) }; foreach (var entry in emails) { var mailMessage = GetMailMessage(entry); response.Emails.Add(new EmailResponse() { Body = mailMessage.Body, Subject = mailMessage.Subject, To = mailMessage.To.Select(m => m.Address).ToList(), From = mailMessage.From.Address, Date = mailMessage.DeliveryDate, Links = new List<Link>(new [] { this.GetEmailLink(request.Name, entry) }) }); } return response; }
public void AddAndTakeMessage() { Mailbox box = new Mailbox(); box.Add(1); Assert.AreEqual(1, box.Take()); }
private int yMailCntGet(Mailbox[] boxs) { int ans=0; foreach(Mailbox box in boxs) ans += box.ExistsCount; return ans; }
public ActorInfo(ActorId id, string name, Task task, CancellationTokenSource cts, SimpleActorRuntime runtime) { this.id = id; this.name = name; this.task = task; this.cts = cts; Mailbox = new Mailbox<object>(this, runtime); }
public static void Main() { long received_long = 0; var mailbox = new Mailbox<long>(Console.WriteLine); for (int i = 0, j = 15; i < j; i++) { mailbox.Send(i); } Console.ReadLine(); }
public MailboxResponse Delete(Mailbox request) { var mailboxPath = new DirectoryInfo(Path.Combine(this.Config.MailFolder, request.Name)); ValidateExists(request.Name, mailboxPath); Directory.Delete(mailboxPath.FullName, true); return new MailboxResponse() { Name = request.Name, Links = new List<Link>(new[] { this.GetMailboxLink(request.Name) }) }; }
public IdleTimeProcessor(IIdleTimeQueue idle_time_queue, ISendIdleTimeToServer sender) { idle_time_queue_ = idle_time_queue; mailbox_ = new Mailbox<RunnableDelegate>(OnSend, Executors.ThreadPoolExecutor()); logger_ = AionLogger.ForCurrentProcess; message_sender_ = sender; }
// END CUT HERE // BEGIN CUT HERE public static void Main() { try { Mailbox ___test = new Mailbox(); ___test.run_test(-1); } catch(Exception e) { //Console.WriteLine(e.StackTrace); Console.WriteLine(e.ToString()); } }
public IOThread(Ctx ctx, int tid) : base(ctx, tid) { m_name = "iothread-" + tid; m_poller = new Poller(m_name); m_mailbox = new Mailbox(m_name); m_mailboxHandle = m_mailbox.FD; m_poller.AddFD (m_mailboxHandle, this); m_poller.SetPollin (m_mailboxHandle); }
public void SholudReceiveWhatWasSent() { ManualResetEvent sync = new ManualResetEvent(false); Mailbox<long> mailbox = new Mailbox<long>(delegate(long number) { Assert.AreEqual(50, number); sync.Set(); }); mailbox.Send(50); bool timed_out = sync.WaitOne(3000); Assert.AreEqual(true, timed_out); }
public void accessShared() { ServicePointManager.ServerCertificateValidationCallback = m_UrlBack.CertificateValidationCallBack; ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); // Get the information of the account. service.Credentials = new WebCredentials(EMAIL_ACCOUNT, EMAIL_PWD); // Set the url of server. if (!AutodiscoverUrl(service, EMAIL_ACCOUNT)) { return; } var mb = new Mailbox(SHARED_MAILBOX); var fid1 = new FolderId(WellKnownFolderName.Inbox, mb); // Add a search filter that searches on the body or subject. List<SearchFilter> searchFilterCollection = new List<SearchFilter>(); searchFilterCollection.Add(new SearchFilter.ContainsSubstring(ItemSchema.Subject, SUBJECT_KEY_WORD)); SearchFilter searchFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.Or, searchFilterCollection.ToArray()); // Create a view with a page size of 10. var view = new ItemView(10); // Identify the Subject and DateTimeReceived properties to return. // Indicate that the base property will be the item identifier view.PropertySet = new PropertySet(BasePropertySet.IdOnly, ItemSchema.Subject, ItemSchema.DateTimeReceived); // Order the search results by the DateTimeReceived in descending order. view.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Ascending); // Set the traversal to shallow. (Shallow is the default option; other options are Associated and SoftDeleted.) view.Traversal = ItemTraversal.Shallow; String[] invalidStings = { "\\", ",", ":", "*", "?", "\"", "<", ">", "|" }; PropertySet itemPorpertySet = new PropertySet(BasePropertySet.FirstClassProperties, EmailMessageSchema.MimeContent); FindItemsResults<Item> findResults = service.FindItems(fid1, searchFilter, view); foreach (Item item in findResults.Items) { EmailMessage email = EmailMessage.Bind(service, item.Id, new PropertySet(BasePropertySet.IdOnly, ItemSchema.Attachments)); email.Load(itemPorpertySet); string emailBody = email.Body.ToString(); } }
public Reaper(Ctx ctx, int tid) : base(ctx, tid) { m_sockets = 0; m_terminating = false; m_name = "reaper-" + tid; m_poller = new Poller(m_name); mailbox = new Mailbox(m_name); m_mailboxHandle = mailbox.FD; m_poller.AddFD (m_mailboxHandle, this); m_poller.SetPollin (m_mailboxHandle); }
protected internal override void Parse(ImapResponseReader reader) { while (true) { if (reader.IsCompleted) { TakeSnapshot(reader); break; } if (!reader.IsUntagged) { continue; } var mailbox = new Mailbox(); var line = reader.CurrentLine; // pattern is identical to message flags var attMatches = Regex.Matches(line, RegexPatterns.SingleFlagPattern); foreach (Match match in attMatches) { NameAttributes flag; var value = match.Value.TrimAnySeperate(1, 0); var success = Enum.TryParse(value, true, out flag); if (success) { mailbox.Attributes |= flag; } else { ((IList<string>) mailbox.Keywords).Add(match.Value); } } string encodedName; var quotedItemsMatch = Regex.Matches(line, RegexPatterns.QuotedItemsPattern); if (quotedItemsMatch.Count == 1) { mailbox.Delimiter = quotedItemsMatch[0].Value.TrimQuotes()[0]; } if (quotedItemsMatch.Count == 2) { mailbox.Delimiter = quotedItemsMatch[0].Value.TrimQuotes()[0]; encodedName = quotedItemsMatch[1].Value.TrimQuotes(); } else { var split = line.Split(Characters.Space); var lastIndex = split.Length - 1; encodedName = split[lastIndex].TrimQuotes(); } // we need to decode ASCII names according to IMAP specs. // http://tools.ietf.org/html/rfc2060#section-5.1.3 mailbox.Name = MailboxNameEncoder.Decode(encodedName); _mailboxes.Add(mailbox); reader.ReadNextLine(); } }
public void AddAndTakeMessagesWithReject() { Mailbox box = new Mailbox(); box.Add(1); box.Add(2); box.Add(3); Assert.AreEqual(1, box.Take()); Assert.AreEqual(2, box.Take()); box.Reject(2); Assert.AreEqual(3, box.Take()); Assert.AreEqual(2, box.Take()); }
public ActorInfo( ActorId id, string name, Task task, CancellationTokenSource cts, TestingActorRuntime runtime) { this.id = id; this.task = task; this.name = name; this.cts = cts; Mailbox = new Mailbox<object>(this, runtime); terminateWaiters = new HashSet<ActorInfo>(); exceptions = new List<Exception>(); }
public void Send_Heart() { Mailbox mailbox = new Mailbox( receiver_: friendInfo.nickname, sender_: AWSManager.instance.userInfo.nickname, item_: "heart", quantitiy_: 1); UserFriend userFriend = friend.DeepCopy(); userFriend.friendship++; userFriend.send = true; userFriend.time_request = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); JsonAdapter.HeartRequest heartRequest = new JsonAdapter.HeartRequest(mailbox, userFriend); jsonAdapter.UpdateData(heartRequest, "sendmailbox", HeartRequestCallback); }
/// <summary> /// Downloads a message. /// </summary> /// <param name="mailbox">The mailbox.</param> /// <param name="statisticInfo">The statistic info.</param> /// <param name="response">The response.</param> /// <param name="message">The message.</param> /// <returns>The response type.</returns> protected override CommandResponseType DownloadMessageCommand(Mailbox mailbox, StatisticInfo statisticInfo, out string response, out StructuredMessage message) { try { message = _client.GetFullMessage(uint.Parse(statisticInfo.UniqueNumber), mailbox); response = string.Empty; return(CommandResponseType.Ok); } catch (Exception ex) { LoginCommand(out response); message = null; response = ex.ToString(); return(CommandResponseType.Bad); } }
/// <summary> /// TBD /// </summary> /// <param name="message">TBD</param> public void SendSystemMessage(ISystemMessage message) { lock (_lock) { var cell = _self.Underlying; if (CellIsReady(cell)) { cell.SendSystemMessage(message); } else { _sysMsgQueue = _sysMsgQueue + (SystemMessage)message; Mailbox.DebugPrint("{0} temp queueing system message {1}", Self, message); } } }
private void save_button_Click(object sender, RoutedEventArgs e) { var mailbox = new Mailbox(); mailbox.Email_address = textbox_email.Text; mailbox.pop3_address = textbox_host.Text; mailbox.email_password = textbox_password.Text; int a = 0; Int32.TryParse(textbox_port.Text, out a); mailbox.pop3_port = a; mailbox.use_ssl = checkbox_usessl.IsChecked ?? false; mailbox.mailbox_id = cur_select_mailbox_id; ClientSession.SaveMailBox(mailbox); MessageBox.Show("修改成功!"); }
public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); if (Mailbox != null) { info.AddValue("Mailbox", Mailbox.ToString()); } else { info.AddValue("Mailbox", string.Empty); } info.AddValue("ErrorCode", (int)ErrorCode); info.AddValue("StatusCode", (int)StatusCode); }
private void Imap4Result_Load(object sender, EventArgs e) { Mailbox inbox = Imap.ExamineMailbox("inbox"); int MessageCount = inbox.MessageCount; for (int i = 1; i <= MessageCount; i++) { Header head = inbox.Fetch.HeaderObject(i); ListViewItem litem = new ListViewItem(head.Date.ToShortDateString()); litem.Tag = i.ToString(); litem.SubItems.Add(head.Subject); litem.SubItems.Add(head.SenderIP.ToString()); litem.SubItems.Add(head.From.Name); lvwMails.Items.Add(litem); } }
private bool Deliver() { for (int idx = 0; idx < throttlingCount; ++idx) { var message = Mailbox.Receive(); if (message == null) { return(idx > 0); // we delivered at least one message } else { message.Deliver(); } } return(true); }
private int ReadPreviewThumbprint() { Mailbox mailbox = ((MailboxSession)this.session).Mailbox; object obj = mailbox.TryGetProperty(MailboxPhotoWriter.UserPhotoPreviewCacheIdProperty); if (obj is int) { this.tracer.TraceDebug((long)this.GetHashCode(), "Mailbox photo writer: read thumbprint of preview photo: {0:X8}", new object[] { obj }); return((int)obj); } this.tracer.TraceError((long)this.GetHashCode(), "Mailbox photo reader: thumbprint of preview photo doesn't exist."); throw new ObjectNotFoundException(Strings.UserPhotoThumbprintNotFound(true)); }
public void TestInequality() { var ifi1 = new Mailbox(new Uri("mailto:[email protected]")); var ifi2 = new MailboxSha1Sum(new SHAHash("*****@*****.**")); var ifi3 = new OpenID(new Uri("https://www.gowithfloat.com")); var ifi4 = new Account("test", new Uri("http://example.com")); var agent1a = new Agent(ifi1, "Jane Doe"); var agent2a = new Agent(ifi2, "Jane Doe"); var agent3a = new Agent(ifi3, "Jane Doe"); var agent4a = new Agent(ifi4, "Jane Doe"); AssertHelper.Inequality <Agent, IAgent, IIdentifiedActor>(agent1a, agent2a, (a, b) => a != b); AssertHelper.Inequality <Agent, IAgent, IIdentifiedActor>(agent2a, agent3a, (a, b) => a != b); AssertHelper.Inequality <Agent, IAgent, IIdentifiedActor>(agent3a, agent4a, (a, b) => a != b); AssertHelper.Inequality <Agent, IAgent, IIdentifiedActor>(agent4a, agent1a, (a, b) => a != b); }
/// <summary> /// Create the actor in response to a failure /// </summary> private void FaultCreate() { global::System.Diagnostics.Debug.Assert(Mailbox.IsSuspended(), "Mailbox must be suspended during failed creation, status=" + Mailbox.CurrentStatus()); global::System.Diagnostics.Debug.Assert(_self.Equals(Perpetrator), "Perpetrator should be self"); SetReceiveTimeout(null); CancelReceiveTimeout(); // stop all children, which will turn childrenRefs into TerminatingChildrenContainer (if there are children) StopChildren(); if (!SetChildrenTerminationReason(new SuspendReason.Creation())) { FinishCreate(); } }
/// <summary> /// Gets the sent message uid. /// </summary> /// <param name="mailbox">The mailbox.</param> /// <param name="messageId">The message id.</param> /// <param name="response">The response.</param> /// <param name="uid">The uid.</param> /// <returns>The response type.</returns> protected override CommandResponseType GetSentMessageUidCommand(Mailbox mailbox, string messageId, out string response, out string uid) { try { IEnumerable <uint> uids = _client.Search(Query.Header("Comments", messageId), mailbox); uid = uids.First().ToString(); response = string.Empty; return(CommandResponseType.Ok); } catch (Exception ex) { response = ex.ToString(); uid = string.Empty; return(CommandResponseType.Bad); } }
private void _bRetrieveMessageList_Click(object sender, EventArgs e) { // We create Imap client Imap4Client imap = new Imap4Client(); try { // We connect to the imap4 server imap.Connect(_tbImap4Server.Text); this.AddLogEntry(string.Format("Connection to {0} successfully", _tbImap4Server.Text)); // Login to mail box imap.Login(_tbUserName.Text, _tbPassword.Text); this.AddLogEntry(string.Format("Login to {0} successfully", _tbImap4Server.Text)); Mailbox inbox = imap.SelectMailbox("inbox"); MessageCollection mc = new MessageCollection(); for (int n = 1; n < inbox.MessageCount + 1; n++) { ActiveUp.Net.Mail.Message newMessage = inbox.Fetch.MessageObject(n); mc.Add(newMessage); this.AddLogEntry(string.Format("Message ({0}) : {1}", n.ToString(), newMessage.Subject)); } } catch (Imap4Exception iex) { this.AddLogEntry(string.Format("Imap4 Error: {0}", iex.Message)); } catch (Exception ex) { this.AddLogEntry(string.Format("Failed: {0}", ex.Message)); } finally { if (imap.IsConnected) { imap.Disconnect(); } } }
public void Init(bool sendSupervise, Func <Mailbox> createMailbox /*, MailboxType mailboxType*/) //TODO: switch from Func<Mailbox> createMailbox to MailboxType mailboxType { var mailbox = createMailbox(); //Akka: dispatcher.createMailbox(this, mailboxType) Dispatcher.Attach(this); mailbox.Setup(Dispatcher); mailbox.SetActor(this); _mailbox = mailbox; var createMessage = new Create(); // AKKA: // /* // * The mailboxType was calculated taking into account what the MailboxType // * has promised to produce. If that was more than the default, then we need // * to reverify here because the dispatcher may well have screwed it up. // */ //// we need to delay the failure to the point of actor creation so we can handle //// it properly in the normal way //val actorClass = props.actorClass //val createMessage = mailboxType match { // case _: ProducesMessageQueue[_] if system.mailboxes.hasRequiredType(actorClass) ⇒ // val req = system.mailboxes.getRequiredType(actorClass) // if (req isInstance mbox.messageQueue) Create(None) // else { // val gotType = if (mbox.messageQueue == null) "null" else mbox.messageQueue.getClass.getName // Create(Some(ActorInitializationException(self, // s"Actor [$self] requires mailbox type [$req] got [$gotType]"))) // } // case _ ⇒ Create(None) //} //swapMailbox(mbox) //mailbox.setActor(this) //// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅ //mailbox.systemEnqueue(self, createMessage) var self = Self; mailbox.Post(self, new Envelope { Message = createMessage, Sender = self }); if (sendSupervise) { Parent.Tell(new Supervise(self, async: false), self); } }
public static void OnWorldQuit(object sender, EventArgs e) { Ferry <PersistedData> .LoadCargo(); foreach (KeyValuePair <ulong, bool> keyvalues in GlobalOptionsSewingTable.retrieveData.whoIsInPatternClub) { print("Re-assigned the mailbox alarm!"); SimDescription description = SimDescription.Find(keyvalues.Key); Mailbox mailbox = Mailbox.GetMailboxOnLot(description.LotHome); mailbox.RemoveAlarm(1f, DaysOfTheWeek.Thursday, GlobalOptionsSewingTable.SendPatterns, "Mailbox: Pattern club " + description.mSimDescriptionId.ToString(), AlarmType.AlwaysPersisted); } //AlarmManager.Global.RemoveAlarm(mPatternClubAlarm); //mPatternClubAlarm = AlarmHandle.kInvalidHandle; //AlarmManager.Global.RemoveAlarm(mWearClothing); //mWearClothing = AlarmHandle.kInvalidHandle; }
private MessageCollection GetMails(string mailBox, string searchPhrase) { try { Mailbox mails = Client.SelectMailbox(mailBox); MessageCollection messages = mails.SearchParse(searchPhrase); return messages; } catch(Exception ecc) { EventLog Log = new EventLog("Application"); Log.Source = "ServizioWiki"; Log.WriteEntry("Errore durante la lettura delle mail, dettagli: " + ecc.Message, EventLogEntryType.Warning); return null; } }
/// <summary> /// When overridden in a derived class, sets the <see cref="System.Runtime.Serialization.SerializationInfo"/> /// with information about the exception. /// </summary> /// <remarks> /// Serializes the state of the <see cref="SmtpCommandException"/>. /// </remarks> /// <param name="info">The serialization info.</param> /// <param name="context">The streaming context.</param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="info"/> is <c>null</c>. /// </exception> public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } if (Mailbox != null) { info.AddValue("Mailbox", Mailbox.ToString()); } info.AddValue("ErrorCode", (int)ErrorCode); info.AddValue("StatusCode", (int)StatusCode); base.GetObjectData(info, context); }
public void SetMailbox(MaterialType type) { for (int i = 0; i < mailboxes.Length; i++) { mailboxes[i].gameObject.SetActive(i == (int)type); } currentMailbox = mailboxes[(int)type]; animator = currentMailbox.GetComponent <Animator>(); audioSource = currentMailbox.GetComponent <AudioSource>(); letterRoot.transform.SetParent(currentMailbox.transform); animator.SetBool("IsFull", letters.Count > 0); animator.SetBool("IsOpen", IsOpen); if (letters.Count > 0) { TurnOnHelp(); } }
public ParentWithFailingChildActor(Mailbox failingChildMailbox, IEnumerable <Mailbox> siblingMailboxes, SupervisorStrategy supervisorStrategy = null) { _supervisorStrategy = supervisorStrategy; var failingChildProps = new DelegateActorCreationProperties(() => AnonymousActor.Create <object>(_ => { throw new Exception(); })) { MailboxCreator = () => failingChildMailbox }; Func <Mailbox, ActorCreationProperties> createSibling = m => new DelegateActorCreationProperties(() => new NoopActor()) { MailboxCreator = () => m }; var failingChild = CreateActor(failingChildProps, "FailingChild"); siblingMailboxes.ForEach((m, i) => CreateActor(createSibling(m), "Sibling" + i)); ReceiveAnyAndForward(failingChild); }
/// <summary> /// Moves a list of messages from it's current mailbox to a specified mailbox. /// </summary> /// <param name="sourceMailbox">The source mailbox.</param> /// <param name="destinationMailbox">The destination mailbox.</param> /// <param name="messagePaths">The message paths to move.</param> /// <param name="response">The response.</param> /// <param name="newUids">The new uids.</param> /// <returns>The response type.</returns> protected override CommandResponseType MoveMessageCommand(Mailbox sourceMailbox, Mailbox destinationMailbox, Dictionary <string, string> messagePaths, out string response, out Dictionary <string, string> newUids) { newUids = new Dictionary <string, string>(); try { SequenceSet sequenceSet = new SequenceSet(messagePaths.Keys.Select(o => new SequenceNumber(uint.Parse(o)))); CompletionResponse moveMessageResponse = _client.Move(sequenceSet, sourceMailbox, destinationMailbox, out newUids); response = moveMessageResponse.Message; return(GetCommandResponseType(moveMessageResponse.CompletionResult)); } catch (Exception ex) { response = ex.ToString(); return(CommandResponseType.Bad); } }
public static void OnWorldLoadFinished(object sender, EventArgs e) { if (alreadyParsed) { Ferry <PersistedData> .UnloadCargo(); } alreadyParsed = false; ObjectLoader.FindAndSortAllExistingSewables(); for (int i = 0; i < Sims3.Gameplay.Queries.GetObjects <PhoneSmart>().Length; i++) { if (Sims3.Gameplay.Queries.GetObjects <PhoneSmart>()[i] != null) { AddInteractionsPhone(Sims3.Gameplay.Queries.GetObjects <PhoneSmart>()[i]); } } foreach (Computer computer in Sims3.Gameplay.Queries.GetObjects <Computer>()) { if (computer != null) { AddInteractionsComputer(computer); } } // Save/cache our loaded key to make discovery quicker. Rather than always looping through it. for (int i = 0; i < ObjectLoader.sewableSettings.Count; i++) { Pattern.mStoredPatternsKeySettingsList.Add(ObjectLoader.sewableSettings[i].key); } foreach (KeyValuePair <ulong, bool> keyvalues in GlobalOptionsSewingTable.retrieveData.whoIsInPatternClub) { print("Re-assigned the mailbox alarm!"); SimDescription description = SimDescription.Find(keyvalues.Key); Mailbox mailbox = Mailbox.GetMailboxOnLot(description.LotHome); mailbox.AddAlarmDay(1f, DaysOfTheWeek.Thursday, GlobalOptionsSewingTable.SendPatterns, "Mailbox: Pattern club " + description.mSimDescriptionId.ToString(), AlarmType.AlwaysPersisted); } //mPatternClubAlarm = AlarmManager.Global.AddAlarmDay(1f, DaysOfTheWeek.Thursday, GlobalOptionsSewingTable.SendPatterns, "Mailbox: Pattern club", AlarmType.NeverPersisted, null); //mWearClothing = AlarmManager.Global.AddAlarmRepeating(24f, TimeUnit.Hours, WearGiftedClothing, 1f, TimeUnit.Days, "Wear gifted clothing", AlarmType.AlwaysPersisted, null); EventTracker.AddListener(EventTypeId.kBoughtObject, new ProcessEventDelegate(OnObjectChanged)); EventTracker.AddListener(EventTypeId.kInventoryObjectAdded, new ProcessEventDelegate(OnObjectChanged)); EventTracker.AddListener(EventTypeId.kObjectStateChanged, new ProcessEventDelegate(OnObjectChanged)); }
public virtual Mailbox SelectMailbox(string mailboxName) { IdlePause(); var tag = GetTag(); var command = tag + "SELECT " + _utf7.Encode(mailboxName).QuoteString(); _Mailbox = new Mailbox(mailboxName); _SelectedMailbox = mailboxName; var response = SendCommandGetResponse(command); CheckResultOK(response); _Mailbox.IsWritable = Regex.IsMatch(response, "READ.WRITE", RegexOptions.IgnoreCase); IdleResume(); return(_Mailbox); }
public void ProcessMail(object threadContext) { string serverMailboxName = "INBOX"; Mailbox serverMailbox = user.MailClient.SelectMailbox(serverMailboxName); if (serverMailbox == null) { Logger.Log($"ProcessMail has failed to select mailbox {serverMailboxName} for user {user.Username}", LogType.ERROR); goto Exit; } if (cancelToken.IsCancellationRequested) { goto Exit; } if (!RetrieveMessages(serverMailbox, out MessageCollection unreadMessages)) { goto Exit; } if (cancelToken.IsCancellationRequested) { goto Exit; } // Retrieve and store message UIDs in order to be able to delete messages // Unlike IndexOnServer, UIDs do not change when you delete or add new messages int[] messageUID = RetrieveUIDs(serverMailbox, unreadMessages); for (int i = 0; i < unreadMessages.Count; i++) { if (cancelToken.IsCancellationRequested) { goto Exit; } if (ProcessMessage(unreadMessages[i])) { serverMailbox.UidDeleteMessage(messageUID[i], true); } } Exit: doneEvent.Set(); }
public int SaveMailBox(Mailbox mailbox) { var query = new SqlInsert(MailboxTable.TABLE_NAME, true) .InColumnValue(MailboxTable.Columns.Id, mailbox.Id) .InColumnValue(MailboxTable.Columns.Tenant, mailbox.Tenant) .InColumnValue(MailboxTable.Columns.User, mailbox.User) .InColumnValue(MailboxTable.Columns.Address, mailbox.Address) .InColumnValue(MailboxTable.Columns.Name, mailbox.Name) .InColumnValue(MailboxTable.Columns.Enabled, mailbox.Enabled) .InColumnValue(MailboxTable.Columns.IsRemoved, mailbox.IsRemoved) .InColumnValue(MailboxTable.Columns.IsProcessed, mailbox.IsProcessed) .InColumnValue(MailboxTable.Columns.IsServerMailbox, mailbox.IsTeamlabMailbox) .InColumnValue(MailboxTable.Columns.Imap, mailbox.Imap) .InColumnValue(MailboxTable.Columns.UserOnline, mailbox.UserOnline) .InColumnValue(MailboxTable.Columns.IsDefault, mailbox.IsDefault) .InColumnValue(MailboxTable.Columns.MsgCountLast, mailbox.MsgCountLast) .InColumnValue(MailboxTable.Columns.SizeLast, mailbox.SizeLast) .InColumnValue(MailboxTable.Columns.LoginDelay, mailbox.LoginDelay) .InColumnValue(MailboxTable.Columns.QuotaError, mailbox.QuotaError) .InColumnValue(MailboxTable.Columns.ImapIntervals, mailbox.ImapIntervals) .InColumnValue(MailboxTable.Columns.BeginDate, mailbox.BeginDate) .InColumnValue(MailboxTable.Columns.EmailInFolder, mailbox.EmailInFolder) .InColumnValue(MailboxTable.Columns.Password, MailUtil.EncryptPassword(mailbox.Password)) .InColumnValue(MailboxTable.Columns.SmtpPassword, !string.IsNullOrEmpty(mailbox.SmtpPassword) ? MailUtil.EncryptPassword(mailbox.SmtpPassword) : "") .InColumnValue(MailboxTable.Columns.OAuthToken, !string.IsNullOrEmpty(mailbox.OAuthToken) ? MailUtil.EncryptPassword(mailbox.OAuthToken) : "") .InColumnValue(MailboxTable.Columns.OAuthType, mailbox.OAuthType) .InColumnValue(MailboxTable.Columns.SmtpServerId, mailbox.SmtpServerId) .InColumnValue(MailboxTable.Columns.ServerId, mailbox.ServerId) .InColumnValue(MailboxTable.Columns.DateChecked, mailbox.DateChecked) .InColumnValue(MailboxTable.Columns.DateUserChecked, mailbox.DateUserChecked) .InColumnValue(MailboxTable.Columns.DateLoginDelayExpires, mailbox.DateLoginDelayExpires) .InColumnValue(MailboxTable.Columns.DateAuthError, mailbox.DateAuthError) .InColumnValue(MailboxTable.Columns.DateCreated, mailbox.DateCreated) .Identity(0, 0, true); var result = Db.ExecuteScalar <int>(query); return(result); }
public Account(Mailbox mailbox) : base(mailbox) { if (base.IsRoom) { this.UserNameLabel = OwaOptionStrings.RoomEmailAddressLabel; base.EmailAddress = base.PrimaryEmailAddress; } else { SmtpAddress windowsLiveID = mailbox.WindowsLiveID; if (SmtpAddress.Empty != windowsLiveID) { base.EmailAddress = windowsLiveID.ToString(); this.UserName = windowsLiveID.Local; this.Domain = windowsLiveID.Domain; DomainCacheValue domainCacheValue = DomainCache.Singleton.Get(new SmtpDomainWithSubdomains(this.Domain), mailbox.OrganizationId); this.UserNameLabel = ((domainCacheValue != null && domainCacheValue.LiveIdInstanceType == LiveIdInstanceType.Business) ? OwaOptionStrings.UserNameMOSIDLabel : OwaOptionStrings.UserNameWLIDLabel); } else { this.UserNameLabel = OwaOptionStrings.UserLogonNameLabel; string userPrincipalName = mailbox.UserPrincipalName; base.EmailAddress = userPrincipalName; int num = userPrincipalName.IndexOf('@'); if (num > 0) { this.UserName = userPrincipalName.Substring(0, num); this.Domain = userPrincipalName.Substring(num + 1); } else { this.UserName = null; this.Domain = null; } } } this.UserPhotoUrl = string.Format(CultureInfo.InvariantCulture, "~/Download.aspx?Identity={0}&handlerClass=UserPhotoDownloadHandler&preview=false", new object[] { base.PrimaryEmailAddress }); this.userPhotoPreviewUrl = string.Format(CultureInfo.InvariantCulture, "~/Download.aspx?Identity={0}&handlerClass=UserPhotoDownloadHandler&preview=true", new object[] { base.PrimaryEmailAddress }); }
/// <summary> /// Method for retrieve the mail headers for IMAP protocol. /// </summary> /// <param name="mailBox">The mail box</param> /// <returns>The mail headers</returns> public List <MailHeader> RetrieveHeaders(string mailBox) { Mailbox inbox = this._imap4Client.SelectMailbox(mailBox); Fetch fetch = inbox.Fetch; int messageCount = inbox.MessageCount; this._listMessageInbox.Clear(); for (int i = 1; i <= messageCount; i++) { MailHeader mailHeader = new MailHeader(); Header header = fetch.HeaderObject(i); mailHeader.Index = i.ToString(); mailHeader.FillHeader(header); this._listHeaderInbox.Add(mailHeader); } return(this._listHeaderInbox); }
public async Task <ActionResult> ChangeConfirm(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Mailbox mailbox = db.Mailboxes.Find(id); if (mailbox == null) { return(RedirectToAction("PageNotFound", "StaticContent", new { area = "" })); } mailbox.Confirmed = !mailbox.Confirmed; db.Entry(mailbox).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public override void Invoke(MessagingRuntime rt, Mailbox mbox) { Console.WriteLine("Pouring coffee"); Coffee cup = new Coffee(); Console.WriteLine("Pouring Coffee"); while (!doneEggs || !doneBacon || !doneToast) { mbox.Receive(); } Console.WriteLine("Pouring orange juice"); Juice oj = new Juice(); Console.WriteLine("oj is ready"); Console.WriteLine("Breakfast is ready!"); }
protected void Page_Load(object sender, EventArgs e) { Mailbox condition = new Mailbox(); string title = GetstringKey("msg"); if (title != "") { condition.Msg = "%" + title + "%"; condition.AddAttach("Msg", "like"); } condition.ReceiveID = AdminMethod.AdminID; Mailbox value = new Mailbox(); list = TableOperate <Mailbox> .SelectByPage(value, condition, "order by States asc", PageSize, PageIndex, ref Count); DataBind(); msg.Value = title; }
/// <inheritdoc cref="IExchangeListenerManager.ValidateCredentials"/> public CredentialsValidationInfo ValidateCredentials(Mailbox mailbox) { if (GetIsFeatureDisabled("EmailIntegrationV2")) { return(new CredentialsValidationInfo { IsValid = false, Message = "Feature EmailIntegrationV2 disabled" }); } var credentials = GetSynchronizationCredentials(mailbox); var data = Serialize(credentials); var rawResult = string.Empty; TryDoListenerAction(mailbox.SenderEmailAddress, () => { rawResult = ExecuteListenerAction(data, ExchangeListenerActions.Validate); }); return(Json.Deserialize <CredentialsValidationInfo>(rawResult)); }
public void Run(Stopwatch watch, int concurrency) { mailbox_1_ = new Mailbox<Action>(message => {}); concurrent_ = new ConcurrentQueue<int>(); semaphore_ = new SemaphoreSlim(concurrency); for (int i = 0; i < concurrency - 1; i++) { new BackgroundThreadFactory() .CreateThread(new ParameterizedThreadStart(Loop)) .Start(concurrency); } //mailbox_1_.Send(() => Start(watch)); Start(watch); Loop(concurrency); semaphore_.Wait(); Stop(watch); //mailbox_1_.Send(() => Stop(watch)); //sync_.WaitOne(); }
public void SaveMailbox(Mailbox mailbox, Alias address, bool deliver = true) { using (var db = new DbManager(_csName)) { using (var tx = db.BeginTransaction(IsolationLevel.ReadUncommitted)) { var mailboxDao = new MailboxDao(db); mailboxDao.Save(mailbox, deliver); var aliasDao = new AliasDao(db); aliasDao.Save(address); tx.Commit(); } } }
public void AddAndTakeMessagesWithThreeNonConsecutiveRejects() { Mailbox box = new Mailbox(); box.Add(1); box.Add(2); box.Add(3); box.Add(4); box.Add(5); Assert.AreEqual(1, box.Take()); Assert.AreEqual(2, box.Take()); box.Reject(2); Assert.AreEqual(3, box.Take()); box.Reject(3); Assert.AreEqual(4, box.Take()); Assert.AreEqual(2, box.Take()); box.Reject(2); Assert.AreEqual(3, box.Take()); Assert.AreEqual(2, box.Take()); Assert.AreEqual(5, box.Take()); }
public Mailbox GetAll(int page = 0, int limit = 10, int skip = 0) { try { Mailbox mailbox = new Mailbox(); mailbox.RecepientEmail = "*****@*****.**"; if (mailbox != null) { EmailService emailService = new EmailService(); var dto = emailService.GetEmails(page, limit, skip, null, null, null, null, "desc"); if (dto != null && dto.Entities != null) { mailbox.Emails = dto.Entities; mailbox.TotalEmails = dto.TotalRows; } } return mailbox; } catch (Exception ex) { throw HandleException(new object[] { page, limit, skip }, ex); } }
public void changeDirectory(Mailbox mailbox, string mailboxId) { string mailboxRoot; string directory; switch (mailbox) { case Mailbox.Inbox: mailboxRoot = Communications.Settings.Inbox; break; case Mailbox.OpenDSDInbox: mailboxRoot = Communications.Settings.OpenDSDInbox; break; case Mailbox.OpenDSDOutbox: mailboxRoot = Communications.Settings.OpenDSDOutbox; break; default: mailboxRoot = Communications.Settings.Outbox; break; } directory = String.Format("/{0}/{1}/", mailboxRoot, mailboxId); this.changeDirectorySub(directory); }
/// <summary> /// Initializes a new instance of the <see cref="MetricContext"/> by /// using the given <paramref name="mailbox"/>. /// </summary> /// <param name="mailbox"> /// A <see cref="Mailbox{T}"/> that can be used execute a /// <see cref="Action"/> asynchronously. /// </param> /// <param name="clock"> /// A <see cref="Clock"/> that can be used to measure the passage of time. /// </param> public MetricContext(Mailbox<Action> mailbox, Clock clock) { mailbox_ = mailbox; clock_ = clock; }
/// <summary> /// Initializes a new instance of the <see cref="MetricContext"/> by /// using the given <paramref name="mailbox"/>. /// </summary> /// <param name="mailbox"> /// A <see cref="Mailbox{T}"/> that can be used execute a /// <see cref="Action"/> asynchronously. /// </param> public MetricContext(Mailbox<Action> mailbox) : this(mailbox, new StopwatchClock()) { }
private static TreeNode CreateNodeFromMailbox(Mailbox mailbox) { var node = new TreeNode(mailbox.Name) {Tag = mailbox}; return node; }
/// <summary> /// Initializes a nes instance of the <see cref="PublisherAppender"/> using /// the specified <see cref="Socket"/> object. /// </summary> public PublisherAppender() { Port = kDefaultPort; mailbox_ = new Mailbox<LogMessage>(OnMessage); }
public override string GetInteractionName(Sim actor, Mailbox target, InteractionObjectPair iop) { return base.GetInteractionName(actor, target, new InteractionObjectPair(sOldFakeSingleton, target)); }
public override bool Test(Sim a, Mailbox target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { try { if (a.LotHome == target.mLotCurrent) { if (!target.FlagUp) { return false; } // Custom if (mUnitData == null) { return false; } if (!mUnitData.mIsVirtual) { return true; } greyedOutTooltipCallback = delegate { return Mailbox.LocalizeString("WrongUnitGreyedOutTooltip", new object[0x0]); }; } return false; } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(a, target, e); return false; } }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, Mailbox target, List<InteractionObjectPair> results) { foreach (Mailbox.GetMailInteractionApartmentUnitData data in target.GetUnitData()) { results.Add(new InteractionObjectPair(new Definition(data), target)); } }
public Definition(Mailbox.GetMailInteractionApartmentUnitData data) : base(data) { }
public MailboxResponse Post(Mailbox request) { var mailboxPath = new DirectoryInfo(Path.Combine(this.Config.MailFolder, request.Name)); if(mailboxPath.Exists) throw new HttpError(HttpStatusCode.Conflict, new NotSupportedException("Mailbox already exists: " + request.Name)); mailboxPath.Create(); return new MailboxResponse(){Name = request.Name}; }