MsgCommunicator: Delphi Instant Messaging (IM) SDK
for easy creation of custom messenger system


TMsgClient.FindMessages
TMsgClient
Top 

Search for the messages in message history.

function FindMessages(
                      out ResultDataset:                 TDataset;
                      UseLocalHistory:                   Boolean;
                      var MessageTextComparison:         TMsgTextComparison;
                      var MessageUnicodeTextComparison:  TMsgTextComparison;
                      var SendingDate:                   TMsgDateComparison;
                      var DeliveryDate:                  TMsgDateComparison;
                      SearchDelivered:                   Boolean;
                      Delivered:                         Boolean = True;
                      MessageText:                       String = ''; 
                      MessageUnicodeText:                WideString = ''; 
                      SenderID:                          Cardinal = MSG_INVALID_USER_ID;
                      RecipientID:                       Cardinal = MSG_INVALID_USER_ID;
                      MessageType:                       TMsgMessageType = aamtNone;
                      MessageDataSize:                   Integer = -1; 
                      OrderBySendingDate:                Boolean = False;
                      OrderByClause:                     String = '';
                      Command:                           Cardinal = 0 
                     ): Integer;

Description
Call FindMessages to search messages in local or remote message history with conditions and optional sorting.
Message history is stored in messages table of the database. You can customize saving to the messages table using OnSaveMessage event.
This method returns the TDataset descendant object which contains found records from messages table. You must destroy this object after using it.
Default value of any parin FindMessages means no condtion on this value.
You must be connected to the server before calling FindMessages.
The Database property of TMsgServer in server application must be assigned before using this method.
You must specify either SenderID or RecipientID equal to your UserID to be able to search messages.
Thus you can get only messages which you have sent or which were sent to you by other users or server.
You should use database with Unicode support for searching on MessageUnicodeText.

If UseLocalHistory is true then Database property of TMsgClient must be assigned.
If UseLocalHistory is false then TempTable property of TMsgClient must be assigned. Also in this case the TempTable property must be set to the same TMsgTempTable descendant as in TMsgClient.

Look at demos in Demos\Databases for example.

Parameter  
Meaning
ResultDataset
UseLocalHistory MessageTextComparison MessageUnicodeTextComparison
SendingDate DeliveryDate SearchDelivered
Delivered MessageText MessageUnicodeText
SenderID RecipientID MessageType MessageDataSize
OrderBySendingDate
OrderByClause

Command
Temporary table with found records from messages table.
If true then search in local database else search in server database.
Message text search condition .
Message Unicode text search condition.
Sending date search condition.
Delivery date search condition.
True enables search on Delivered flag, false - disables.
Delivered flag search condition.
Message text search string.
Message Unicode text search string.
UserID of the sender of the message.
UserID of the recipient of the message.
Type of the message.
Size of the binary data for binary and stream messages.
True enables sorting on SendingDate, false - disables.
SQL ORDER BY clause without words ORDER BY.
Example: SenderID ASC, SendingDate DESC.
Custom command number sent by SendCommand
.


FindUsers sends command to the server, waits for the answer and returns temporary table with found messages if result code is MSG_COMMAND_OK.

FindUsers can return one of the following error codes:
Name
Value
MSG_Error_FindMessages_NotConnected
MSG_Error_FindMessages_SendCommandFailed
MSG_Error_FindMessages_ReceiveResultFailed
MSG_Error_FindMessages_InvalidParams
MSG_Error_FindMessages_InvalidServerReply
MSG_Error_FindMessages_Failed
MSG_Error_FindMessages_Client_TempTableIsNotAssigned
MSG_Error_FindMessages_Server_TempTableIsNotAssigned
MSG_Error_FindMessages_Client_DatabaseIsNotAssigned
MSG_Error_FindMessages_Server_DatabaseIsNotAssigned
MSG_Error_FindMessages_CannotLoadDatasetFromStream
MSG_Error_FindMessages_CannotSaveDatasetToStream
MSG_Error_FindMessages_SenderOrRecepientMustBeSpecified
MSG_Error_FindMessages_NotLogged
60068
60069
60070
60071
60072
60073
60074
60075
60076
60077
60078
60079
60080
60111





© AidAim Software MsgCommunicator: Delphi Messenger Sdk Instant Messaging Sdk Im Sdk