getSender() public method

public getSender ( ) : String
return String
Exemplo n.º 1
0
        /* public IncomingTextMessage(Parcel in)
         * {
         *   this.message = in.readString();
         *   this.sender = in.readString();
         *   this.senderDeviceId = in.readInt();
         *   this.protocol = in.readInt();
         *   this.serviceCenterAddress = in.readString();
         *   this.replyPathPresent = (in.readInt() == 1);
         *   this.pseudoSubject = in.readString();
         *   this.sentTimestampMillis = in.readLong();
         *   this.groupId = in.readString();
         *   this.push = (in.readInt() == 1);
         * }*/

        public IncomingTextMessage(IncomingTextMessage message, String newBody)
        {
            this.Message              = newBody;
            this.Sender               = message.getSender();
            this.SenderDeviceId       = message.getSenderDeviceId();
            this.Protocol             = message.getProtocol();
            this.ServiceCenterAddress = message.getServiceCenterAddress();
            this.ReplyPathPresent     = message.isReplyPathPresent();
            this.PseudoSubject        = message.getPseudoSubject();
            this.SentTimestampMillis  = message.SentTimestampMillis;
            this.GroupId              = message.GroupId;
            this.Push = message.IsPush;
        }
Exemplo n.º 2
0
        /* public IncomingTextMessage(Parcel in)
         {
             this.message = in.readString();
             this.sender = in.readString();
             this.senderDeviceId = in.readInt();
             this.protocol = in.readInt();
             this.serviceCenterAddress = in.readString();
             this.replyPathPresent = (in.readInt() == 1);
             this.pseudoSubject = in.readString();
             this.sentTimestampMillis = in.readLong();
             this.groupId = in.readString();
             this.push = (in.readInt() == 1);
         }*/

        public IncomingTextMessage(IncomingTextMessage message, String newBody)
        {
            this.Message = newBody;
            this.Sender = message.getSender();
            this.SenderDeviceId = message.getSenderDeviceId();
            this.Protocol = message.getProtocol();
            this.ServiceCenterAddress = message.getServiceCenterAddress();
            this.ReplyPathPresent = message.isReplyPathPresent();
            this.PseudoSubject = message.getPseudoSubject();
            this.SentTimestampMillis = message.SentTimestampMillis;
            this.GroupId = message.GroupId;
            this.Push = message.IsPush;
        }
Exemplo n.º 3
0
        protected Pair<long, long> InsertMessageInbox(IncomingTextMessage message, long type)
        { // TODO : https://github.com/WhisperSystems/Signal-Android/blob/e9b53cc164d7ae2d838cc211dbd88b7fd4f5669e/src/org/thoughtcrime/securesms/database/SmsDatabase.java
            if (message.isPreKeyBundle())
            {
                type |= MessageTypes.KEY_EXCHANGE_BIT | MessageTypes.KEY_EXCHANGE_BUNDLE_BIT;
            }
            else if (message.isSecureMessage())
            {
                type |= MessageTypes.SECURE_MESSAGE_BIT;
            }
            /*else if (message.isGroup()) TODO: GROUP enable
            {
                type |= MessageTypes.SECURE_MESSAGE_BIT;
                if (((IncomingGroupMessage)message).isUpdate()) type |= MessageTypes.GROUP_UPDATE_BIT;
                else if (((IncomingGroupMessage)message).isQuit()) type |= MessageTypes.GROUP_QUIT_BIT;
            }*/
            else if (message.IsEndSession)
            {
                type |= MessageTypes.SECURE_MESSAGE_BIT;
                type |= MessageTypes.END_SESSION_BIT;
            }

            if (message.IsPush) type |= MessageTypes.PUSH_MESSAGE_BIT;

            Recipients recipients;

            if (message.getSender() != null)
            {
                recipients = RecipientFactory.getRecipientsFromString(message.getSender(), true);
            }
            else
            {
                //Log.w(TAG, "Sender is null, returning unknown recipient");
                recipients = new Recipients(Recipient.getUnknownRecipient());
            }

            Recipients groupRecipients;

            if (message.GroupId == null)
            {
                groupRecipients = null;
            }
            else
            {
                groupRecipients = RecipientFactory.getRecipientsFromString(message.GroupId, true);
            }

            bool unread = /*org.thoughtcrime.securesms.util.Util.isDefaultSmsProvider() ||*/
                                    message.isSecureMessage() || message.isPreKeyBundle();

            long threadId;

            if (groupRecipients == null) threadId = DatabaseFactory.getThreadDatabase().GetThreadIdForRecipients(recipients); // TODO CHECK
            else threadId = DatabaseFactory.getThreadDatabase().GetThreadIdForRecipients(groupRecipients);

            /*ContentValues values = new ContentValues(6);
            values.put(ADDRESS, message.getSender());
            values.put(ADDRESS_DEVICE_ID, message.getSenderDeviceId());
            values.put(DATE_RECEIVED, System.currentTimeMillis());
            values.put(DATE_SENT, message.getSentTimestampMillis());
            values.put(PROTOCOL, message.getProtocol());
            values.put(READ, unread ? 0 : 1);

            if (!TextUtils.isEmpty(message.getPseudoSubject()))
                values.put(SUBJECT, message.getPseudoSubject());

            values.put(REPLY_PATH_PRESENT, message.isReplyPathPresent());
            values.put(SERVICE_CENTER, message.getServiceCenterAddress());
            values.put(BODY, message.getMessageBody());
            values.put(TYPE, type);
            values.put(THREAD_ID, threadId);*/

            var insert = new Message()
            {
                Address = message.getSender(),
                AddressDeviceId = message.getSenderDeviceId(),
                DateReceived = TimeUtil.GetDateTimeMillis(), // force precision to millis not to ticks
                DateSent = TimeUtil.GetDateTime(message.SentTimestampMillis),
                Read = !unread,
                Body = message.getMessageBody(),
                Type = type,
                ThreadId = threadId
            };

            long rows = conn.Insert(insert);

            long messageId = insert.MessageId;

            if (unread)
            {
                DatabaseFactory.getThreadDatabase().SetUnread(threadId);
            }

            DatabaseFactory.getThreadDatabase().Refresh(threadId);
            notifyConversationListeners(threadId);
            //jobManager.add(new TrimThreadJob(context, threadId)); // TODO

            return new Pair<long, long>(messageId, threadId);
        }