Talk:AwaymessageSet
From TrillWiki
Moving discussion from this thread to here. Topic is suggested manner of implementing transient away states in the SDK.
To get the discussion moving, I'll propose an implementation.
I propose adding fileds to the existing awaymessage_entry_t struct. (See below)
There would be 3 uses of this function:
1) If save is 0 and name is not NULL, then the funcionality is as it is now; i.e. a previously saved away message (specified by name) is set.
2) if save is 0 and name is NULL, then a transient away message is being set.
3) If save is 1 and name is not NULL, then a new saved away message is being created.
Cases 2 and 3 are very simialr. The only difference being whether or not the message is saved. The message to be used is specified in the message parameter. The auto_respond and away_state parameters serve the same purpose as their checkbox counterparts on the Trillian away message dialog.
The interesting part of all of this is how statuses are specified. For that a new awaymessage_statuses_t struct is used. It allows a list of status to be sent along with the awaymessage_entry_t struct. The medium and connection_id parameters qualify to which accounts the struct refers. connection_id could be -1 to specify all accounts for a given medium. Also, if medium_name is NULL, this would apply to all accounts across all mediums. The status member can hold one of a few values. "DEFAULT", "DEFAULT_AWAY" and "DEFAULT_IDLE" would be available for any medium. Otherwise a valid status name for the specified medium must be given. To determine the valid status names for a medium, a mediumStatusEnumerate API call would also have to be added. Any medium which is not specified or is specified incorrectly would use the "DEFAULT_AWAY" state. Thus, to specify a new away message using the default status for all mediums, the status_list parameter of the awaymessage_entry_t struct could simply be set to NULL.
struct awaymessage_entry_t
{
unsigned int struct_size;
char *name;
char *message
int save;
int auto_respond;
int away_state;
struct awaymessage_statuses_t *staus_list
};
struct awaymessage_statuses_t
{
unsigned int struct_size;
char *medium_name;
int connection_id;
char *status;
struct awaymessage_statuses_t *next_status;
};
