Chat-O-Matic/application/CayaUtils.h
Jaidyn Ann dc3fdd65c8 Store chatlogs in binary and text formats
If chat logs are stored in an endless plain-text file, they're going to be a
pain to parse. If they're stored in a binary file, they're a pain for
the user to `grep` or go through manually, but they're easier to parse.

Why not both?

Logs are now stored with a BMessage (with BStringLists) in the 'logs'
attribute, and the plain-text logs in the file itself.

The attribute will only store 20 messages, but the file itself will be
appended to forever.

The logs directory also changed, from ~/config/settings/Caya/Cache/Logs
to ~/config/settings/Caya/Logs.

Useful functions for reading/writing messages to and from an attribute were
borrowed from BePodder's libfunky. :-)
2021-06-06 12:02:26 -05:00

39 lines
1.0 KiB
C

/*
* Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _CAYA_UTILS_H
#define _CAYA_UTILS_H
#include <image.h>
#include <GraphicsDefs.h>
#include <Mime.h>
#include <Resources.h>
#include "CayaConstants.h"
const char* CayaStatusToString(CayaStatus status);
BResources* CayaResources();
const char* CayaAccountsPath();
const char* CayaAccountPath(const char* signature);
const char* CayaAccountPath(const char* signature, const char* subsignature);
const char* CayaCachePath();
const char* CayaLogPath(const char* signature, const char* subsignature);
rgb_color CayaTintColor(rgb_color color, int severity);
// Borrowed from BePodder's own libfunky
status_t ReadAttributeData(BNode* node, const char* name, char** buffer, int32 *size);
status_t WriteAttributeMessage(BNode* node, const char* name, BMessage* data);
status_t ReadAttributeMessage(BNode* node, const char* name, BMessage* data);
extern "C" status_t our_image(image_info& image);
#endif // _CAYA_UTILS_H