Exemplo n.º 1
0
/*
 *              public iFolderUser(Simias.Storage.Member member,
 *                                                      Novell.AddressBook.Contact contact)
 *              {
 *                      if(contact != null)
 *                      {
 *                              Novell.AddressBook.Name name;
 *
 *                              name = contact.GetPreferredName();
 *                              if(name != null)
 *                              {
 *                                      this.Surname = name.Family;
 *                                      this.FirstName = name.Given;
 *                              }
 *                              this.FN = contact.FN;
 *                      }
 *
 *                      this.Name = member.Name;
 *                      this.UserID = member.UserID;
 *                      this.ID = member.ID;
 *                      this.State = "Member";
 *                      this.IsOwner = member.IsOwner;
 *                      this.Rights = member.Rights.ToString();
 *              }
 */
        /// <summary>
        /// </summary>
        /// <param name="sub"></param>
        public iFolderUser(Simias.POBox.Subscription sub)
        {
            this.Name   = sub.ToName;
            this.UserID = sub.ToIdentity;

            // Need to get the member for first and last name
            Simias.Storage.Domain domain = Store.GetStore().GetDomain(sub.DomainID);
            if (domain != null)
            {
                Simias.Storage.Member simMem = domain.GetMemberByID(sub.ToIdentity);
                if (simMem != null)
                {
                    this.Surname   = simMem.Family;
                    this.FirstName = simMem.Given;
                    this.FN        = simMem.FN;
                }
            }

            this.Rights    = sub.SubscriptionRights.ToString();
            this.ID        = sub.ID;
            this.iFolderID = sub.SubscriptionCollectionID;
            this.State     = "Invited";
            this.IsOwner   = false;

            if (sub.SubscriptionState ==
                Simias.POBox.SubscriptionStates.Invited)
            {
                this.State = "WaitSync";
            }
            else if (sub.SubscriptionState ==
                     Simias.POBox.SubscriptionStates.Posted)
            {
                this.State = "Invited";
            }
            else if (sub.SubscriptionState ==
                     Simias.POBox.SubscriptionStates.Pending)
            {
                this.State = "AccessRequest";
            }
            else if (sub.SubscriptionState ==
                     Simias.POBox.SubscriptionStates.Responded)
            {
                if (sub.SubscriptionDisposition ==
                    Simias.POBox.SubscriptionDispositions.Declined)
                {
                    this.State = "Declined";
                }
                else
                {
                    this.State = "Unknown";
                }
            }
            else
            {
                this.State = "Unknown";
            }
        }
Exemplo n.º 2
0
 internal static void UpdatePublicSharediFolderMembers(Simias.Storage.Collection col, GaimBuddy[] buddies)
 {
     Simias.Storage.Domain domain = GaimDomain.GetDomain();
        if (domain == null) return;
        Hashtable subscribedUserIDs = new Hashtable();
        Store store = Store.GetStore();
        Simias.POBox.POBox poBox =
     Simias.POBox.POBox.FindPOBox(store, domain.ID, store.GetUserIDFromDomainID(domain.ID));
        ICSList poList = poBox.Search(
     Simias.POBox.Subscription.SubscriptionCollectionIDProperty,
     col.ID,
     SearchOp.Equal);
        foreach(Simias.Storage.ShallowNode sNode in poList)
        {
     Simias.POBox.Subscription sub = new Simias.POBox.Subscription(poBox, sNode);
     if (sub.SubscriptionState == Simias.POBox.SubscriptionStates.Ready)
     {
      if (poBox.StoreReference.GetCollectionByID(
       sub.SubscriptionCollectionID) != null)
      {
       continue;
      }
     }
     subscribedUserIDs[sub.ToIdentity] = sub.ToIdentity;
     log.Debug("Added {0} to subscribedUserIDs", sub.ToName);
        }
        foreach (GaimBuddy buddy in buddies)
        {
     string[] machineNames = buddy.MachineNames;
     foreach (string machineName in machineNames)
     {
      Member member = FindBuddyInDomain(domain, buddy, machineName);
      if (member != null)
      {
       if (subscribedUserIDs[member.UserID] == null)
       {
        InviteUser(poBox, col, member);
       }
      }
      else
      {
       string memberName = buddy.GetSimiasMemberName(machineName);
       string memberUserID = buddy.GetSimiasUserID(machineName);
       if (memberName != null && memberUserID != null)
       {
        member = new Simias.Storage.Member(
        memberName,
        memberUserID,
        Simias.Storage.Access.Rights.ReadOnly );
        string alias = buddy.Alias;
        if (alias != null)
        {
     member.FN = string.Format("{0} ({1})", alias, machineName);
        }
        domain.Commit( member );
        log.Debug("Added new Gaim Domain Member in Simias: {0} ({1})", buddy.Name, machineName);
        InviteUser(poBox, col, member);
       }
      }
     }
        }
 }