I first found this looking at bug 1059203.
gaim_find_conversation_with_account is used incorrectly numerous places.
It is possible to have more than one conversation with the same name
and account -- in the bug report one is a chat; the other is an im.
Code can check to determine if the returned conversation is an im or a
chat, but if it is not the type desired, what should the code do?
Calling gaim_get_conversations and searching the whole list every time
seems wrong, but what other options are there?
This seems to be a big enough problem to consider a new API. Looking at
the first six files from grep, I find: 1 place the function is
implemented, 10 places where the something could go wrong if there is
more than one conv with the same name and different type.
add a gaim_find_chat_with_account and gaim_find_im_with_account
add a gaim_find_conversations_with_account which would return a GList;
make the calling function decide what to do and free the GList
Etan: Either that, or make a general gaim_find function which works
sort of like the request api.
The first suggestion solves the problem of a(n) chat/im being returned
when a(n) im/chat with the same name is available and desired. It
doesn't address the possibility of multiple chats with the same name
under the same account. This might already be handled with
gaim_find_chat -- anyone care to comment?
The second suggestion might be better than calling
gaim_get_conversations, gaim_get_ims, or gaim_get_chats, but perhaps not
much better as we would still have a GList to search.
The third suggestion is beyond my evaluation atm.