Index: /trunk/msg.cpp
===================================================================
--- /trunk/msg.cpp	(revision 7)
+++ /trunk/msg.cpp	(revision 8)
@@ -4,6 +4,4 @@
 	json::Object _obj;							\
 	makeTemplate(_obj, _type);					\
-
-#define DELIMITER	"$"
 
 namespace Protocol
@@ -18,4 +16,24 @@
 	{
 		return get<std::string>("type");
+	}
+
+	std::vector<SFriend> Message::getFriendList() const
+	{
+		json::Array ar = mObject[ProtocolType::FRIEND_LIST];
+
+		std::vector<SFriend> friendList;
+
+		std::vector<json::Value>::iterator iter;
+		for (iter = ar.begin(); iter != ar.end(); iter++)
+		{
+			SFriend fr;
+
+			fr.id   = (*iter)[ProtocolType::ID  ];
+			fr.name = (*iter)[ProtocolType::NAME];
+
+			friendList.push_back(fr);
+		}
+
+		return friendList;
 	}
 
@@ -33,5 +51,5 @@
 	void Request::makeTemplate(json::Object & obj, const std::string & type) const
 	{
-		obj[ProtocolType::ID  ] = mID;
+		obj[ProtocolType::ID] = mID;
 		obj[ProtocolType::TYPE] = type;
 	}
@@ -50,6 +68,6 @@
 		DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::JOIN);
 
-		obj[ProtocolType::ID ] = id;
-		obj[ProtocolType::PW ] = pw;
+		obj[ProtocolType::ID] = id;
+		obj[ProtocolType::PW] = pw;
 		obj[ProtocolType::SMS] = sms;
 
@@ -88,8 +106,8 @@
 		DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::CHAT);
 
-		obj[ProtocolType::FROM      ] = mID;
+		obj[ProtocolType::FROM] = mID;
 		obj[ProtocolType::SESSION_ID] = sessid;
-		obj[ProtocolType::MESSAGE   ] = message;
-		obj[ProtocolType::SENSITIVE ] = sensitive;
+		obj[ProtocolType::MESSAGE] = message;
+		obj[ProtocolType::SENSITIVE] = sensitive;
 
 		return json::Serialize(obj);
@@ -117,3 +135,24 @@
 		return json::Serialize(obj);
 	}
+
+	std::string Response::friendList(const std::vector<SFriend> & friendList) const
+	{
+		DECLARE_TEMPLATE_OBJECT(obj, ProtocolType::FRIEND_LIST);
+
+		json::Array ar;
+		std::vector<SFriend>::const_iterator iter;
+		for (iter = friendList.begin() ; iter != friendList.end() ; iter++)
+		{
+			json::Object fr;
+
+			fr[ProtocolType::ID  ] = iter->id;
+			fr[ProtocolType::NAME] = iter->name;
+
+			ar.push_back(fr);
+		}
+
+		obj[ProtocolType::FRIEND_LIST] = ar;
+
+		return json::Serialize(obj);
+	}
 };
Index: /trunk/msg.hpp
===================================================================
--- /trunk/msg.hpp	(revision 7)
+++ /trunk/msg.hpp	(revision 8)
@@ -15,4 +15,6 @@
 } SFriend;
 
+#define DELIMITER	"$"
+
 // --------------------------------------------------------------
 
@@ -23,4 +25,5 @@
 	DECLARE_KEY(ID);
 	DECLARE_KEY(TYPE);
+	DECLARE_KEY(NAME);
 	DECLARE_KEY(SMS);
 	DECLARE_KEY(PHONE);
@@ -37,4 +40,5 @@
 	DECLARE_KEY(SENSITIVE);
 	DECLARE_KEY(GET_FRIEND_LIST);
+	DECLARE_KEY(FRIEND_LIST);
 	DECLARE_KEY(RESULT);
 }
@@ -55,4 +59,6 @@
 			return (T)mObject[key];
 		}
+
+		inline std::vector<SFriend> getFriendList() const;
 
 		std::string type() const;
