mstdnt_notification_t_to_str

FossilOrigin-Name: 32263f1cf39d349d73fafb27f82c0b7d3f23ca101a4a75d5e9233812fac9099c
This commit is contained in:
nekobit 2022-08-10 23:20:09 +00:00
parent c61371a34f
commit 011d0f500d
2 changed files with 27 additions and 0 deletions

View file

@ -32,4 +32,12 @@
typedef uint16_t mstdnt_notification_t;
/**
* Turns a notification type into a string
*
* @param type Notification type.
* @return String literal representing type, e.g. 'follow', 'follow request'
*/
const char* mstdnt_notification_t_to_str(mstdnt_notification_t type);
#endif /* MASTODONT_NOTIF_TYPES */

View file

@ -144,3 +144,22 @@ void mstdnt_cleanup_notification(struct mstdnt_notification* notif)
}
}
const char* mstdnt_notification_t_to_str(mstdnt_notification_t type)
{
switch (type)
{
case MSTDNT_NOTIFICATION_FOLLOW: return "follow";
case MSTDNT_NOTIFICATION_FOLLOW_REQUEST: return "follow request";
case MSTDNT_NOTIFICATION_MENTION: return "mention";
case MSTDNT_NOTIFICATION_REBLOG: return "reblog";
case MSTDNT_NOTIFICATION_FAVOURITE: return "favourite";
case MSTDNT_NOTIFICATION_POLL: return "poll";
case MSTDNT_NOTIFICATION_STATUS: return "status";
case MSTDNT_NOTIFICATION_EMOJI_REACT: return "emoji reaction";
case MSTDNT_NOTIFICATION_CHAT_MENTION: return "chat mention";
case MSTDNT_NOTIFICATION_REPORT: return "report";
case MSTDNT_NOTIFICATION_NOOP:
default:
return "unknown";
}
}