From: Andrew Hart <arhart@us...> - 2004-11-08 03:08:49
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.
From: Mark Doliner <mark@ki...> - 2004-11-17 01:45:38
On Sun, 07 Nov 2004 22:08:27 -0500, Andrew Hart wrote
> 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.
How about we change gaim_find_coversation_with_account by adding a parameter that specifies the
type of conversation?
const char *name,
const GaimAccount *account);
I suppse GAIM_CONV_UNKNOWN could be used if you want to find any conversation and you don't
care about the type. Or we could add a GAIM_CONV_ANY or something. Thoughts?
O O Mark Doliner
\ | mark@...
\ | http://www.kingant.net
"There needs to be a better word for weird."