Index: /trunk/msgclnt.cpp
===================================================================
--- /trunk/msgclnt.cpp	(revision 7)
+++ /trunk/msgclnt.cpp	(revision 8)
@@ -2,4 +2,6 @@
 #include "msgclnt.h"
 #include "msg.hpp"
+
+#include <algorithm>
 
 #include <stdlib.h>
@@ -182,23 +184,31 @@
 std::vector<SFriend> chev::getFriendList()
 {
+	std::vector<SFriend> friendList;
+
 	try
 	{
 		socket.send(request.getFriendList());
-	}
-	catch (cf::exception & e)
-	{
-		LOG(e.what());
-	}
-	return std::vector<SFriend>();
-}
-
-std::string chev::getSessionID(const std::vector<std::string> & idList)
-{
-	try
-	{
+
+		friendList = messageQ.pop(ProtocolType::FRIEND_LIST).getFriendList();
+	}
+	catch (cf::exception & e)
+	{
+		LOG(e.what());
+	}
+
+	return friendList;
+}
+
+std::string chev::getSessionID(std::vector<std::string> & idList)
+{
+	try
+	{
+		if (idList.size() == 2)
+			std::sort(idList.begin(), idList.end());
+
 		std::string concat = idList[0];
 
-		for (int iter = 1 ; iter < idList.size() ; iter++)
-			concat += "," + idList[iter];
+		for (int iter = 1; iter < idList.size(); iter++)
+			concat += DELIMITER + idList[iter];
 
 		if (sessionMap.find(concat) == sessionMap.end())
@@ -206,12 +216,10 @@
 			socket.send(request.openSession(concat));
 
-			std::string response = socket.receive().toString();
-			Protocol::Message parser;
-			parser.parse(response);
-
-			if (!parser.get<bool>("result"))
+			Protocol::Message message = messageQ.pop(ProtocolType::SESSION_ID);
+
+			if (!message.get<bool>(ProtocolType::RESULT))
 				THROW_EXCEPTION("failed to open session id");
 
-			sessionMap[concat] = parser.get<std::string>("sess-id");
+			sessionMap[concat] = message.get<std::string>(ProtocolType::SESSION_ID);
 		}
 
@@ -247,12 +255,12 @@
 {
 	SConversation c;
-	Protocol::Message parser = messageQ.pop(ProtocolType::CHAT);
-
-	c.sessid    = parser.get<std::string>(ProtocolType::SESSION_ID);
-	c.message   = parser.get<std::string>(ProtocolType::MESSAGE);
-	c.sensitive = parser.get<int>(ProtocolType::SENSITIVE);
-	c.isError   = parser.get<bool>(ProtocolType::RESULT);
-
-	c.from      = parser.get<std::string>(ProtocolType::FROM);
+	Protocol::Message message = messageQ.pop(ProtocolType::CHAT);
+
+	c.sessid    = message.get<std::string>(ProtocolType::SESSION_ID);
+	c.message   = message.get<std::string>(ProtocolType::MESSAGE);
+	c.sensitive = message.get<int>(ProtocolType::SENSITIVE);
+	c.isError   = message.get<bool>(ProtocolType::RESULT);
+
+	c.from      = message.get<std::string>(ProtocolType::FROM);
 
 	return c;
Index: /trunk/msgclnt.h
===================================================================
--- /trunk/msgclnt.h	(revision 7)
+++ /trunk/msgclnt.h	(revision 8)
@@ -64,5 +64,5 @@
 	std::vector<SFriend> getFriendList();
 
-	std::string getSessionID(const std::vector<std::string> & idList);
+	std::string getSessionID(std::vector<std::string> & idList);
 
 	bool tell(const SConversation & conversation);
Index: /trunk/msvc14/ChevMsgrClient_MFC/ChevMsgrClient_MFC.vcxproj
===================================================================
--- /trunk/msvc14/ChevMsgrClient_MFC/ChevMsgrClient_MFC.vcxproj	(revision 7)
+++ /trunk/msvc14/ChevMsgrClient_MFC/ChevMsgrClient_MFC.vcxproj	(revision 8)
@@ -218,3 +218,8 @@
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="ChevMsgrClient_MFC.rc" />
+    </VisualStudio>
+  </ProjectExtensions>
 </Project>
