Notifications
Clear all

Loading messages

7 Posts
2 Users
0 Reactions
816 Views
(@tommih)
Posts: 44
Trusted Member
Topic starter
 

Hello again.

I seem to be also stuck on the messaging system. I've managed to post messages on our server fine, and if I load them using the demo scene, I can load them fine. But if I load them with this code...

     Mail.Load(eMailList.Both03, (messagesReceivedcountpagesCounterror) => {

...I get back an empty list. It seems your demo scene loads "conversations" if there are no messages loaded yet but I just want to load all messages to and from the user that's logged in. Am I doing something wrong?

 
Posted : 14/09/2015 12:17 am
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

You are trying to load the page number "0" with "3" records per page, so you're not receiving any results because "page 0" does not exist. The results of Load (as for any other classes in Combu) are paginated so you must load one page at time (the callback will pass you the total number of pages available and the total number of records so you can also implement an infinite scrolling when the user drags the list in your UI by continuously load until you've loaded all pages), you cannot load ALL the messages at once because it would generate very high traffic and the performance of your MySql server could be hit so much.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 14/09/2015 10:25 am
(@tommih)
Posts: 44
Trusted Member
Topic starter
 

Thanks for the response.

However, I also tried with "1, 3" instead of "0, 3", and I still didn't get any messages. (Also, does the count really start at 1 instead of the usual programming way where you count from 0 up? Or does 0 not exist for some other reason?)

 
Posted : 15/09/2015 2:24 am
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

Oh I see, you're requesting eMailList.Both but this list type requires a recipient user Id or group Id (it's used to display a thread-like view of conversation between the user and another user or a group), that is you should use the overload of Mail.Load for example:

Mail.Load(eMailList.Both, 2, 0, 0, 1, 3, yourCallback); // Request page 1 with 3 messages to/from user with Id=2
Mail.Load(eMailList.Both, 0, 0, 2, 1, 3, yourCallback); // Request page 1 with 3 messages to/from group with Id=2

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 15/09/2015 10:22 am
(@tommih)
Posts: 44
Trusted Member
Topic starter
 

OK, so there's no way to just get all of my (recent, page-by-page) sent and received messages in one list?

By the way, it would be very nice if this returned some kind of informative error message.

 
Posted : 15/09/2015 2:38 pm
(@tommih)
Posts: 44
Trusted Member
Topic starter
 

Is six the maximum number of messages I can download at once? It seems if I ask for 10, I get 6 even though I know there should be more messages.

 
Posted : 17/09/2015 6:50 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

Nope, I'm testing this code and I get 10 messages:

Mail.Load(eMailList.Received, 1, 10, (messagesReceived, count, pagesCount, error2) => {
   Debug.Log(messagesReceived.Length);
});

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 17/09/2015 11:26 pm
Share: