Mercurial > pidgin
comparison src/blist.c @ 6456:ccfdf9f2cdd1
[gaim-migrate @ 6965]
Conversation placement by group now applies to chats in the buddy list as
well. Also added functions for finding a chat by name, and getting its
parent group.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 13 Aug 2003 21:08:29 +0000 |
parents | e7b87c8e8c0a |
children | 2311f3761ed2 |
comparison
equal
deleted
inserted
replaced
6455:cd0b5eaf9460 | 6456:ccfdf9f2cdd1 |
---|---|
868 return (struct group*)node; | 868 return (struct group*)node; |
869 node = node->next; | 869 node = node->next; |
870 } | 870 } |
871 return NULL; | 871 return NULL; |
872 } | 872 } |
873 | |
874 struct chat * | |
875 gaim_blist_find_chat(GaimAccount *account, const char *name) | |
876 { | |
877 char *chat_name; | |
878 struct chat *chat; | |
879 GaimPlugin *prpl; | |
880 GaimPluginProtocolInfo *prpl_info = NULL; | |
881 struct proto_chat_entry *pce; | |
882 GaimBlistNode *node, *group; | |
883 GList *parts; | |
884 | |
885 g_return_val_if_fail(gaim_get_blist() != NULL, NULL); | |
886 g_return_val_if_fail(name != NULL, NULL); | |
887 | |
888 for (group = gaimbuddylist->root; group != NULL; group = group->next) { | |
889 for (node = group->child; node != NULL; node = node->next) { | |
890 if (GAIM_BLIST_NODE_IS_CHAT(node)) { | |
891 | |
892 chat = (struct chat *)node; | |
893 | |
894 prpl = gaim_find_prpl(gaim_account_get_protocol(chat->account)); | |
895 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); | |
896 | |
897 parts = prpl_info->chat_info( | |
898 gaim_account_get_connection(chat->account)); | |
899 | |
900 pce = parts->data; | |
901 chat_name = g_hash_table_lookup(chat->components, | |
902 pce->identifier); | |
903 | |
904 if (chat->account == account && | |
905 name != NULL && !strcmp(chat_name, name)) { | |
906 | |
907 return chat; | |
908 } | |
909 } | |
910 } | |
911 } | |
912 | |
913 return NULL; | |
914 } | |
915 | |
916 struct group * | |
917 gaim_blist_chat_get_group(struct chat *chat) | |
918 { | |
919 g_return_val_if_fail(chat != NULL, NULL); | |
920 | |
921 return (struct group *)(((GaimBlistNode *)chat)->parent); | |
922 } | |
923 | |
873 struct group *gaim_find_buddys_group(struct buddy *buddy) | 924 struct group *gaim_find_buddys_group(struct buddy *buddy) |
874 { | 925 { |
875 if (!buddy) | 926 if (!buddy) |
876 return NULL; | 927 return NULL; |
877 return (struct group*)(((GaimBlistNode*)buddy)->parent); | 928 return (struct group*)(((GaimBlistNode*)buddy)->parent); |