public bool IsDifferent(LyncState lnew) { if (Id != lnew.Id) { return(true); } if (Type != lnew.Type) { return(true); } if (BaseState != lnew.BaseState) { return(true); } if (Availability != lnew.Availability) { return(true); } if (BaseString != lnew.BaseString) { return(true); } if (LoginState != lnew.LoginState) { return(true); } return(false); }
public ObiUser() { Uri = UserId = PSToken = FirstName = SurName = FName = ""; bcm_initial = lync_initial = true; LS = new LyncState(); BS = new BcmState(); prevLS = null; prevBS = null; ProfileGroup = null; CheckToken = 0; }
public void Set(LyncState lNew) { Id = lNew.Id; Type = lNew.Type; Availability = lNew.Availability; BaseState = lNew.BaseState; BaseString = lNew.BaseString; LCIDString.Clear(); foreach (System.Collections.Generic.KeyValuePair <long, string> ls in lNew.LCIDString) { LCIDString.Add(ls.Key, ls.Value); } Sticky = lNew.Sticky; LoginState = lNew.LoginState; CallState = lNew.CallState; }
public Lync_to_Bcm_Rule findLync2BcmRule(LyncState LS) { LyncState confLS; Lync_to_Bcm_Rule rule; confLS = null; rule = null; // first match the state to ones configured for this group if (LS.Type == LyncStateOption.BasicState || LS.Type == LyncStateOption.CallState) { if (m_LyncStates.TryGetValue(LS.BaseString, out confLS) == false) { m_log.Log("Warning - BasicState " + LS.BaseString + " not part of group config"); } } else // if (LS.Type == LyncStateOption.CustomState) { String srch; foreach (System.Collections.Generic.KeyValuePair <long, String> ls in LS.LCIDString) { srch = "" + ls.Key + ls.Value; if (m_LCID_CustomStates.TryGetValue(srch, out confLS)) { m_log.Log("Found match for custom LCID string " + ls.Value + " on " + srch); break; } } } if (confLS != null) { if (m_Lync2Bcm.TryGetValue(confLS.Id, out rule)) { m_log.Log("Found rule " + rule.rId + " for state " + confLS.Id); } } if (rule == null) { m_log.Log("Cannot match given live lyncstate to configuration set"); } return(rule); }
private bool readLyncStates(XmlReader r) { LyncState ls; string sE, sA; ls = null; try { while (r.Read()) { if (r.IsStartElement()) { sE = r.Name; if (sE == "state") { ls = new LyncState(); sA = r.GetAttribute("id"); ls.Id = sA; ls.BaseString = sA; ls.Type = LyncStateOption.CustomState; sA = r.GetAttribute("availability"); if (sA != null) { ls.Availability = Int32.Parse(sA); } m_log.Log("Adding lyncstate " + ls.Id); m_LyncStates.Add(ls.Id, ls); } if (sE == "lang") { String lcid, lname, lval; int lc; if (ls != null) { lname = r.GetAttribute("id"); lcid = r.GetAttribute("lcid"); lval = r.GetAttribute("text"); ls.LangString.Add(lname, lval); lc = Int32.Parse(lcid); ls.LCIDString.Add(lc, lval); m_log.Log("Adding lyncstate LCID " + lcid + lval); m_LCID_CustomStates.Add(lcid + lval, ls); /* TBC.. * - This requires textual id's to be somewhat unique * - Anyway only value to add would be availaibility * - Formatted string search wouldn't work from lync (e.g. how to match: text="Meeting $EndTime$" ) */ } } if (sE == "BCM_to_Lync") { readBcm2LyncRules(r); return(true); } if (sE == "Lync_to_BCM") { readLync2BcmRules(r); return(true); } } } } catch (Exception e) { m_log.Log("Exception while reading lyncstates " + e); return(false); } return(true); }
public void CreateBaseRules() { m_LyncStates = new Dictionary <string, LyncState>(32); m_BcmStates = new Dictionary <string, BcmProfile>(32); m_Lync2Bcm = new Dictionary <string, Lync_to_Bcm_Rule>(32); m_Bcm2Lync = new Dictionary <string, Bcm_to_Lync_Rule>(32); m_LCID_CustomStates = new Dictionary <string, LyncState>(128); // fill in default lync states LyncState l; l = new LyncState(); l.Type = LyncStateOption.BasicState; l.BaseState = BasicLyncState.Available; l.Id = "Online"; l.BaseString = "Online"; m_LyncStates.Add(l.Id, l); l = new LyncState(); l.Type = LyncStateOption.BasicState; l.BaseState = BasicLyncState.Offline; l.Id = "Offline"; l.BaseString = "Offline"; m_LyncStates.Add(l.Id, l); l = new LyncState(); l.Type = LyncStateOption.BasicState; l.BaseState = BasicLyncState.Busy; l.Id = "Busy"; l.BaseString = "Busy"; m_LyncStates.Add(l.Id, l); l = new LyncState(); l.Type = LyncStateOption.BasicState; l.BaseState = BasicLyncState.BeRightBack; l.Id = "BeRightBack"; l.BaseString = "BeRightBack"; m_LyncStates.Add(l.Id, l); l = new LyncState(); l.Type = LyncStateOption.BasicState; l.BaseState = BasicLyncState.Away; l.Id = "Away"; l.BaseString = "Away"; m_LyncStates.Add(l.Id, l); l = new LyncState(); l.Type = LyncStateOption.BasicState; l.BaseState = BasicLyncState.DoNotDisturb; l.Id = "DoNotDisturb"; l.BaseString = "DoNotDisturb"; m_LyncStates.Add(l.Id, l); l = new LyncState(); l.Type = LyncStateOption.BasicState; l.BaseState = BasicLyncState.OffWork; //tocheck: this seems to be localized action state in lync 2010 l.Id = "OffWork"; l.BaseString = "OffWork"; m_LyncStates.Add(l.Id, l); l = new LyncState(); l.Type = LyncStateOption.BasicState; l.BaseState = BasicLyncState.IdleOnline; l.Id = "IdleOnline"; l.BaseString = "IdleOnline"; m_LyncStates.Add(l.Id, l); l = new LyncState(); l.Type = LyncStateOption.BasicState; l.BaseState = BasicLyncState.IdleBusy; l.Id = "IdleBusy"; l.BaseString = "IdleBusy"; m_LyncStates.Add(l.Id, l); l = new LyncState(); l.Type = LyncStateOption.CallState; l.BaseState = BasicLyncState.Busy; l.Id = "_Talking"; l.BaseString = "_Talking"; m_LyncStates.Add(l.Id, l); l = new LyncState(); l.Type = LyncStateOption.CallState; l.BaseState = BasicLyncState.Available; l.Id = "_EndCall"; l.BaseString = "_EndCall"; m_LyncStates.Add(l.Id, l); l = new LyncState(); l.Type = LyncStateOption.Internal; l.BaseState = BasicLyncState.Available; l.Id = "_Previous"; l.BaseString = "_Previous"; m_LyncStates.Add(l.Id, l); }