Customization of Diarkis Module
This page introduces parts of the code from the directmessage_simple
sample and explains how to customize and use the Diarkis Module. The actual sample source code can be found in samples\directmessage_simple\directmessage_simple.cpp
.
Customizing Each Feature of the Diarkis Module
You can integrate application-specific processing into the module you wish to use. For example, the application can recognize when someone joins a Room or leaves it, and update the UI accordingly. In directmessage_simple
, the DM feature of the Diarkis Module is customized to determine whether a message has been received from another user at least once. To customize the features of the Diarkis Module, you inherit from the base class of each feature (DiarkisModuleNameBase). The DM feature is implemented in DiarkisDirectMessageBase
, and in the sample, this class is inherited to implement the necessary processing. The following code is a partial implementation.
DiarkisDirectMessageBase
primarily defines interfaces for using the DM feature and interfaces for receiving events. The interface for using the DM feature is used for purposes such as executing specific processing before invoking DM functions. On the other hand, the interface for receiving events allows implementing processing for notifications when events like receiving a message occur. In the sample implementation, DiarkisDirectMessageBase::OnMessage
is overridden to save whether a message has been received via DM.
Customizing DiarkisInterfaceBase
When using the Diarkis Module, all instances of classes implementing each feature are managed by the DiarkisInterfaceBase
class, and the creation of instances also takes place within DiarkisInterfaceBase
. If you customize the base class, it is necessary to change the type of the instances generated within DiarkisInterfaceBase
, so you implement a customized DiarkisInterfaceBase
class by inheriting it. Below is a partial implementation of the sample.
Instance generation for each feature is performed in DiarkisInterfaceBase::Setup...
. Since instance generation for the DM feature is done in DarkisInterfaceBase::SetupDirectMessage()
, this method is overridden to generate the user-customized DM feature class. Additionally, a method for obtaining instances of the DM feature with the customized type is added.
By using these customized classes, you can incorporate application-specific processing into the Diarkis Module and customize it.
Important Notes
Given the nature of Diarkis Module being provided as source code, it's also possible to make the same customization by directly modifying it without inheriting the base class. However, there's a possibility that the source code of Diarkis Module might undergo significant changes during version upgrades, making merges difficult. To avoid such situations, it is recommended to customize as described on this page.
Last updated
Was this helpful?