示例#1
0
        public bool doScene(SnsCommentNeedSend comment)
        {
            if ((comment == null) || (comment.currentComment == null))
            {
                return(false);
            }
            if ((sendingMap != null) && sendingMap.ContainsKey(comment.strClientID))
            {
                return(false);
            }
            this.mCommentContent = comment;
            Account account = AccountMgr.getCurAccount();

            SnsActionGroup.Builder builder = new SnsActionGroup.Builder {
                Id       = comment.objectID,
                ParentId = comment.parentID
            };
            builder.CurrentAction = new SnsAction.Builder {
                ToUsername = comment.currentComment.strUserName, ToNickname = comment.currentComment.strNickName, FromUsername = account.strUsrName, FromNickname = account.strNickName, Type = comment.currentComment.nType, Source = comment.currentComment.nSource, CreateTime = comment.currentComment.nCreateTime, Content = comment.currentComment.strContent, CommentId = comment.currentComment.nCommentId, ReplyCommentId = comment.currentComment.nReplyCommentId
            }.Build();
            if (comment.referComment != null)
            {
                builder.ReferAction = new SnsAction.Builder {
                    ToUsername = comment.referComment.strUserName, ToNickname = comment.referComment.strNickName, FromUsername = account.strUsrName, FromNickname = account.strNickName, Type = comment.referComment.nType, Source = comment.referComment.nSource, CreateTime = comment.referComment.nCreateTime, Content = comment.referComment.strContent, CommentId = comment.referComment.nCommentId, ReplyCommentId = comment.referComment.nReplyCommentId
                }.Build();
            }
            if (sendingMap == null)
            {
                sendingMap = new Dictionary <string, SnsCommentNeedSend>();
            }
            sendingMap.Add(comment.strClientID, comment);
            return(this.doSceneEx(builder.Build(), comment.strClientID));
        }
示例#2
0
        public bool doSendComment(SnsInfo snsObj, string strContent, CommentType type, AddContactScene source, CommentArg replyInfo = null, int refCommentID = -1)
        {
            if (snsObj == null)
            {
                return(false);
            }
            SnsComment item = new SnsComment
            {
                strContent  = strContent,
                strNickName = AccountMgr.getCurAccount().strNickName,
                strUserName = AccountMgr.getCurAccount().strUsrName,
                nType       = (uint)type,
                nCreateTime = (uint)Util.getNowSeconds(),
                nSource     = (uint)source
            };

            if (replyInfo != null)
            {
                item.nReplyCommentId  = replyInfo.commentID;
                item.strReplyUsername = replyInfo.strUserName;
            }

            if ((type == CommentType.MMSNS_COMMENT_LIKE) || (type == CommentType.MMSNS_COMMENT_STRANGER_LIKE))
            {
                snsObj.likeList.list.Add(item);
                snsObj.likeList.list = snsObj.likeList.list;
                snsObj.likeList      = snsObj.likeList;
                snsObj.nLikeFlag     = 1;
                snsObj.nLikeCount++;
            }
            else
            {
                snsObj.commentList.list.Add(item);
                snsObj.commentList.list = snsObj.commentList.list;
                snsObj.commentList      = snsObj.commentList;
                snsObj.nCommentCount++;
            }
            //if (StorageMgr.snsInfo.getByObjectID(snsObj.strObjectID) != null)
            //{
            //    StorageMgr.snsInfo.updateByObjectID(snsObj);
            //}
            SnsCommentNeedSend comment = NetSceneSnsComment.creatSnsCommentNeedSend(snsObj, strContent, type, source, replyInfo, refCommentID);

            new NetSceneSnsComment().doScene(comment);

            return(true);
        }
示例#3
0
        public static SnsCommentNeedSend creatSnsCommentNeedSend(SnsInfo snsObj, string strContent, CommentType type, AddContactScene source, CommentArg replyInfo = null, int referCommetID = -1)
        {
            SnsCommentNeedSend send = new SnsCommentNeedSend {
                objectID       = snsObj.nObjectID,
                parentID       = 0L,
                referComment   = null,
                strClientID    = MD5Core.GetHashString(Util.getNowMilliseconds().ToString()),
                currentComment = new SnsComment()
            };

            send.currentComment.strContent  = strContent;
            send.currentComment.strNickName = snsObj.strNickName;
            send.currentComment.strUserName = snsObj.strUserName;
            if (replyInfo != null)
            {
                send.currentComment.strNickName     = replyInfo.strNickName;
                send.currentComment.strUserName     = replyInfo.strUserName;
                send.currentComment.nReplyCommentId = replyInfo.commentID;
            }
            send.currentComment.nType       = (uint)type;
            send.currentComment.nCreateTime = (uint)Util.getNowSeconds();
            send.currentComment.nSource     = (uint)source;
            if (referCommetID >= 0)
            {
                foreach (SnsComment comment in snsObj.commentList.list)
                {
                    if (comment.nCommentId == referCommetID)
                    {
                        send.referComment                 = new SnsComment();
                        send.referComment.strContent      = comment.strContent;
                        send.referComment.strNickName     = comment.strNickName;
                        send.referComment.strUserName     = comment.strUserName;
                        send.refFromUserName              = snsObj.strUserName;
                        send.refFromNickName              = snsObj.strNickName;
                        send.referComment.nType           = comment.nType;
                        send.referComment.nCreateTime     = comment.nCreateTime;
                        send.referComment.nSource         = comment.nSource;
                        send.referComment.nReplyCommentId = comment.nReplyCommentId;
                    }
                }
            }
            return(send);
        }
示例#4
0
 public static bool delCommentFromXml(SnsCommentNeedSend comment)
 {
     return(true);
 }