Re: Integrating cutechat and messenger with our own communication Portal

  •  02-03-2009, 10:47 AM

    Re: Integrating cutechat and messenger with our own communication Portal

    MIdhun,
     
     
    And check the integration code of this project.
     
    It shows you how to add contact and how to remove contact.
     
                public override void AddContact(ChatIdentity identity, string userid)
                {
                    lock (this.Portal)
                    {
                        ChatProvider provider = ChatProvider.GetInstance(this.Portal);
                        string username = provider.FromUserId(identity.UniqueId);
                        CommunityServer.Components.User user = CommunityServer.Users.GetUser(0, username, false, true);
                        if (user == null) return;
                        string targetname = provider.FromUserId(userid);
                        CommunityServer.Components.User target = CommunityServer.Users.GetUser(0, targetname, false, true);
                        if (target == null) return;
                        CommunityServer.Components.Friendships.InsertFriendship(user.UserID, target.UserID, "added by messenger", CommunityServer.Components.FriendshipState.Approved);
                        this.OnContactAdded(identity, userid);
                    }
                }
                public override void RemoveContact(ChatIdentity identity, string userid)
                {
                    lock (this.Portal)
                    {
                        ChatProvider provider = ChatProvider.GetInstance(this.Portal);
                        string username = provider.FromUserId(identity.UniqueId);
                        CommunityServer.Components.User user = CommunityServer.Users.GetUser(0, username, false, true);
                        if (user == null) return;
                        string targetname = provider.FromUserId(userid);
                        CommunityServer.Components.User target = CommunityServer.Users.GetUser(0, targetname, false, true);
                        if (target == null) return;
                        CommunityServer.Components.Friendship friend=CommunityServer.Components.Friendships.GetFriendship(user.UserID, target.UserID, false);
                        if (friend == null) return;
                        CommunityServer.Components.Friendships.DeleteFriendship(friend);
                        this.OnContactRemoved(identity, userid);
                    }
                }

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread