23 行
675 B
C
23 行
675 B
C
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <weechat/weechat-plugin.h>
|
|
|
|
#include "commands.h"
|
|
|
|
struct t_config_file *chatwork_config_file = NULL;
|
|
struct t_config_option *chatwork_config_token = NULL;
|
|
struct t_weechat_plugin *weechat_plugin = NULL;
|
|
|
|
size_t WriteCallback (void* contents, size_t size, size_t nmemb, void* userp) {
|
|
size_t totalSize = size * nmemb;
|
|
Buffer *buffer = (Buffer *)userp;
|
|
char *temp = realloc(buffer->data, buffer->size + totalSize + 1);
|
|
if (temp == NULL) return 0;
|
|
buffer->data = temp;
|
|
memcpy(buffer->data + buffer->size, contents, totalSize);
|
|
buffer->size += totalSize;
|
|
buffer->data[buffer->size] = '\0';
|
|
return totalSize;
|
|
}
|