diff -ru libept-1.0.6.1/ept/apt/apt.cc libept-1.0.6.2/ept/apt/apt.cc
--- libept-1.0.6.1/ept/apt/apt.cc	2012-01-24 14:00:25.000000000 +0100
+++ libept-1.0.6.2/ept/apt/apt.cc	2012-06-10 16:29:21.000000000 +0200
@@ -624,15 +624,55 @@
 				delete[] buffer;
 				return std::string();
 			}
+			
+			// Get a pointer to start of Description field
+			const char *DescP = (char*)strstr((char*)buffer, "Description:");
 
-			std::string res(buffer, vfi->Size);
+			// put in everything until description
+			std::stringstream result;
+			result.write(buffer, DescP - buffer);
+			
+			
+			// Show the right description
+			pkgRecords Recs(impl->cache());
+			pkgCache::DescIterator Desc = vi.TranslatedDescription();
+			pkgRecords::Parser &P = Recs.Lookup(Desc.FileList());
+			// TODO currently the language code is not added here
+			// this would break the packagerecord parsing algorithm, should be implemented
+			// in the future though
+			//result << "Description" << ( (strcmp(Desc.LanguageCode(),"") != 0) ? "-" : "" ) << Desc.LanguageCode() << ": " << P.LongDesc();
+			result << "Description: " << P.LongDesc();
+
+
+			// Find the first field after the description (if there is any)
+			for(DescP++;DescP != &buffer[vi.FileList()->Size];DescP++) 
+			{
+				if(*DescP == '\n' && *(DescP+1) != ' ') 
+				{
+					// write the rest of the buffer
+					const char *end=&buffer[vi.FileList()->Size];
+					result.write(DescP,end-DescP);
+					break;
+				}
+			}
+			// write a final newline (after the description)
+			result<<endl;
+
+			
 			delete[] buffer;
-			return res;
+			return result.str();
 		}
 	}
 	return std::string();
 }
 
+
+const pkgCache* Apt::aptPkgCache() const 
+{
+	return impl->m_cache;
+}
+
+
 void Apt::checkCacheUpdates()
 {
 	if (impl->m_open_timestamp < timestamp())
diff -ru libept-1.0.6.1/ept/apt/apt.h libept-1.0.6.2/ept/apt/apt.h
--- libept-1.0.6.1/ept/apt/apt.h	2012-01-24 14:00:25.000000000 +0100
+++ libept-1.0.6.2/ept/apt/apt.h	2012-06-10 16:29:21.000000000 +0200
@@ -29,6 +29,8 @@
 
 #include <iterator>
 
+class pkgCache;
+
 namespace ept {
 namespace apt {
 
@@ -198,6 +200,7 @@
 	Apt();
 	~Apt();
 
+
 	iterator begin() const;
 	iterator end() const;
 
@@ -257,6 +260,11 @@
 	/// Get the raw package record for the given Version
 	std::string rawRecord(const Version& ver) const;
 
+	/// Returns the pointer to the internal libapt pkgCache object used.
+	const pkgCache* aptPkgCache() const;
+
+	
+	
 	/// Timestamp of when the apt index was last modified
 	time_t timestamp();
 

Reply via email to