void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status) { if(status == LL_ERR_NOERR) { S32 size = vfs->getSize(asset_uuid, type); U8* buffer = new U8[size]; vfs->getData(asset_uuid, type, buffer, 0, size); if(type == LLAssetType::AT_NOTECARD) { LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,""); if(edit->importBuffer((char*)buffer, (S32)size)) { llinfos << "ao nc decode success" << llendl; std::string card = edit->getText(); edit->die(); LUA_CALL("OnAONotecardRead") << card << LUA_END; mAOAllAnims.clear(); mAOStands.clear(); //mAODefaultAnims.clear(); struct_stands standsloader; struct_all_anims all_anims_loader; typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep("\n"); tokenizer tokline(card, sep); for (tokenizer::iterator line = tokline.begin(); line != tokline.end(); ++line) { std::string strline(*line); boost::regex type("^(\\s*)(\\[ )(.*)( \\])"); boost::smatch what; if (boost::regex_search(strline, what, type)) { boost::char_separator<char> sep("|,"); std::string stranimnames(boost::regex_replace(strline, type, "")); tokenizer tokanimnames(stranimnames, sep); for (tokenizer::iterator anim = tokanimnames.begin(); anim != tokanimnames.end(); ++anim) { std::string strtoken(what[0]); std::string stranim(*anim); int state = GetStateFromToken(strtoken.c_str()); LLUUID animid(getAssetIDByName(stranim)); if (!(animid.notNull())) { cmdline_printchat(llformat("Warning: animation '%s' could not be found (Section: %s).",stranim.c_str(),strtoken.c_str())); } else { all_anims_loader.ao_id = animid; all_anims_loader.anim_name = stranim.c_str(); all_anims_loader.state = state; mAOAllAnims.push_back(all_anims_loader); if (state == STATE_AGENT_STAND) { standsloader.ao_id = animid; standsloader.anim_name = stranim.c_str(); mAOStands.push_back(standsloader); continue; } for (std::vector<struct_default_anims>::iterator iter = mAODefaultAnims.begin(); iter != mAODefaultAnims.end(); ++iter) { if (state == iter->state) iter->ao_id = animid; } } } } } llinfos << "ao nc read sucess" << llendl; loadComboBoxes(); run(); } else { llinfos << "ao nc decode error" << llendl; } } } else { llinfos << "ao nc read error" << llendl; } }
static int initiate(register Cs_t* state, char* user, char* path, char* service, char* name) { register char* s; char* on; char* local; Sfio_t* sp; Sfio_t* np; int n; char* av[REMOTE_ARGC]; char buf[PATH_MAX / 4]; local = csname(state, 0); s = service + strlen(service); *s++ = '/'; if (!(state->flags & CS_ADDR_SHARE)) { sfsprintf(buf, sizeof(buf), "%s\n", state->host); if (!(sp = tokline(buf, SF_STRING, NiL))) return -1; } else if (state->flags & CS_ADDR_LOCAL) { sfsprintf(buf, sizeof(buf), "%s\n", CS_HOST_LOCAL); if (!(sp = tokline(buf, SF_STRING, NiL))) return -1; } else { strcpy(s, CS_SVC_HOSTS); if (!(sp = tokline(service, SF_READ, NiL))) { if (streq(state->host, CS_HOST_SHARE)) sfsprintf(buf, sizeof(buf), "%s\n%s\n", CS_HOST_SHARE, CS_HOST_LOCAL); else sfsprintf(buf, sizeof(buf), "%s\n%s\n%s\n", state->host, CS_HOST_SHARE, CS_HOST_LOCAL); if (!(sp = tokline(buf, SF_STRING, NiL))) return -1; } } sfsprintf(s, PATH_MAX - (s - service) - 1, "%s%s", name, CS_SVC_SUFFIX); while (s = sfgetr(sp, '\n', 1)) if (tokscan(s, NiL, " %s ", &on) == 1) { if (streq(on, CS_HOST_LOCAL) || streq(on, local)) { sfclose(sp); av[0] = service; av[1] = path; av[2] = 0; return procclose(procopen(av[0], av, NiL, NiL, PROC_PRIVELEGED|PROC_ZOMBIE)) < 0 ? -1 : 0; } else if (!streq(on, CS_HOST_SHARE)) { Proc_t* proc; time_t otime; struct stat st; char fv[REMOTE_FLAGC]; long ov[3]; remote(state, on, user, path, 0, av, fv); otime = lstat(state->mount, &st) ? 0 : st.st_ctime; n = open("/dev/null", O_RDWR); ov[0] = PROC_FD_DUP(n, 0, 0); ov[1] = PROC_FD_DUP(n, 1, PROC_FD_PARENT|PROC_FD_CHILD); ov[2] = 0; if (proc = procopen(av[0], av, NiL, ov, PROC_PRIVELEGED|PROC_ZOMBIE)) { n = 1; for (;;) { if (!lstat(state->mount, &st) && st.st_ctime != otime) { if (!procclose(proc)) { sfclose(sp); return 0; } break; } /* * sleep() and MNT_TMP * hack around remote * fs cache delays */ if (n >= CS_REMOTE_DELAY) { procclose(proc); break; } if (n == 1) { *state->control = CS_MNT_TMP; if (remove(state->mount)) { close(open(state->mount, O_WRONLY|O_CREAT|O_TRUNC, 0)); remove(state->mount); } *state->control = CS_MNT_STREAM; } sleep(n); n <<= 1; } } } else if (!sfstacked(sp) && (np = csinfo(state, on, NiL))) sfstack(sp, np); } sfclose(sp); return -1; }