json_item *get_json_object_channel(CHANNEL *chan) { json_item *jstr = json_new_object(); json_set_property_strN(jstr, "casttype", 8, "multi", 5); json_set_property_strN(jstr, "pubid", 5, chan->pipe->pubid, 32); json_item *jprop = json_new_object(); json_set_property_strZ(jprop, "name", chan->name); extend *eTmp = chan->properties; while (eTmp != NULL) { if (eTmp->visibility == EXTEND_ISPUBLIC) { if (eTmp->type == EXTEND_JSON) { /*json *jcopy = json_copy(eTmp->val); set_json(eTmp->key, NULL, &jprop); json_attach(jprop, jcopy, JSON_OBJECT);*/ } else { json_set_property_strZ(jprop, eTmp->key, eTmp->val); } } eTmp = eTmp->next; } json_set_property_objN(jstr, "properties", 10, jprop); //} return jstr; }
void subuser_restor(subuser *sub, acetables *g_ape) { CHANLIST *chanl; CHANNEL *chan; json_item *jlist; RAW *newraw; USERS *user = sub->user; userslist *ulist; chanl = user->chan_foot; while (chanl != NULL) { chan = chanl->chaninfo; /* * quiet channel won't be posted on subuser_restor */ if (!(chan->flags & CHANNEL_QUIET)) { jlist = json_new_object(); if ( !(chan->flags & CHANNEL_NONINTERACTIVE) && chan->head != NULL ) { json_item *user_list = json_new_array(); ulist = chan->head; while (ulist != NULL) { json_item *juser = get_json_object_user(ulist->userinfo); if (ulist->userinfo != user) { //make_link(user, ulist->userinfo); } json_set_property_intN(juser, "level", 5, ulist->level); json_set_element_obj(user_list, juser); ulist = ulist->next; } json_set_property_objN(jlist, "users", 5, user_list); } json_set_property_objN(jlist, "pipe", 4, get_json_object_channel(chan)); newraw = forge_raw(RAW_CHANNEL, jlist); newraw->priority = RAW_PRI_HI; post_raw_sub(newraw, sub, g_ape); POSTRAW_DONE(newraw); } chanl = chanl->next; } jlist = json_new_object(); json_set_property_objN(jlist, "user", 4, get_json_object_user(user)); newraw = forge_raw("IDENT", jlist); newraw->priority = RAW_PRI_HI; post_raw_sub(newraw, sub, g_ape); POSTRAW_DONE(newraw); }
/*! @brief Responsible for emitting the list of modules for the project. */ void veridoc_pf_export_module_list_json( verilog_source_tree * source, json_file * fh ){ json_object * top = json_new_object(); json_object_add_string(top,"listType","module-manifest"); json_object_add_string(top,"listTitle","List of documented modules."); json_object_add_string(top,"listNotes","This is the list of all hardware modules declared in the source code."); json_object * list = json_new_object(); unsigned int i; for(i = 0; i < source -> modules -> items; i ++) { ast_module_declaration * module = ast_list_get(source -> modules,i); char * identifier = ast_identifier_tostring(module -> identifier); json_object * toadd = json_new_object(); json_object_add_string(toadd, "id", identifier); json_object_add_string(toadd, "brief", "None"); json_object_add_string(toadd, "file", module -> meta.file); json_object_add_int (toadd, "line", module -> meta.line); json_object_add_object(list, "", toadd); } json_object_add_list(top,"listData", list); json_emit_object(fh, top, "veridocModuleList", 0); }
/*! @brief Responsible for exporting the list of parsed files to a json data file. @param [in] manifest - The list of files. @param [in] destination - The JSON file to write to. @returns Void */ void veridoc_pf_export_file_list_json( veridoc_manifest * manifest, json_file * fh ){ json_object * top = json_new_object(); json_object_add_string(top,"listType","file-manifest"); json_object_add_string(top,"listTitle","List of documented files."); json_object_add_string(top,"listNotes","This is the list of all files specified as input to Veridoc, along with their parse status."); json_object * list = json_new_object(); unsigned int i; for(i = 0; i < manifest -> file_count; i ++){ veridoc_manifest_file f = manifest -> files[i]; json_object * toadd = json_new_object(); json_object_add_string(toadd, "path", f.path); json_object_add_int(toadd, "parsed", f.parsed); json_object_add_int(toadd, "success", f.parse_success); json_object_add_object(list, "", toadd); } json_object_add_list(top,"listData", list); json_emit_object(fh, top, "veridocFileList", 0); }
int MapArchiveSave(const char *filename, CampaignSetting *c) { int res = 1; json_t *root = NULL; char relbuf[CDOGS_PATH_MAX]; if (strcmp(StrGetFileExt(filename), "cdogscpn") == 0 || strcmp(StrGetFileExt(filename), "CDOGSCPN") == 0) { strcpy(relbuf, filename); } else { sprintf(relbuf, "%s.cdogscpn", filename); } char buf[CDOGS_PATH_MAX]; RealPath(relbuf, buf); // Make dir but ignore error, as we may be saving over an existing dir mkdir_deep(buf); // Campaign root = json_new_object(); AddIntPair(root, "Version", MAP_VERSION); AddStringPair(root, "Title", c->Title); AddStringPair(root, "Author", c->Author); AddStringPair(root, "Description", c->Description); AddIntPair(root, "Missions", c->Missions.size); char buf2[CDOGS_PATH_MAX]; sprintf(buf2, "%s/campaign.json", buf); if (!TrySaveJSONFile(root, buf2)) { res = 0; goto bail; } json_free_value(&root); root = json_new_object(); json_insert_pair_into_object(root, "Missions", SaveMissions(&c->Missions)); sprintf(buf2, "%s/missions.json", buf); if (!TrySaveJSONFile(root, buf2)) { res = 0; goto bail; } json_free_value(&root); root = json_new_object(); json_insert_pair_into_object( root, "Characters", SaveCharacters(&c->characters)); sprintf(buf2, "%s/characters.json", buf); if (!TrySaveJSONFile(root, buf2)) { res = 0; goto bail; } bail: json_free_value(&root); return res; }
unsigned int cmd_connect(callbackp *callbacki) { USERS *nuser; RAW *newraw; json_item *jstr = NULL; nuser = adduser(NULL, NULL, NULL, callbacki->call_user, callbacki->g_ape); callbacki->call_user = nuser; jstr = json_new_object(); json_set_property_objN(jstr, "user", 4, get_json_object_user(callbacki->call_user)); newraw = forge_raw("IDENT", jstr); newraw->priority = RAW_PRI_HI; post_raw_sub(newraw, callbacki->call_subuser, callbacki->g_ape); jstr = json_new_object(); json_set_property_strN(jstr, "sessid", 6, nuser->sessid, 32); newraw = forge_raw(RAW_LOGIN, jstr); newraw->priority = RAW_PRI_HI; post_raw(newraw, nuser, callbacki->g_ape); return (RETURN_NOTHING); }
int dbrelay_db_fill_data(json_t *json, dbrelay_connection_t *conn) { int numcols, colnum; char tmp[256]; int maxcolname; json_add_key(json, "data"); json_new_array(json); while (api->has_results(conn->db)) { maxcolname = 0; json_new_object(json); json_add_key(json, "fields"); json_new_array(json); numcols = api->numcols(conn->db); for (colnum=1; colnum<=numcols; colnum++) { dbrelay_write_json_colinfo(json, conn->db, colnum, &maxcolname); } json_end_array(json); json_add_key(json, "rows"); if (json_get_mode(json)==DBRELAY_JSON_MODE_STD) json_new_array(json); else json_add_json(json, "\""); while (api->fetch_row(conn->db)) { maxcolname = 0; if (json_get_mode(json)==DBRELAY_JSON_MODE_STD) json_new_object(json); for (colnum=1; colnum<=numcols; colnum++) { dbrelay_write_json_column(json, conn->db, colnum, &maxcolname); if (json_get_mode(json)==DBRELAY_JSON_MODE_CSV && colnum!=numcols) json_add_json(json, ","); } if (json_get_mode(json)==DBRELAY_JSON_MODE_STD) json_end_object(json); else json_add_json(json, "\\n"); } if (json_get_mode(json)==DBRELAY_JSON_MODE_STD) json_end_array(json); else json_add_json(json, "\","); if (api->rowcount(conn->db)==-1) { json_add_null(json, "count"); } else { sprintf(tmp, "%d", api->rowcount(conn->db)); json_add_number(json, "count", tmp); } json_end_object(json); } /* sprintf(error_string, "rc = %d", rc); */ json_end_array(json); return 0; }
// TODO : Rewrite this f***g ugly function unsigned int setlevel(USERS *user_actif, USERS *user_passif, CHANNEL *chan, unsigned int lvl, acetables *g_ape) { RAW *newraw; userslist *user_passif_chan, *user_actif_chan; json_item *jlist; user_passif_chan = getuchan(user_passif, chan); if (user_actif != NULL) { user_actif_chan = getuchan(user_actif, chan); if (user_passif_chan == NULL || user_actif_chan == NULL || ((user_actif_chan->level < lvl || user_actif_chan->level < user_passif_chan->level) && !(user_actif->flags & FLG_AUTOOP)) || lvl < 1 || lvl > 32) { send_error(user_actif, "SETLEVEL_ERROR", "110", g_ape); return 0; } user_passif_chan->level = lvl; if (chan->interactive) { jlist = json_new_object(); json_set_property_objN(jlist, "ope", 3, get_json_object_user(user_passif)); json_set_property_objN(jlist, "oper", 4, get_json_object_user(user_actif)); json_set_property_objN(jlist, "pipe", 4, get_json_object_channel(chan)); json_set_property_intN(jlist, "level", 5, lvl); newraw = forge_raw(RAW_SETLEVEL, jlist); post_raw_channel(newraw, chan, g_ape); } return 1; } else if (user_passif_chan != NULL && lvl > 0 && lvl < 32) { user_passif_chan->level = lvl; if (chan->interactive) { jlist = json_new_object(); json_set_property_objN(jlist, "ope", 3, get_json_object_user(user_passif)); json_set_property_objN(jlist, "oper", 4, get_json_object_user(NULL)); json_set_property_objN(jlist, "pipe", 4, get_json_object_channel(chan)); json_set_property_intN(jlist, "level", 5, lvl); newraw = forge_raw(RAW_SETLEVEL, jlist); post_raw_channel(newraw, chan, g_ape); } return 1; } return 0; }
bool jps_method(LSHandle* lshandle, LSMessage *message, void *ctx) { bool returnVal = true; char line[MAXLINELEN]; // %%% MAGIC NUMBERS ALERT %%% char name[128]; LSError lserror; LSErrorInit(&lserror); char *jsonResponse = 0; int len = 0; json_t *response = json_new_object(); FILE *fp = popen("/usr/bin/jps", "r"); if (fp) { json_t *array = json_new_array(); // Skip the first line (void)fgets( line, sizeof line, fp); while ( fgets( line, sizeof line, fp)) { if (sscanf(line, "%*d %*d %*d %*d %*d %*d %*d %127c", (char*)&name) == 1) { // %%% HACK ALERT %%% *strchr(name,'\n') = 0; json_t *object = json_new_object(); // %%% IGNORING RETURN ALERT %%% json_insert_pair_into_object(object, "name", json_new_string(name)); json_insert_child(array, object); } } if (!pclose(fp)) { // %%% IGNORING RETURN ALERT %%% json_insert_pair_into_object(response, "returnValue", json_new_true()); json_insert_pair_into_object(response, "threads", array); json_tree_to_string(response, &jsonResponse); } } if (jsonResponse) { LSMessageReply(lshandle, message, jsonResponse, &lserror); free(jsonResponse); } else LSMessageReply(lshandle, message, "{\"returnValue\":false,\"errorCode\":-1,\"errorText\":\"Generic error\"}", &lserror); json_free_value(&response); LSErrorFree(&lserror); return returnVal; }
void ScriptDialog::saveJson() { json_t *root = json_new_object(); json_t *t; t = json_new_number((const char*)m_id.toLatin1()); json_insert_pair_into_object(root, "id", t); t = json_new_string((const char*)m_title.toLocal8Bit()); json_insert_pair_into_object(root, "title", t); t = json_new_string((const char*)m_url.toLocal8Bit()); json_insert_pair_into_object(root, "url", t); json_t *seqNode = json_new_array(); for(int i=0, len=m_stepSeq.size(); i<len; ++i){ QString s = m_stepSeq.at(i); json_t *v = json_new_string((const char*)s.toLocal8Bit()); json_insert_child(seqNode, v); } json_t *stepsNode = json_new_object(); json_insert_pair_into_object(stepsNode, "seq", seqNode); QMapIterator<QString, QString> iter(m_steps); while(iter.hasNext()){ iter.next(); if(iter.value().isEmpty())continue; QByteArray ba_k = iter.key().toLocal8Bit(); const char *k = (const char*)ba_k; QByteArray ba_v = iter.value().toLocal8Bit(); char *v = ba_v.data(); QByteArray ba_t = m_stepTests.value(iter.key()).toLocal8Bit(); char *t = ba_t.data(); v = json_escape(v); t = json_escape(t); json_t *vn = json_new_string( v ); json_t *tn = json_new_string( t ); json_t *step = json_new_object(); json_insert_pair_into_object(step, "test", tn); json_insert_pair_into_object(step, "script", vn); json_insert_pair_into_object(stepsNode, k, step); } json_insert_pair_into_object(root, "steps", stepsNode); BatDownUtils::writeJsonToFile(root, m_fn); }
static json_t *SaveCharacters(CharacterStore *s) { json_t *charNode = json_new_array(); int i; for (i = 0; i < (int)s->OtherChars.size; i++) { json_t *node = json_new_object(); Character *c = CArrayGet(&s->OtherChars, i); AddIntPair(node, "face", c->looks.Face); AddIntPair(node, "skin", c->looks.Skin); AddIntPair(node, "arm", c->looks.Arm); AddIntPair(node, "body", c->looks.Body); AddIntPair(node, "leg", c->looks.Leg); AddIntPair(node, "hair", c->looks.Hair); AddIntPair(node, "speed", c->speed); json_insert_pair_into_object( node, "Gun", json_new_string(c->Gun->name)); AddIntPair(node, "maxHealth", c->maxHealth); AddIntPair(node, "flags", c->flags); AddIntPair(node, "probabilityToMove", c->bot->probabilityToMove); AddIntPair(node, "probabilityToTrack", c->bot->probabilityToTrack); AddIntPair(node, "probabilityToShoot", c->bot->probabilityToShoot); AddIntPair(node, "actionDelay", c->bot->actionDelay); json_insert_child(charNode, node); } return charNode; }
static void AddQuickPlayConfigNode(QuickPlayConfig *config, json_t *root) { json_t *subConfig = json_new_object(); json_insert_pair_into_object( subConfig, "MapSize", json_new_string(QuickPlayQuantityStr(config->MapSize))); json_insert_pair_into_object( subConfig, "WallCount", json_new_string(QuickPlayQuantityStr(config->WallCount))); json_insert_pair_into_object( subConfig, "WallLength", json_new_string(QuickPlayQuantityStr(config->WallLength))); json_insert_pair_into_object( subConfig, "RoomCount", json_new_string(QuickPlayQuantityStr(config->RoomCount))); json_insert_pair_into_object( subConfig, "SquareCount", json_new_string(QuickPlayQuantityStr(config->SquareCount))); json_insert_pair_into_object( subConfig, "EnemyCount", json_new_string(QuickPlayQuantityStr(config->EnemyCount))); json_insert_pair_into_object( subConfig, "EnemySpeed", json_new_string(QuickPlayQuantityStr(config->EnemySpeed))); json_insert_pair_into_object( subConfig, "EnemyHealth", json_new_string(QuickPlayQuantityStr(config->EnemyHealth))); json_insert_pair_into_object( subConfig, "EnemiesWithExplosives", json_new_bool(config->EnemiesWithExplosives)); json_insert_pair_into_object( subConfig, "ItemCount", json_new_string(QuickPlayQuantityStr(config->ItemCount))); json_insert_pair_into_object(root, "QuickPlay", subConfig); }
void ConfigSaveJSON(const Config *config, const char *filename) { FILE *f = fopen(filename, "w"); char *text = NULL; json_t *root; if (f == NULL) { printf("Error saving config '%s'\n", filename); return; } setlocale(LC_ALL, ""); root = json_new_object(); json_insert_pair_into_object(root, "Version", json_new_number(VERSION)); ConfigSaveVisit(config, root); json_tree_to_string(root, &text); char *formatText = json_format_string(text); fputs(formatText, f); // clean up CFREE(formatText); CFREE(text); json_free_value(&root); fclose(f); }
void AutosaveSave(Autosave *autosave, const char *filename) { FILE *f = fopen(filename, "w"); char *text = NULL; json_t *root; if (f == NULL) { printf("Error saving autosave '%s'\n", filename); return; } setlocale(LC_ALL, ""); root = json_new_object(); json_insert_pair_into_object(root, "Version", json_new_number("2")); json_insert_pair_into_object( root, "LastMission", CreateMissionNode(&autosave->LastMission)); AddMissionNodes(autosave, root, "Missions"); json_tree_to_string(root, &text); char *formatText = json_format_string(text); fputs(formatText, f); // clean up free(formatText); free(text); json_free_value(&root); fclose(f); }
RAW *forge_raw(const char *raw, json_item *jlist) { RAW *new_raw; char unixtime[16]; struct jsontring *string; json_item *jstruct = NULL; sprintf(unixtime, "%li", time(NULL)); jstruct = json_new_object(); json_set_property_strN(jstruct, "time", 4, unixtime, strlen(unixtime)); json_set_property_strN(jstruct, "raw", 3, raw, strlen(raw)); json_set_property_objN(jstruct, "data", 4, jlist); string = json_to_string(jstruct, NULL, 1); new_raw = xmalloc(sizeof(*new_raw)); new_raw->len = string->len; new_raw->next = NULL; new_raw->priority = RAW_PRI_LO; new_raw->refcount = 0; new_raw->data = string->jstring; free(string); return new_raw; }
static void AddGameConfigNode(GameConfig *config, json_t *root) { char buf[32]; json_t *subConfig = json_new_object(); json_insert_pair_into_object( subConfig, "FriendlyFire", json_new_bool(config->FriendlyFire)); sprintf(buf, "%u", config->RandomSeed); json_insert_pair_into_object( subConfig, "RandomSeed", json_new_number(buf)); JSON_UTILS_ADD_ENUM_PAIR(subConfig, "Difficulty", config->Difficulty, DifficultyStr); json_insert_pair_into_object( subConfig, "SlowMotion", json_new_bool(config->SlowMotion)); AddIntPair(subConfig, "EnemyDensity", config->EnemyDensity); AddIntPair(subConfig, "NonPlayerHP", config->NonPlayerHP); AddIntPair(subConfig, "PlayerHP", config->PlayerHP); json_insert_pair_into_object( subConfig, "Fog", json_new_bool(config->Fog)); AddIntPair(subConfig, "SightRange", config->SightRange); json_insert_pair_into_object( subConfig, "Shadows", json_new_bool(config->Shadows)); json_insert_pair_into_object( subConfig, "MoveWhenShooting", json_new_bool(config->MoveWhenShooting)); JSON_UTILS_ADD_ENUM_PAIR( subConfig, "SwitchMoveStyle", config->SwitchMoveStyle, SwitchMoveStyleStr); json_insert_pair_into_object( subConfig, "ShotsPushback", json_new_bool(config->ShotsPushback)); JSON_UTILS_ADD_ENUM_PAIR( subConfig, "AllyCollision", config->AllyCollision, AllyCollisionStr); json_insert_pair_into_object( subConfig, "HealthPickups", json_new_bool(config->HealthPickups)); json_insert_pair_into_object(root, "Game", subConfig); }
void ConfigSaveJSON(Config *config, const char *filename) { FILE *f = fopen(filename, "w"); char *text = NULL; json_t *root; if (f == NULL) { printf("Error saving config '%s'\n", filename); return; } setlocale(LC_ALL, ""); root = json_new_object(); json_insert_pair_into_object(root, "Version", json_new_number(VERSION)); AddGameConfigNode(&config->Game, root); AddGraphicsConfigNode(&config->Graphics, root); AddInputConfigNode(&config->Input, root); AddInterfaceConfigNode(&config->Interface, root); AddSoundConfigNode(&config->Sound, root); AddQuickPlayConfigNode(&config->QuickPlay, root); json_tree_to_string(root, &text); char *formatText = json_format_string(text); fputs(formatText, f); // clean up CFREE(formatText); CFREE(text); json_free_value(&root); fclose(f); }
int entryTest(void) { printf("%s", "====== Entry Test Starts =======\n"); setlocale (LC_ALL, ""); json_t *root, *subtree; // creates the root node root = json_new_object(); // creates the desired MJSON document subtree subtree = new_entry("Andrew", "555 123 456"); // inserts the subtree into the root object json_insert_child(root, subtree); // print the result char *text; json_tree_to_string(root, &text); printf("%s\n", text); // clean up free(text); json_free_value(&root); printf("%s", "====== Entry Test Ends =======\n"); return EXIT_SUCCESS; }
static json_t *SaveClassicDoors(Mission *m) { json_t *node = json_new_object(); AddBoolPair(node, "Enabled", m->u.Classic.Doors.Enabled); AddIntPair(node, "Min", m->u.Classic.Doors.Min); AddIntPair(node, "Max", m->u.Classic.Doors.Max); return node; }
static json_t *CreateMissionNode(MissionSave *m) { json_t *subConfig = json_new_object(); AddCampaignNode(&m->Campaign, subConfig); json_insert_pair_into_object(subConfig, "Password", json_new_string(m->Password)); AddIntPair(subConfig, "MissionsCompleted", m->MissionsCompleted); return subConfig; }
static json_t *SaveClassicPillars(Mission *m) { json_t *node = json_new_object(); AddIntPair(node, "Count", m->u.Classic.Pillars.Count); AddIntPair(node, "Min", m->u.Classic.Pillars.Min); AddIntPair(node, "Max", m->u.Classic.Pillars.Max); return node; }
int basicTest() { printf("%s", "====== basic JSon Test Starts =======\n"); char *text; json_t *root, *entry, *label, *value; setlocale (LC_ALL, ""); // creates the root node root = json_new_object(); // create an entry node entry = json_new_object(); // insert the first label-value pair label = json_new_string("name"); value = json_new_string("Andew"); json_insert_child(label, value); json_insert_child(entry, label); // insert the second label-value pair label = json_new_string("phone"); value = json_new_string("555 123 456"); json_insert_child(label, value); json_insert_child(entry, label); // inserts that object as a value in a label-value pair label = json_new_string("entry"); json_insert_child(label, entry); // inserts that label-value pair into the root object json_insert_child(root, label); // print the result json_tree_to_string(root, &text); printf("%s\n",text); // clean up free(text); json_free_value(&root); printf("%s", "====== basic JSon Test Ends =======\n"); return EXIT_SUCCESS; }
json_item *get_json_object_user(USERS *user) { json_item *jstr = NULL; if (user != NULL) { jstr = json_new_object(); json_set_property_strN(jstr, "casttype", 8, "uni", 3); json_set_property_strN(jstr, "pubid", 5, user->pipe->pubid, 32); if (user->properties != NULL) { int has_prop = 0; json_item *jprop = NULL; extend *eTmp = user->properties; while (eTmp != NULL) { if (eTmp->visibility == EXTEND_ISPUBLIC) { if (!has_prop) { has_prop = 1; jprop = json_new_object(); } if (eTmp->type == EXTEND_JSON) { json_item *jcopy = json_item_copy(eTmp->val, NULL); json_set_property_objZ(jprop, eTmp->key, jcopy); } else { json_set_property_strZ(jprop, eTmp->key, eTmp->val); } } eTmp = eTmp->next; } if (has_prop) { json_set_property_objN(jstr, "properties", 10, jprop); } } } else { json_set_property_strZ(jstr, "pubid", SERVER_NAME); } return jstr; }
static void AddCampaignNode(CampaignEntry *c, json_t *root) { json_t *subConfig = json_new_object(); // Save relative path so that save files are portable across installs char path[CDOGS_PATH_MAX] = ""; RelPathFromCWD(path, c->Path); json_insert_pair_into_object( subConfig, "Path", json_new_string(path)); json_insert_pair_into_object(root, "Campaign", subConfig); }
static void dbrelay_write_json_log(json_t *json, dbrelay_request_t *request, char *error_string) { json_add_key(json, "log"); json_new_object(json); if (request->sql) json_add_string(json, "sql", request->sql); json_add_string(json, "error", error_string); json_end_object(json); json_end_object(json); }
void dbrelay_db_restart_json(dbrelay_request_t *request, json_t **json) { if (IS_SET(request->js_error)) { // free json handle and start over json_free(*json); *json = json_new(); json_add_callback(*json, request->js_error); json_new_object(*json); dbrelay_append_request_json(*json, request); } }
void send_msg_channel(CHANNEL *chan, const char *msg, const char *type, acetables *g_ape) { RAW *newraw; json_item *jlist = json_new_object(); json_set_property_strZ(jlist, "value", msg); newraw = forge_raw(type, jlist); post_raw_channel(newraw, chan, g_ape); }
void send_msg_sub(subuser *sub, const char *msg, const char *type, acetables *g_ape) { RAW *newraw; json_item *jlist = json_new_object(); json_set_property_strZ(jlist, "value", msg); newraw = forge_raw(type, jlist); post_raw_sub(newraw, sub, g_ape); }
void send_msg(USERS *user, const char *msg, const char *type, acetables *g_ape) { RAW *newraw; json_item *jlist = json_new_object(); json_set_property_strZ(jlist, "value", msg); newraw = forge_raw(type, jlist); post_raw(newraw, user, g_ape); POSTRAW_DONE(newraw); }
static void AddInputConfigNode(InputConfig *config, json_t *root) { int i; json_t *subConfig = json_new_object(); json_t *keyConfigs = json_new_array(); for (i = 0; i < 2; i++) { AddKeyConfigNode(&config->PlayerKeys[i], keyConfigs); } json_insert_pair_into_object(subConfig, "Keys", keyConfigs); json_insert_pair_into_object(root, "Input", subConfig); }