private async Task <bool> PostCommitToChannels(IMAPMessage imapMsg, HashSet <string> channelIDsForRepository, Dictionary <string, HashSet <string> > commitUidsPostedInChannels) { bool posted = false; foreach (string channelID in channelIDsForRepository) { bool channelFound = false; HashSet <string> commitUidsPostedInChannel = commitUidsPostedInChannels.TryGetValue(channelID, out channelFound); if (channelFound) { if (!commitUidsPostedInChannel.Contains(imapMsg.Uid.ToString())) { SLChatPostMessageResult result = await PostCommit(imapMsg, channelID); if ((!result.ok.HasValue) || (!result.ok.Value)) { posted = false; return(posted); } else { posted = true; } } } } return(posted); }
private async Task <bool> PostBuilds(List <IMAPMessage> messages, List <string> groupIDs) { bool posted = false; foreach (IMAPMessage message in messages) { foreach (string groupID in groupIDs) { bool buildWasPosted = await BuildWasPosted(message.Uid, groupID); if (!buildWasPosted) { SLChatPostMessageResult result = await PostBuild(message, groupID); if ((!result.ok.HasValue) || (!result.ok.Value)) { posted = false; return(posted); } else { posted = true; } } } } return(posted); }
private async Task <bool> PostDefects(Dictionary <string, List <ALMDefect> > almDefectsForSubareas, Dictionary <string, List <SLMessage> > messagesForGroupIDs, Dictionary <string, List <string> > groupsIDsForSubareas) { bool posted = false; foreach (KeyValuePair <string, List <string> > groupsIDsForSubarea in groupsIDsForSubareas) { if (almDefectsForSubareas.ContainsKey(groupsIDsForSubarea.Key)) { foreach (ALMDefect defect in almDefectsForSubareas[groupsIDsForSubarea.Key]) { foreach (string groupID in groupsIDsForSubarea.Value) { bool defectWasPostedBefore = false; DateTime?messageDate = null; string status = null; FindDefectInMessages(defect, messagesForGroupIDs[groupID], out defectWasPostedBefore, out messageDate, out status); if (defectWasPostedBefore) { if (!defect.status.Equals(status)) { SLChatPostMessageResult result = await PostDefect(groupID, defect); if (result.ok.HasValue) { if (result.ok.Value) { posted = true; } } } else { // Updates without changed state are pesky // DateTime defectLastModifiedDate = DateTime.Parse(defect.last_modified_date); // if (defectLastModifiedDate > messageDate) // { // await PostDefect(groupID, defect); // } // System.Diagnostics.Debug.WriteLine("Defect: " + defect.id + " Body:" + defect.name); } } else { if (!defect.status.Equals("Closed")) { SLChatPostMessageResult result = await PostDefect(groupID, defect); if (result.ok.HasValue) { if (result.ok.Value) { posted = true; } } } } } } } } return(posted); }