void MumbleChannel::UpdateChannel(MumbleProto::ChannelState& state) { if (state.has_channel_id()) { m_id = state.channel_id(); } if (state.has_name()) { m_channelName = ConvertFromUTF8(state.name()); } if (state.has_description()) { m_channelDescription = ConvertFromUTF8(state.description()); m_hasDescription = true; } if (state.has_description_hash()) { m_descriptionHash = state.description_hash(); m_hasDescription = false; } if (state.has_temporary()) { m_temporary = state.temporary(); } }
bool Command::DoReadParam( void ) { Variable* var = mpVM->mVariables[ mObject ]; if( mpVM->mArgcRun <= mObject ) { var->AssignValue( mpExpr->get_Value() ); return true; } sqlite3_value* vl = mpVM->mpArgv[ mObject ]; switch( sqlite3_value_type( vl ) ) { case kDouble : var->AssignValue( sqlite3_value_double( vl ) ); break; case kInt : var->AssignValue( sqlite3_value_int( vl ) ); break; case kText : { const char* str = (const char*) sqlite3_value_text( vl ); wstring wstr; ConvertFromUTF8( str, strlen( str ), wstr ); var->AssignValue( wstr ); } break; default: var->AssignValue( Value() ); break; } return true; }
/** Determine the title to display for a client. */ void ReadWMName(ClientNode *np) { unsigned long count; int status; unsigned long extra; Atom realType; int realFormat; unsigned char *name; if(np->name) { Release(np->name); } status = JXGetWindowProperty(display, np->window, atoms[ATOM_NET_WM_NAME], 0, 1024, False, atoms[ATOM_UTF8_STRING], &realType, &realFormat, &count, &extra, &name); if(status != Success || realFormat == 0) { np->name = NULL; } else { const size_t size = strlen((char*)name) + 1; np->name = Allocate(size); memcpy(np->name, name, size); JXFree(name); np->name = ConvertFromUTF8(np->name); } #ifdef USE_XUTF8 if(!np->name) { status = JXGetWindowProperty(display, np->window, XA_WM_NAME, 0, 1024, False, atoms[ATOM_COMPOUND_TEXT], &realType, &realFormat, &count, &extra, &name); if(status == Success && realFormat == 8) { char **tlist; XTextProperty tprop; int tcount; tprop.value = name; tprop.encoding = atoms[ATOM_COMPOUND_TEXT]; tprop.format = realFormat; tprop.nitems = strlen((char*)name); if(XmbTextPropertyToTextList(display, &tprop, &tlist, &tcount) == Success && tcount > 0) { const size_t len = strlen(tlist[0]) + 1; np->name = Allocate(len); memcpy(np->name, tlist[0], len); XFreeStringList(tlist); } JXFree(name); } } #endif if(!np->name) { char *temp = NULL; if(JXFetchName(display, np->window, &temp)) { const size_t len = strlen(temp) + 1; np->name = Allocate(len); memcpy(np->name, temp, len); JXFree(temp); } } }