Mercurial > pidgin.yaz
comparison libpurple/plugins/joinpart.c @ 22458:22fce0be8ed0
Fix a memory leak
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Thu, 13 Mar 2008 01:24:21 +0000 |
parents | 3cc856ca2338 |
children | 13ca254ea7db |
comparison
equal
deleted
inserted
replaced
22453:34b8d1107b06 | 22458:22fce0be8ed0 |
---|---|
75 static gboolean should_hide_notice(PurpleConversation *conv, const char *name, | 75 static gboolean should_hide_notice(PurpleConversation *conv, const char *name, |
76 GHashTable *users) | 76 GHashTable *users) |
77 { | 77 { |
78 PurpleConvChat *chat; | 78 PurpleConvChat *chat; |
79 int threshold; | 79 int threshold; |
80 struct joinpart_key *key; | 80 struct joinpart_key key; |
81 time_t *last_said; | 81 time_t *last_said; |
82 | 82 |
83 g_return_val_if_fail(conv != NULL, FALSE); | 83 g_return_val_if_fail(conv != NULL, FALSE); |
84 g_return_val_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT, FALSE); | 84 g_return_val_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT, FALSE); |
85 | 85 |
92 /* We always care about our buddies! */ | 92 /* We always care about our buddies! */ |
93 if (purple_find_buddy(purple_conversation_get_account(conv), name)) | 93 if (purple_find_buddy(purple_conversation_get_account(conv), name)) |
94 return FALSE; | 94 return FALSE; |
95 | 95 |
96 /* Only show the notice if the user has spoken recently. */ | 96 /* Only show the notice if the user has spoken recently. */ |
97 key = g_new(struct joinpart_key, 1); | 97 key.conv = conv; |
98 key->conv = conv; | 98 key.user = (gchar *)name; |
99 key->user = g_strdup(name); | 99 last_said = g_hash_table_lookup(users, &key); |
100 last_said = g_hash_table_lookup(users, key); | |
101 if (last_said != NULL) | 100 if (last_said != NULL) |
102 { | 101 { |
103 int delay = purple_prefs_get_int(DELAY_PREF); | 102 int delay = purple_prefs_get_int(DELAY_PREF); |
104 if (delay > 0 && (*last_said + (delay * 60)) >= time(NULL)) | 103 if (delay > 0 && (*last_said + (delay * 60)) >= time(NULL)) |
105 return FALSE; | 104 return FALSE; |