void SearchRequest::element_start(const char *el, const char **attr) { if (!strcmp(el, "item")){ free_data(jabberSearchData, &data); load_data(jabberSearchData, &data, NULL); m_data = JabberClient::get_attr("jid", attr); set_str(&data.JID, m_data.c_str()); } m_data = ""; }
void print_mode_name(int x, int y, Object * obj, char *mode) { char buf[64]; sprintf(buf, "[%s]", mode); int len = strlen(buf); int pad = 16 - len; if (pad < 0) buf[15] = 0; set_str((CHAR_INFO *) screen_buffer, buf, x, y, 0, 15); }
JabberClient::PresenceRequest::~PresenceRequest() { unsigned status = STATUS_UNKNOWN; if (m_type == "unavailable"){ status = STATUS_OFFLINE; }else if (m_type.length() == 0){ status = STATUS_ONLINE; if (m_show == "away"){ status = STATUS_AWAY; }else if (m_show == "xa"){ status = STATUS_NA; }else if (m_show == "dnd"){ status = STATUS_DND; } }else{ if (m_type == "subscribe"){ m_client->auth_request(m_from.c_str(), MessageAuthRequest, m_status.c_str(), true); }else if (m_type == "subscribed"){ m_client->auth_request(m_from.c_str(), MessageAuthGranted, m_status.c_str(), true); }else if (m_type == "unsubscribed"){ m_client->auth_request(m_from.c_str(), MessageRemoved, m_status.c_str(), true); }else{ log(L_DEBUG, "Unsupported presence type %s", m_type.c_str()); } } if (status != STATUS_UNKNOWN){ Contact *contact; JabberUserData *data = m_client->findContact(m_from.c_str(), NULL, NULL, false, contact); if (data){ bool bOnLine = false; bool bChanged = set_str(&data->AutoReply, m_status.c_str()); if (data->Status != status){ time_t now; time(&now); bChanged = true; if ((status == STATUS_ONLINE) && ((now - m_client->data.owner.OnlineTime > 60) || (data->Status != STATUS_OFFLINE))) bOnLine = true; if (data->Status == STATUS_OFFLINE) data->OnlineTime = now; data->Status = status; data->StatusTime = now; } if (bChanged){ Event e(EventStatusChanged, contact); e.process(); } if (bOnLine){ Event e(EventContactOnline, contact); e.process(); } } } }
int node_requestid( pbs_attribute *new_attr, /*derive state into this pbs_attribute*/ void *pnode, /*pointer to a pbsnode struct */ int actmode) /*action mode; "NEW" or "ALTER" */ { int rc = 0; struct pbsnode *np = (struct pbsnode*)pnode; /*because of def of at_action args*/ pbs_attribute temp; switch (actmode) { case ATR_ACTION_NEW: if(np->nd_requestid->size() != 0) { temp.at_val.at_str = (char *)np->nd_requestid->c_str(); temp.at_flags = ATR_VFLAG_SET; temp.at_type = ATR_TYPE_STR; rc = set_str(new_attr, &temp, SET); } else { new_attr->at_val.at_str = NULL; new_attr->at_flags = 0; new_attr->at_type = ATR_TYPE_STR; } break; case ATR_ACTION_ALTER: if(new_attr->at_val.at_str != NULL) { *np->nd_requestid = new_attr->at_val.at_str; } else { np->nd_requestid->clear(); } break; default: rc = PBSE_INTERNAL; break; } return(rc); }
void ICQClient::setAIMInfo(ICQUserData *data) { if (getState() != Connected) return; bool bWide = isWide(data->FirstName.ptr) || isWide(data->LastName.ptr) || isWide(data->MiddleName.ptr) || isWide(data->Maiden.ptr) || isWide(data->Nick.ptr) || isWide(data->Zip.ptr) || isWide(data->Address.ptr) || isWide(data->City.ptr); string country; for (const ext_info *e = getCountryCodes(); e->szName; e++){ if (e->nCode == data->Country.value){ country = e->szName; break; } } snac(ICQ_SNACxFAM_LOCATION, ICQ_SNACxLOC_SETxDIRxINFO); string encoding = bWide ? "unicode-2-0" : "us-ascii"; m_socket->writeBuffer.tlv(0x1C, encoding.c_str()); m_socket->writeBuffer.tlv(0x0A, (unsigned short)0x01); encodeString(data->FirstName.ptr, 0x01, bWide); encodeString(data->LastName.ptr, 0x02, bWide); encodeString(data->MiddleName.ptr, 0x03, bWide); encodeString(data->Maiden.ptr, 0x04, bWide); encodeString(country.c_str(), 0x06, bWide); encodeString(data->Address.ptr, 0x07, bWide); encodeString(data->City.ptr, 0x08, bWide); encodeString(data->Nick.ptr, 0x0C, bWide); encodeString(data->Zip.ptr, 0x0D, bWide); encodeString(data->State.ptr, 0x21, bWide); sendPacket(false); ICQUserData *ownerData = &this->data.owner; set_str(&ownerData->FirstName.ptr, data->FirstName.ptr); set_str(&ownerData->LastName.ptr, data->LastName.ptr); set_str(&ownerData->MiddleName.ptr, data->MiddleName.ptr); set_str(&ownerData->Maiden.ptr, data->Maiden.ptr); set_str(&ownerData->Address.ptr, data->Address.ptr); set_str(&ownerData->City.ptr, data->City.ptr); set_str(&ownerData->Nick.ptr, data->Nick.ptr); set_str(&ownerData->Zip.ptr, data->Zip.ptr); set_str(&ownerData->State.ptr, data->State.ptr); ownerData->Country.value = data->Country.value; }
int draw_examine(int display_x, int display_y, World * w, int x, int y, Object * exclude) { Object *obj = obj_at(w, x, y, exclude); if (obj == 0) return 0; set_str((CHAR_INFO *) screen_buffer, obj->type, display_x, display_y, 0, obj->shape.fg_color); return 1; }
void SoundUserConfig::apply(void *data) { SoundUserData *user_data = (SoundUserData*)data; set_str(&user_data->Alert, QFile::encodeName(edtAlert->text())); CommandDef *cmd; CommandsMapIterator it(m_plugin->core->messageTypes); while ((cmd = ++it) != NULL){ MessageDef *def = (MessageDef*)(cmd->param); if (def->base_type) continue; MAP_SOUND::iterator it = m_sounds.find(cmd->id); if (it == m_sounds.end()) continue; EditSound *snd = (*it).second; QString text = snd->text(); if (text.isEmpty()) text = "-"; set_str(&user_data->Receive, cmd->id, QFile::encodeName(text)); } }
static void output_control(void) { int i; gpio_line_config(GPIO_SCL, IXP4XX_GPIO_OUT); gpio_line_config(GPIO_SDA, IXP4XX_GPIO_OUT); for (i = 0; i < 8; i++) { set_scl(0); set_sda(control_value & (0x80 >> i)); /* MSB first */ set_scl(1); /* active edge */ } set_str(1); set_str(0); set_scl(0); set_sda(1); /* Be ready for START */ set_scl(1); }
void SearchInfoRequest::element_start(const char *el, const char **attr) { if (!strcmp(el, "field")){ free_data(jabberSearchInfo, &data); load_data(jabberSearchInfo, &data, NULL); set_str(&data.ID, m_jid.c_str()); m_data = JabberClient::get_attr("var", attr); set_str(&data.Field, m_data.c_str()); m_data = JabberClient::get_attr("type", attr); set_str(&data.Type, m_data.c_str()); m_data = JabberClient::get_attr("label", attr); set_str(&data.Label, m_data.c_str()); } if (!strcmp(el, "option")){ m_bOption = true; m_data = JabberClient::get_attr("label", attr); set_str(&data.OptionLabels, data.nOptions, m_data.c_str()); } m_data = ""; }
static void output_control(void) { int i; gpio_line_config(GPIO_SCL, IXP4XX_GPIO_OUT); gpio_line_config(GPIO_SDA, IXP4XX_GPIO_OUT); for (i = 0; i < 8; i++) { set_scl(0); set_sda(control_value & (0x80 >> i)); /* */ set_scl(1); /* */ } set_str(1); set_str(0); set_scl(0); set_sda(1); /* */ set_scl(1); }
void FileConfig::apply(void *_data) { CoreUserData *data = (CoreUserData*)_data; QString def; if (edtPath->text().isEmpty()) { def = "Incoming Files"; } else { def = edtPath->text(); } set_str(&data->IncomingPath.ptr, QFile::encodeName(def)); edtPath->setText(QFile::decodeName(data->IncomingPath.ptr ? user_file(data->IncomingPath.ptr).c_str() : "")); data->AcceptMode.value = 0; if (btnAccept->isOn()){ data->AcceptMode.value = 1; data->OverwriteFiles.bValue = chkOverwrite->isChecked(); } if (btnDecline->isOn()){ data->AcceptMode.value = 2; set_str(&data->DeclineMessage.ptr, edtDecline->text().utf8()); } }
void SearchInfoRequest::element_end(const char *el) { if (!strcmp(el, "field")){ if (data.Field && *data.Field){ set_str(&data.VHost, m_client->data.owner.VHost); Event e(static_cast<JabberPlugin*>(m_client->protocol()->plugin())->EventSearchInfo, &data); e.process(); } }else if (!strcmp(el, "option")){ m_bOption = false; const char *str = get_str(data.Options, data.nOptions); if (str && *str) data.nOptions++; }else if (!strcmp(el, "value")){ if (m_bOption){ set_str(&data.Options, data.nOptions, m_data.c_str()); }else{ set_str(&data.Value, m_data.c_str()); } } }
void AgentRequest::element_start(const char *el, const char **attr) { if (!strcmp(el, "agent")){ free_data(jabberAgentInfo, &data); load_data(jabberAgentInfo, &data, NULL); m_data = JabberClient::get_attr("jid", attr); set_str(&data.ID, m_data.c_str()); }else if (!strcmp(el, "search")){ data.Search = (unsigned)(-1); } m_data = ""; }
void JabberClient::setOffline(JabberUserData *data) { data->Status = STATUS_OFFLINE; data->composeId = 0; if (data->TypingId && *data->TypingId){ set_str(&data->TypingId, NULL); Contact *contact; if (findContact(data->ID, NULL, false, contact)){ Event e(EventContactStatus, contact); e.process(); } } }
main() { init_params(); set_int("SCALE", "7"); set_flg("VERBOSE"); set_str("DISTRIBUTIONS", "'some file name'"); print_params(); set_int("s" , "8"); clr_flg("VERBOSE"); printf("DIST is %s\n", get_str("DISTRIBUTIONS")); print_params(); usage(NULL, NULL); }
void WorkInfo::apply(Client *client, void *_data) { if (client != m_client) return; ICQUserData *data = (ICQUserData*)_data; set_str(&data->WorkAddress.ptr, getContacts()->fromUnicode(NULL, edtAddress->text()).c_str()); set_str(&data->WorkCity.ptr, getContacts()->fromUnicode(NULL, edtCity->text()).c_str()); set_str(&data->WorkState.ptr, getContacts()->fromUnicode(NULL, edtState->text()).c_str()); set_str(&data->WorkZip.ptr, getContacts()->fromUnicode(NULL, edtZip->text()).c_str()); data->WorkCountry.value = getComboValue(cmbCountry, getCountries()); data->Occupation.value = getComboValue(cmbOccupation, occupations); set_str(&data->WorkName.ptr, getContacts()->fromUnicode(NULL, edtName->text()).c_str()); set_str(&data->WorkDepartment.ptr, getContacts()->fromUnicode(NULL, edtDept->text()).c_str()); set_str(&data->WorkPosition.ptr, getContacts()->fromUnicode(NULL, edtPosition->text()).c_str()); set_str(&data->WorkHomepage.ptr, getContacts()->fromUnicode(NULL, edtSite->text()).c_str()); }
void MsgDialog::save(UserSettings *settings) { string res; set(res, edtMessage->text()); if (!chkOverride->isChecked()) res = ""; switch (status){ case ICQ_STATUS_AWAY: set_str(&settings->AutoResponseAway, res.c_str()); break; case ICQ_STATUS_NA: set_str(&settings->AutoResponseNA, res.c_str()); break; case ICQ_STATUS_DND: set_str(&settings->AutoResponseDND, res.c_str()); break; case ICQ_STATUS_OCCUPIED: set_str(&settings->AutoResponseOccupied, res.c_str()); break; case ICQ_STATUS_FREEFORCHAT: set_str(&settings->AutoResponseFFC, res.c_str()); break; } }
void create() { object ob; ::create(); set_gender( random(2)+1 ); /* OBJEDIT { */ set_spd( 12 ); set_con( 13 ); set_str( 14 ); set_dex( 15 ); set_wil( 10 ); set_cha( 3 ); set_int( 4 ); set_emp( 3 ); set_distant( "a wolf" ); set_specific( "the wolf" ); set_look( "~Name ~verbhas gray fur, penetrating yellow eyes, and a generally surly disposition. ~Pron is $(HP)." ); set_plural( "wolves" ); set_name( "wolf" ); set_type( "wolf" ); set_droppable( 1 ); set_weight( 45000 ); /* } OBJEDIT */ set_living_name( name ); set_food(query_food_capacity()/2); set_drink(query_drink_capacity()/2); add_form("animal"); set_form("animal", 1); remove_form("brawl"); set_race("canine"); set_wc((["piercing":6])); set_wimpy(30); /* set_env_var( "skin_type", "/monsters/skin/wolf_pelt" ); set_env_var( "meat_type", "/monsters/meat/wolf" ); */ set_product_aspect( C_WOLF ); add_product( C_MEAT, 3, 40 ); add_product( C_PELT, 7, 20 ); // add_product( C_TOOTH, 4, 40 ); clone_object("/ai/carnivore")->move(this_object()); ob = clone_object("/ai/aggro"); ob->set_aggro_level(10); ob->move(this_object()); }
void MessageConfig::apply(void *_data) { CoreUserData *data = (CoreUserData*)_data; data->OpenOnReceive = chkWindow->isChecked(); data->OpenOnOnline = chkWindow->isChecked(); data->LogStatus = chkStatus->isChecked(); QString def; if (edtPath->text().isEmpty()) { def = "Incoming Files"; } else { def = edtPath->text(); } set_str(&data->IncomingPath, QFile::encodeName(def)); edtPath->setText(QFile::decodeName(data->IncomingPath ? user_file(data->IncomingPath).c_str() : "")); data->AcceptMode = 0; if (btnAccept->isOn()){ data->AcceptMode = 1; data->OverwriteFiles = chkOverwrite->isChecked(); } if (btnDecline->isOn()){ data->AcceptMode = 2; set_str(&data->DeclineMessage, edtDecline->text().utf8()); } }
void OSDIface::apply(void *d) { OSDUserData *data = (OSDUserData*)d; data->Position = cmbPos->currentItem(); data->Offset = atol(spnOffs->text().latin1()); data->Timeout = atol(spnTimeout->text().latin1()); data->Color = btnColor->color().rgb(); set_str(&data->Font, edtFont->getFont().c_str()); data->Shadow = chkShadow->isChecked(); data->Background = chkBackground->isChecked(); if (data->Background){ data->BgColor = btnBgColor->color().rgb(); }else{ data->BgColor = 0; } }
void parse_bam_list( parameters** params) { FILE* bam_list; char next_path[1024]; int i; bam_list = safe_fopen( ( *params)->bam_list_path, "r"); i = 0; while( fscanf( bam_list, "%s\n", next_path) == 1) { set_str( &( ( *params)->bam_file_list)[i], next_path); i = i + 1; } fclose( bam_list); }
void MoreInfo::apply(Client *client, void *_data) { if (client != m_client) return; ICQUserData *data = (ICQUserData*)_data; set_str(&data->Homepage.ptr, m_client->fromUnicode(edtHomePage->text(), NULL).c_str()); data->Gender.value = getComboValue(cmbGender, genders); int day, month, year; edtDate->getDate(day, month, year); data->BirthMonth.value = month; data->BirthDay.value = day; data->BirthYear.value = year; unsigned l1 = getComboValue(cmbLang1, languages); unsigned l2 = getComboValue(cmbLang2, languages); unsigned l3 = getComboValue(cmbLang3, languages); data->Language.value = (l3 << 16) | (l2 << 8) | l1; }
void JabberHomeInfo::apply(Client *client, void *_data) { if (client != m_client) return; JabberUserData *data = (JabberUserData*)_data; set_str(&data->Street.ptr, edtStreet->text().toUtf8()); set_str(&data->ExtAddr.ptr, edtExt->text().toUtf8()); set_str(&data->City.ptr, edtCity->text().toUtf8()); set_str(&data->Region.ptr, edtState->text().toUtf8()); set_str(&data->PCode.ptr, edtZip->text().toUtf8()); set_str(&data->Country.ptr, edtCountry->text().toUtf8()); }
static void restore_default(struct option *p) { switch(p -> type) { case OT_BOOL: set_bool(p -> data, (bool)p -> init); break; case OT_INT: set_int(p -> data, (int)p -> init); break; case OT_STR: if(p -> init) set_str(p -> data, (char *) p -> init); break; default: assert(0); } }
void JabberClient::connected() { if (data.owner.VHost == NULL) set_str(&data.owner.VHost, getServer()); m_socket->readBuffer.init(0); m_socket->readBuffer.packetStart(); m_socket->setRaw(true); log(L_DEBUG, "Connect ready"); startHandshake(); TCPClient::connect_ready(); if (!m_bXML){ m_parser = XML_ParserCreate("UTF-8"); XML_SetUserData(m_parser, this); XML_SetElementHandler(m_parser, p_element_start, p_element_end); XML_SetCharacterDataHandler(m_parser, p_char_data); m_bXML = true; } }
void DiscoInfo::apply() { if (m_bVCard && m_about){ m_about->apply(m_browser->m_client, &m_data); set_str(&m_data.FirstName, edtFirstName->text().utf8()); set_str(&m_data.Nick, edtNick->text().utf8()); set_str(&m_data.Bday, edtBirthday->text().utf8()); set_str(&m_data.Url, edtUrl->text().utf8()); set_str(&m_data.EMail, edtEMail->text().utf8()); set_str(&m_data.Phone, edtPhone->text().utf8()); m_browser->m_client->setClientInfo(&m_data); } }
static const char * opt_set_set_option(char *p, struct option *opt) { int len; assert(p); strtrim(p); len = strlen(p); if(*p == '\"' && p[len - 1] == '\"') { if(len < 3) return _("invalid value"); p[len - 1] = 0; p++; } switch(opt -> type) { case OT_STR: set_str(opt -> data, p); break; case OT_INT: set_int(opt -> data, safe_atoi(p)); break; case OT_KEYINT: set_int(opt -> data, *p); break; case OT_BOOL: if(!strcasecmp(p, "true") || !strcasecmp(p, "on")) set_bool(opt -> data, TRUE); else if(!strcasecmp(p, "false") || !strcasecmp(p, "off")) set_bool(opt -> data, FALSE); else return _("invalid value"); break; default: assert(0); } return NULL; }
int set_note_str( pbs_attribute *attr, pbs_attribute *new_attr, enum batch_op op) { static char id[] = "set_note_str"; size_t nsize; int rc = 0; char log_buf[LOCAL_LOG_BUF_SIZE]; assert(attr && new_attr && new_attr->at_val.at_str && (new_attr->at_flags & ATR_VFLAG_SET)); nsize = strlen(new_attr->at_val.at_str); /* length of new note */ if (nsize > MAX_NOTE) { sprintf(log_buf, "Warning: Client attempted to set note with len (%d) > MAX_NOTE (%d)", (int)nsize, MAX_NOTE); log_record(PBSEVENT_SECURITY,PBS_EVENTCLASS_REQUEST,id,log_buf); rc = PBSE_BADNDATVAL; } if (strchr(new_attr->at_val.at_str, '\n') != NULL) { sprintf(log_buf, "Warning: Client attempted to set note with a newline char"); log_record(PBSEVENT_SECURITY,PBS_EVENTCLASS_REQUEST,id,log_buf); rc = PBSE_BADNDATVAL; } if (rc != 0) return(rc); rc = set_str(attr, new_attr, op); return(rc); } /* END set_note_str() */
void InterestsInfo::apply(Client *client, void *_data) { if (client != m_client) return; ICQUserData *data = (ICQUserData*)_data; QString info[4]; info[0] = getInfo(cmbBg1, edtBg1); info[1] = getInfo(cmbBg2, edtBg2); info[2] = getInfo(cmbBg3, edtBg3); info[3] = getInfo(cmbBg4, edtBg4); QString res; for (unsigned i = 0; i < 4; i++){ if (info[i].isEmpty()) continue; if (!res.isEmpty()) res += ";"; res += info[i]; } set_str(&data->Interests, m_client->fromUnicode(res, NULL).c_str()); }
void CConfig::saveall(bool now) { if (label_enabled()) { if (now) { width_label = get_width_label_now(); width_comment = get_width_comment_now(); } if(width_label && width_comment) { set_int(WIDTH_LABEL, width_label); set_int(WIDTH_COMMENT, width_comment); } } set_int(LABEL_ENABLE, label_enabled_); set_int(ENABLE_JMP, enable_jmp); set_str(INI_PATH, (LPTSTR)ini_path.c_str()); }