void LLInventoryItemsList::refreshList(const LLInventoryModel::item_array_t item_array)
{
	getIDs().clear();
	LLInventoryModel::item_array_t::const_iterator it = item_array.begin();
	for( ; item_array.end() != it; ++it)
	{
		getIDs().push_back((*it)->getUUID());
	}
	mNeedsRefresh = true;
}
Example #2
0
void FetchFriends::run() 
{	
	replyMsg = ""; 

	success = twitObj->friendsIdsGet(twitObj->getTwitterUsername());
	if(!success) return;	

	twitObj->getLastWebResponse( replyMsg );
	std::vector<std::string> IDs = getIDs( replyMsg );
	
	success = twitObj->userLookup(IDs, true);
	if(!success) return;

	twitObj->getLastWebResponse( replyMsg );
	friends = getUsers( replyMsg );

	HTTPRequest req;
	req.init();
	req.setProxy(twitObj->getProxyServerIp(), twitObj->getProxyServerPort(), twitObj->getProxyUserName(), twitObj->getProxyPassword());
	
	for(int i=0 ; i<friends.size() ; i++) {
		std::string img;
		friendAvatars.push_back("");
		if(req.GET(friends[i].getProfileImgURL(), img)) friendAvatars[i] = img;
		else {
			LOG4CXX_INFO(logger, "Warning: Couldn't fetch Profile Image for " << user << "'s friend " << friends[i].getScreenName())
		}
	}
}
Example #3
0
JNIEXPORT jintArray JNICALL
Java_sun_print_Win32PrintService_getAllMediaTrays(JNIEnv *env,
                                                  jobject peer,
                                                  jstring printer,
                                                  jstring port)
{
    return getIDs(env, printer, port, DC_BINS);
}
void LLInventoryItemsList::refresh()
{
	LLFastTimer _(FTM_INVENTORY_ITEMS_REFRESH);
	static const unsigned ADD_LIMIT = 20;

	uuid_vec_t added_items;
	uuid_vec_t removed_items;

	computeDifference(getIDs(), added_items, removed_items);

	bool add_limit_exceeded = false;
	unsigned int nadded = 0;

	uuid_vec_t::const_iterator it = added_items.begin();
	for( ; added_items.end() != it; ++it)
	{
		if(nadded >= ADD_LIMIT)
		{
			add_limit_exceeded = true;
			break;
		}
		LLViewerInventoryItem* item = gInventory.getItem(*it);
		// Do not rearrange items on each adding, let's do that on filter call
		llassert(item);
		if (item)
		{
			addNewItem(item, false);
			++nadded;
		}
	}

	it = removed_items.begin();
	for( ; removed_items.end() != it; ++it)
	{
		// don't filter items right away
		removeItemByUUID(*it, false);
	}

	// Filter, rearrange and notify parent about shape changes
	filterItems();

	bool needs_refresh = add_limit_exceeded;
	setNeedsRefresh(needs_refresh);
	setForceRefresh(needs_refresh);
}
bool LLAvatarList::filterHasMatches()
{
	uuid_vec_t values = getIDs();

	for (uuid_vec_t::const_iterator it=values.begin(); it != values.end(); it++)
	{
		const LLUUID& buddy_id = *it;
		LLAvatarName av_name;
		bool have_name = LLAvatarNameCache::get(buddy_id, &av_name);

		// If name has not been loaded yet we consider it as a match.
		// When the name will be loaded the filter will be applied again(in refresh()).

		if (have_name && !findInsensitive(av_name.mDisplayName, mNameFilter))
		{
			continue;
		}

		return true;
	}
	return false;
}
Example #6
0
bool LLAvatarList::filterHasMatches()
{
	uuid_vector_t values = getIDs();

	for (uuid_vector_t::const_iterator it=values.begin(); it != values.end(); it++)
	{
		std::string name;
		const LLUUID& buddy_id = *it;
		BOOL have_name = gCacheName->getFullName(buddy_id, name);

		// If name has not been loaded yet we consider it as a match.
		// When the name will be loaded the filter will be applied again(in refresh()).

		if (have_name && !findInsensitive(name, mNameFilter))
		{
			continue;
		}

		return true;
	}
	return false;
}
bool LLAvatarList::contains(const LLUUID& id)
{
	const uuid_vec_t& ids = getIDs();
	return std::find(ids.begin(), ids.end(), id) != ids.end();
}
//////////////////////////////////////////////////////////////////////////
// PROTECTED SECTION
//////////////////////////////////////////////////////////////////////////
void LLAvatarList::refresh()
{
	bool have_names			= TRUE;
	bool add_limit_exceeded	= false;
	bool modified			= false;
	bool have_filter		= !mNameFilter.empty();

	// Save selection.	
	uuid_vec_t selected_ids;
	getSelectedUUIDs(selected_ids);
	LLUUID current_id = getSelectedUUID();

	// Determine what to add and what to remove.
	uuid_vec_t added, removed;
	LLAvatarList::computeDifference(getIDs(), added, removed);

	// Handle added items.
	unsigned nadded = 0;
	const std::string waiting_str = LLTrans::getString("AvatarNameWaiting");

	for (uuid_vec_t::const_iterator it=added.begin(); it != added.end(); it++)
	{
		const LLUUID& buddy_id = *it;
		LLAvatarName av_name;
		have_names &= LLAvatarNameCache::get(buddy_id, &av_name);

		if (!have_filter || findInsensitive(av_name.mDisplayName, mNameFilter))
		{
			if (nadded >= ADD_LIMIT)
			{
				add_limit_exceeded = true;
				break;
			}
			else
			{
				// *NOTE: If you change the UI to show a different string,
				// be sure to change the filter code below.
				if (LLRecentPeople::instance().isAvalineCaller(buddy_id))
				{
					const LLSD& call_data = LLRecentPeople::instance().getData(buddy_id);
					addAvalineItem(buddy_id, call_data["session_id"].asUUID(), call_data["call_number"].asString());
				}
				else
				{
					addNewItem(buddy_id, 
						av_name.mDisplayName.empty() ? waiting_str : av_name.mDisplayName, 
						LLAvatarTracker::instance().isBuddyOnline(buddy_id));
				}
				
				modified = true;
				nadded++;
			}
		}
	}

	// Handle removed items.
	for (uuid_vec_t::const_iterator it=removed.begin(); it != removed.end(); it++)
	{
		removeItemByUUID(*it);
		modified = true;
	}

	// Handle filter.
	if (have_filter)
	{
		std::vector<LLSD> cur_values;
		getValues(cur_values);

		for (std::vector<LLSD>::const_iterator it=cur_values.begin(); it != cur_values.end(); it++)
		{
			const LLUUID& buddy_id = it->asUUID();
			LLAvatarName av_name;
			have_names &= LLAvatarNameCache::get(buddy_id, &av_name);
			if (!findInsensitive(av_name.mDisplayName, mNameFilter))
			{
				removeItemByUUID(buddy_id);
				modified = true;
			}
		}
	}

	// Changed item in place, need to request sort and update columns
	// because we might have changed data in a column on which the user
	// has already sorted. JC
	sort();

	// re-select items
	//	selectMultiple(selected_ids); // TODO: implement in LLFlatListView if need
	selectItemByUUID(current_id);

	// If the name filter is specified and the names are incomplete,
	// we need to re-update when the names are complete so that
	// the filter can be applied correctly.
	//
	// Otherwise, if we have no filter then no need to update again
	// because the items will update their names.
	bool dirty = add_limit_exceeded || (have_filter && !have_names);
	setDirty(dirty);

	// Refreshed all items.
	if(!dirty)
	{
		// Highlight items matching the filter.
		std::vector<LLPanel*> items;
		getItems(items);
		for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
		{
			static_cast<LLAvatarListItem*>(*it)->setHighlight(mNameFilter);
		}

		// Send refresh_complete signal.
		mRefreshCompleteSignal(this, LLSD((S32)size(false)));
	}

	// Commit if we've added/removed items.
	if (modified)
		onCommit();
}
//virtual
void LLAvatarList::clear()
{
	getIDs().clear();
	setDirty(true);
	LLFlatListViewEx::clear();
}
Example #10
0
void LLAvatarList::refresh()
{
	bool have_names			= TRUE;
	bool add_limit_exceeded	= false;
	bool modified			= false;
	bool have_filter		= !mNameFilter.empty();

	// Save selection.	
	std::vector<LLUUID> selected_ids;
	getSelectedUUIDs(selected_ids);
	LLUUID current_id = getSelectedUUID();

	// Determine what to add and what to remove.
	std::vector<LLUUID> added, removed;
	LLAvatarList::computeDifference(getIDs(), added, removed);

	// Handle added items.
	unsigned nadded = 0;
	for (std::vector<LLUUID>::const_iterator it=added.begin(); it != added.end(); it++)
	{
		std::string name;
		const LLUUID& buddy_id = *it;
		have_names &= (bool)gCacheName->getFullName(buddy_id, name);
		if (!have_filter || findInsensitive(name, mNameFilter))
		{
			if (nadded >= ADD_LIMIT)
			{
				add_limit_exceeded = true;
				break;
			}
			else
			{
				addNewItem(buddy_id, name, LLAvatarTracker::instance().isBuddyOnline(buddy_id));
				modified = true;
				nadded++;
			}
		}
	}

	// Handle removed items.
	for (std::vector<LLUUID>::const_iterator it=removed.begin(); it != removed.end(); it++)
	{
		removeItemByUUID(*it);
		modified = true;
	}

	// Handle filter.
	if (have_filter)
	{
		std::vector<LLSD> cur_values;
		getValues(cur_values);

		for (std::vector<LLSD>::const_iterator it=cur_values.begin(); it != cur_values.end(); it++)
		{
			std::string name;
			const LLUUID& buddy_id = it->asUUID();
			have_names &= (bool)gCacheName->getFullName(buddy_id, name);
			if (!findInsensitive(name, mNameFilter))
			{
				removeItemByUUID(buddy_id);
				modified = true;
			}
		}
	}

	// Changed item in place, need to request sort and update columns
	// because we might have changed data in a column on which the user
	// has already sorted. JC
	sort();

	// re-select items
	//	selectMultiple(selected_ids); // TODO: implement in LLFlatListView if need
	selectItemByUUID(current_id);

	// If the name filter is specified and the names are incomplete,
	// we need to re-update when the names are complete so that
	// the filter can be applied correctly.
	//
	// Otherwise, if we have no filter then no need to update again
	// because the items will update their names.
	bool dirty = add_limit_exceeded || (have_filter && !have_names);
	setDirty(dirty);

	// Refreshed all items.
	if(!dirty)
	{
		// Highlight items matching the filter.
		std::vector<LLPanel*> items;
		getItems(items);
		for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
		{
			static_cast<LLAvatarListItem*>(*it)->setHighlight(mNameFilter);
		}

		// Send refresh_complete signal.
		std::vector<LLSD> cur_values;
		getValues(cur_values);
		mRefreshCompleteSignal(this, LLSD((S32)cur_values.size()));
	}

	// Commit if we've added/removed items.
	if (modified)
		onCommit();
}
Example #11
0
BOOL fillTVStruct (xmlNodePtr parentTag) {
	xmlNode *seekChild, *curNode, *airNode;
	char *tmpString;
	char *toFree;
	/* clear Structs */
	if (curTV->actors) free (curTV->actors);
	if (curTV->plot) free (curTV->plot);
	if (curTV->tagline) free (curTV->tagline);
	bzero (curTV, sizeof(struct ST_tv));

	if ( (seekChild = getChildNodeByName(parentTag, "title")) != NULL ) {
		if ( ( tmpString = encNodeGetContent(seekChild)) != NULL ) {
			strncat(curTV->seriesname, tmpString, 255);
			free (tmpString);
			printD ("Stored Title:%s\n", curTV->seriesname);
		}
	}
	else {
		printD("Something went wrong while reading title...\n");
		return (FALSE);
	}

	if ( (seekChild = getChildNodeByName(parentTag, "language")) != NULL ) {
		if ( ( tmpString = encNodeGetContent(seekChild)) != NULL ) {
			strncat(curTV->language, tmpString, 255);
			free (tmpString);
			printD ("Stored Language:%s\n", curTV->language);
		}
	}
	else {
		printD("Something went wrong while reading language...\n");
		return (FALSE);
	}

	if ( (seekChild = getChildNodeByName(parentTag, "container")) != NULL ) {
		if ( ( tmpString = encNodeGetContent(seekChild)) != NULL ) {
			strncat(curTV->mediatype, tmpString, 255);
			xmlFree (tmpString);
			printD ("Stored MediaType:%s\n", curTV->mediatype);
		}
	}
	else {
		printD("Something went wrong while reading container(mediatype)...\n");
		return (FALSE);
	}

	if ( (toFree = getIDs(parentTag)) != NULL ) {
		sprintf (curTV->imdblink, "http://www.imdb.com/title/%s\n", toFree);
		free (toFree);
	}
	else
		sprintf (curTV->imdblink, "http://www.imdb.com/find?s=all&q=%s", curMovie->moviename);
	printD ("Stored IMDBLink:%s\n", curTV->imdblink);

	if ( (seekChild = getChildNodeByName(parentTag, "videoOutput")) != NULL) {
		if ( (tmpString = (char*)xmlNodeGetContent (seekChild)) != NULL) {
			curMovie->isHD = isHD(tmpString);
			xmlFree ((xmlChar*)tmpString);
		}
	}
	else
		curMovie->isHD = FALSE;


	if ( (seekChild = getChildNodeByName(parentTag, "directors")) != NULL ) {
		if ( childTextToString(seekChild, curTV->directors, "director") == 0 )
			strcat (curTV->directors, "UNKNOWN");
		printD ("Stored Directors:%s\n", curTV->directors);
	}
	else {
		printD("Something went wrong while reading directors...\n");
	}

	if ( (seekChild = getChildNodeByName(parentTag, "writers")) != NULL ) {
		if ( childTextToString(seekChild, curTV->writers, "writer") == 0 )
			strcat (curTV->writers, "UNKNOWN");
		printD ("Stored Writers:%s\n", curTV->writers);
	}

	if ( (seekChild = getChildNodeByName(parentTag, "genres")) != NULL ) {
		if ( childTextToString(seekChild, curTV->genres, "genre") == 0 )
			strcat (curTV->genres, "UNKNOWN");
		printD ("Stored Genres:%s\n", curTV->genres);
	}

	if ( (seekChild = getChildNodeByName(parentTag, "cast")) != NULL ) {
		if ( childTextToString_m(seekChild, &curTV->actors, "actor") == 0 )
			curTV->actors = strdup ("UNKNOWN");
		printD ("Stored Actors:%s\n", curTV->actors);
	}
	else
		curTV->actors = strdup ("UNKNOWN");

	if ( (seekChild = getChildNodeByName(parentTag, "tagline")) != NULL ) {
		if ( ( tmpString = encNodeGetContent(seekChild)) != NULL ) {
			curTV->tagline=tmpString;
			printD ("Stored Outline:%s\n", curTV->tagline);
		}
	}

	if ( (seekChild = getChildNodeByName(parentTag, "plot")) != NULL ) {
		if ( ( tmpString = encNodeGetContent(seekChild)) != NULL ) {
			curTV->plot=tmpString;
			printD ("Stored Plot:%s\n", curTV->plot);
		}
	}

	if ( (seekChild = getChildNodeByName(parentTag, "releaseDate")) != NULL ) {
		if ( ( tmpString = encNodeGetContent(seekChild)) != NULL ) {
			strncat (curTV->year, tmpString, 63);
			xmlFree (tmpString);
			printD ("Stored Releasedate:%s\n", curTV->year);
		}
	}

	if ( (seekChild = getChildNodeByName(parentTag, "posterFile")) != NULL ) {
		if ( ( tmpString = encNodeGetContent(seekChild)) != NULL ) {
			strncat (curTV->imglink, tmpString, 255);
			free (tmpString);
			printD ("Stored Imagelink:%s\n", curTV->imglink);
		}
	}

	if ( (seekChild = getChildNodeByName(parentTag, "rating")) != NULL ) {
		if ( ( tmpString = (char*)xmlNodeGetContent(seekChild)) != NULL ) {
			if (atoi((char*)tmpString) < 0)
				curTV->rating=0;
			else
				curTV->rating=atoi((char*)tmpString);
			xmlFree (tmpString);
			printD ("Stored Rating:%i\n", curTV->rating);
		}
	}

	if ( (seekChild = getChildNodeByName(parentTag, "season")) != NULL ) {
		if ( ( tmpString = (char*)xmlNodeGetContent(seekChild)) != NULL ) {
			if (atoi((char*)tmpString) < 0)
				curTV->season=0;
			else
				curTV->season=atoi((char*)tmpString);
			xmlFree (tmpString);
			printD ("Stored Season:%i\n", curTV->season);
		}
	}

	if ( (seekChild = getChildNodeByName(parentTag, "files")) != NULL) {
		if (seekChild->children) {
			curNode = seekChild->children;
			while (curNode) {
				if (curNode->type == XML_ELEMENT_NODE) {
					if (strcasecmp((char*)curNode->name, "file") == 0) {
						if ( (airNode = getChildNodeByName(curNode, "fileTitle")) != NULL) {
							if ( (tmpString = (char*)xmlGetProp(airNode, (xmlChar*)"part")) != NULL ) {
								if (atoi((char*)tmpString) < 0 )
									curTV->episode=0;
								else
									curTV->episode=atoi((char*)tmpString);
								xmlFree (tmpString);
							}
							if ( (tmpString = encNodeGetContent(airNode)) != NULL ) {
								strncat (curTV->episodename, tmpString, 255);
								free(tmpString);
							}
						}
						if ( (airNode = getChildNodeByName(curNode, "fileLocation")) != NULL) {
							tmpString = (char*)xmlNodeGetContent(airNode);
							strncat (curTV->filename, tmpString ? tmpString : "*UNAVAILABLE*", 255);
							if (tmpString) free (tmpString);
						}
					}
					if (!writeToDB(TRUE))
						fprintf (stderr, "%s could not be stored in DB:%s\n", curTV->filename, mysql_error(mysql_conn));
					bzero(curTV->episodename, 255);
					bzero(curTV->filename, 255);
				}
				/* should all be filled by now, pump it in the DB */
				curNode=curNode->next;
			}
		}
	}

	return (TRUE);

}
Example #12
0
static int canvasFunc( ClientData data, Tcl_Interp *interp,
      int objc, Tcl_Obj * const objv[] )
{
   const char *cmds[] = { "delete", "configure", "cget", "isMapped",
         "getCurrentSize", "update", "raise", "lower", 
         "create", "itemDelete", "itemShow",
         "itemConfigure", "itemCget", "itemCommand", 
         "affine", "scale", "move", "rotate",
         "windowToCanvas", "canvasToWindow",
         "findItemAt", "getBounds", "findWithTag",
         NULL };
   enum cmdIdx { DeleteIdx, ConfigureIdx, CgetIdx, IsMappedIdx,
         GetCurSizeIdx, UpdateIdx, RaiseIdx, LowerIdx,
         CreateIdx, ItemDeleteIdx, ItemShowIdx,
         ItemConfigureIdx, ItemCgetIdx, ItemCommandIdx, 
         AffineIdx, ScaleIdx, MoveIdx, RotateIdx,
         WindowToCanvasIdx, CanvasToWindowIdx,
         FindItemAtIdx, GetBoundsIdx, GetIDsFromTagIdx };
   CanvasParams *para = (CanvasParams *)data;
   GtkWidget    *widget = GTK_WIDGET( para->canvas );
   int idx;

   if( objc < 2 )
   {
      Tcl_WrongNumArgs( interp, 1, objv, "command" );
      return TCL_ERROR;
   }

   if( Tcl_GetIndexFromObj( interp, objv[1], cmds, "command", 
         TCL_EXACT, &idx ) != TCL_OK )
      return TCL_ERROR;

   switch( idx )
   {
      case DeleteIdx:
            return gnoclDelete( interp, widget, objc, objv );

      case ConfigureIdx:
            {
               int ret = TCL_ERROR;
               if( gnoclParseAndSetOptions( interp, objc - 1, objv + 1, 
                     canvasOptions, G_OBJECT( widget ) ) == TCL_OK )
               {

                  if( canvasOptions[antialiasedIdx].status 
                        == GNOCL_STATUS_CHANGED )
                  {
                     Tcl_SetResult( interp, "antialiasing cannot be changed "
                           "after creation", TCL_STATIC );
                  }
                  else
                     ret = configure( interp, para, canvasOptions );
               }
               gnoclClearOptions( canvasOptions );
               return ret;
            }
            break;
      case CgetIdx:
            {
               int     idx;
               switch( gnoclCget( interp, objc, objv, G_OBJECT( widget ), 
                     canvasOptions, &idx ) )
               {
                  case GNOCL_CGET_ERROR:  
                           return TCL_ERROR;
                  case GNOCL_CGET_HANDLED:
                           return TCL_OK;
                  case GNOCL_CGET_NOTHANDLED:
                           return cget( interp, para->canvas, 
                                 canvasOptions, idx );
               }
               break;
            }
      case IsMappedIdx:
            return isMapped( interp, widget, objc, objv );
      case GetCurSizeIdx:
            return getCurSize( interp, widget, objc, objv );
      case UpdateIdx:
            if( objc != 2 )
            {
               Tcl_WrongNumArgs( interp, 2, objv, NULL );
               return TCL_ERROR;
            }
            gnome_canvas_update_now( para->canvas );
            break;
      case CreateIdx:
            return canvasCreateItem( interp, objc, objv, para );
      case RaiseIdx:
      case LowerIdx:
      case ItemDeleteIdx:
      case ItemShowIdx:
      case ItemConfigureIdx:
      case ItemCgetIdx:
      case ItemCommandIdx:
      case AffineIdx:
      case ScaleIdx:
      case MoveIdx:
      case RotateIdx:
      case GetBoundsIdx:
      case GetIDsFromTagIdx:
            {
               GPtrArray *items;
               int       ret;

               if( objc < 3 )
               {
                  Tcl_WrongNumArgs( interp, 2, objv, 
                        "tag-or-id ?option val ...?" );
                  return TCL_ERROR;
               }
               if( gnoclCanvasItemsFromTagOrId( interp, para, 
                     Tcl_GetString( objv[2] ), &items ) != TCL_OK )
                  return TCL_ERROR;

               switch( idx )
               {
                  case RaiseIdx:
                  case LowerIdx:
                     ret = itemRaise( interp, objc, objv, para, items,
                           idx == RaiseIdx );
                     break;
                  case ItemDeleteIdx:
                     ret = itemDelete( interp, objc, objv, para, items );
                     break;
                  case ItemShowIdx:
                     ret = itemShow( interp, objc, objv, para, items );
                     break;
                  case ItemConfigureIdx:
                     ret = itemConfigure( interp, objc, objv, para, items );
                     break;
                  case ItemCgetIdx:
                     ret = itemCget( interp, objc, objv, para, items );
                     break;
                  case ItemCommandIdx:
                     ret = itemCommand( interp, objc, objv, para, items );
                     break;
                  case AffineIdx:
                     ret = affine( interp, objc, objv, para, items, Affine );
                     break;
                  case ScaleIdx:
                     ret = affine( interp, objc, objv, para, items, Scale );
                     break;
                  case MoveIdx:
                     ret = affine( interp, objc, objv, para, items, Move );
                     break;
                  case RotateIdx:
                     ret = affine( interp, objc, objv, para, items, Rotate );
                     break;
                  case GetBoundsIdx:
                     ret = itemBounds( interp, objc, objv, para, items );
                     break;
                  case GetIDsFromTagIdx:
                     ret = getIDs( interp, objc, objv, para, items );
                     break;
                  default:
                     assert( 0 );
               }
               if( items )
                  g_ptr_array_free( items, 0 );
               return ret;
            }
            break; 
      case WindowToCanvasIdx:
            return windowToCanvas( interp, objc, objv, para, 0 );
      case CanvasToWindowIdx:
            return windowToCanvas( interp, objc, objv, para, 1 );
      case FindItemAtIdx:
            return findItemAt( interp, objc, objv, para );
   }

   return TCL_OK;
}