Mesibo User and Group Profiles

In mesibo, users and groups are the fundamental elements. Almost every operation in mesibo revolves around users and groups. For example,

  • Sending and receiving messages between individual users or within groups.
  • One-to-one calls and group calls, which also involve users and groups
  • Users can view each other's information such as photos, names, descriptions, etc.
  • Users can create and administrate the group, add members, etc.

Overall, users and groups are central to every operation in mesibo. In mesibo, users and groups are represented by MesiboProfile class which encapsulates all the user and group information such as name, pictures, profile data, members, etc.

In this section, we will explore how users can access profiles of other users and groups and subscribe to real-time updates. We will also cover the process of publishing own profile with data and images that other users can access and how users can set various levels of profile access level so that different sets of users can access different sets of information, and more.

Accessing Profile

To get the profile of any user or group, you need to call the getProfile() API with the user address or the group ID:

profile = Mesibo.getProfile(userAddress);

Or,

profile = Mesibo.getProfile(groupId);

Once you have a profile object, you can access various information. Profile stores all the information as a name-value pair which you can access using various get functions. In addition, the profile also provides two dedicated functions to access names and images. For example,

String name = profile.getName();
String status = profile.getString("status", ""); 
int zip = profile.getInt("zip", 0);  

In the above example, we have assumed that "status" and "zip" were set in the profile at the time of publishing (covered in the next section). The second argument is the default value to return if the value for the key does not exist.

To get images:

MesiboProfileImage image = profile.getImage(0); // image at index 0
Bitmap bmp = image.getImage();
Bitmap tn = image.getThumbnail();

// get the next image if the profile has multiple images
MesiboProfileImage nextImage = image.getNext(); 

You can also get all values in the profile in one shot:

values = profile.getValues();

You can also perform various operations, for example, create a new message for it, create a database session, view information, subscribe, etc.

For example, in the code below, we have created and sent a message to a profile.

MesiboMessage m = profile.newMessage();
m.message = "Hello";
m.send();

Depending on the profile, the message goes to an individual user or the group. Hence, you don't need to deal with or learn separate APIs for users and groups.

You can also access the profile from the received or sent message, for example,

message.getProfile()

returns the profile of the peer if the message is one-to-one, or the group profile if the message was for the group.

message.getPeerProfile()

returns the profile of the peer.

message.getSenderProfile()

returns the profile of the peer if the message is incoming, or the self profile if the message is outgoing.

In the next section, we will learn how users can publish their profile.