I wrote an .Net adapter that nearly the same to MessengerDemo adapter for MessengerDemo site. I encountered with the problem that : when the first user login into site, his name would not be displayed on the buddies-list, but his name would be displayed on this list if he is the second user or so on. My change to this adapter was only in subscribe method :
Code:
public void Subscribe(string itemName)
{
if (itemName.StartsWith(USER_PREFIX))
{
string userName = itemName.Substring(USER_PREFIX.Length);
if (chatTableDic.ContainsKey(userName))
{
throw new Exception("This user is exist !");
}
lock (synObj)
{
if (!chatTableDic.ContainsKey(userName))
{
chatTableDic.Add(userName, new ChatUser(userName, itemName));
chatParners.Add(userName, new Dictionary<string, ChatUser>());
UpdateOnlineList("ADD", userName, false);
}
}
}
}
private void UpdateOnlineList(string command, string key, bool isForSnapshot)
{
string desTable = LIST_TABLE;
var update = new Hashtable();
update.Add("command", command);
update.Add("key",key);
ThreadPool.QueueUserWorkItem(delegate { listener.Update(desTable, update, isForSnapshot); });
}
(LIST_TABLE is a name of buddy-list table)
So could you tell what i was wrong here?
Thank you so much !
Bookmarks