2020-05-12 15:21:16 +02:00
|
|
|
#ifndef _FORMAT_H
|
|
|
|
#define _FORMAT_H
|
|
|
|
|
|
|
|
#include <string>
|
2021-12-06 19:56:53 +01:00
|
|
|
#include <purple.h>
|
2020-07-06 03:16:58 +02:00
|
|
|
#include "translate.h"
|
2021-12-06 19:56:53 +01:00
|
|
|
#include "config.h"
|
2020-05-12 15:21:16 +02:00
|
|
|
|
|
|
|
std::string formatMessage(const char *fmt, std::initializer_list<std::string> args);
|
|
|
|
std::string formatMessage(const char *fmt, const std::string &s);
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
std::string formatMessage(const char *fmt, T arg)
|
|
|
|
{
|
|
|
|
return formatMessage(fmt, {std::to_string(arg)});
|
|
|
|
}
|
|
|
|
|
2020-08-20 18:25:28 +02:00
|
|
|
std::string formatDuration(int32_t seconds);
|
|
|
|
|
2021-12-06 19:56:53 +01:00
|
|
|
void purpleDebug(const char *fmt, std::initializer_list<std::string> args);
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
void purpleDebug(const char *fmt, T arg)
|
|
|
|
{
|
|
|
|
std::string message = formatMessage(fmt, arg);
|
|
|
|
purple_debug_misc(config::pluginId, "%s\n", message.c_str());
|
|
|
|
}
|
|
|
|
|
2020-05-15 02:01:11 +02:00
|
|
|
#endif
|