Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/google.c @ 28729:ed88200c79ee
A leak fix in the candidate list, and some code simplification.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 10 Oct 2009 19:44:44 +0000 |
parents | 67a97fca157c |
children | 51d507e6c8f3 |
comparison
equal
deleted
inserted
replaced
28725:401a00227615 | 28729:ed88200c79ee |
---|---|
93 static void | 93 static void |
94 google_session_send_candidates(PurpleMedia *media, gchar *session_id, | 94 google_session_send_candidates(PurpleMedia *media, gchar *session_id, |
95 gchar *participant, GoogleSession *session) | 95 gchar *participant, GoogleSession *session) |
96 { | 96 { |
97 GList *candidates = purple_media_get_local_candidates( | 97 GList *candidates = purple_media_get_local_candidates( |
98 session->media, session_id, session->remote_jid); | 98 session->media, session_id, session->remote_jid), *iter; |
99 PurpleMediaCandidate *transport; | 99 PurpleMediaCandidate *transport; |
100 gboolean video = FALSE; | 100 gboolean video = FALSE; |
101 | 101 |
102 if (!strcmp(session_id, "google-video")) | 102 if (!strcmp(session_id, "google-video")) |
103 video = TRUE; | 103 video = TRUE; |
104 | 104 |
105 for (;candidates;candidates = candidates->next) { | 105 for (iter = candidates; iter; iter = iter->next) { |
106 JabberIq *iq; | 106 JabberIq *iq; |
107 gchar *ip, *port, *username, *password; | 107 gchar *ip, *port, *username, *password; |
108 gchar pref[16]; | 108 gchar pref[16]; |
109 PurpleMediaCandidateType type; | 109 PurpleMediaCandidateType type; |
110 xmlnode *sess; | 110 xmlnode *sess; |
111 xmlnode *candidate; | 111 xmlnode *candidate; |
112 guint component_id; | 112 guint component_id; |
113 transport = (PurpleMediaCandidate*)(candidates->data); | 113 transport = PURPLE_MEDIA_CANDIDATE(iter->data); |
114 component_id = purple_media_candidate_get_component_id( | 114 component_id = purple_media_candidate_get_component_id( |
115 transport); | 115 transport); |
116 | 116 |
117 iq = jabber_iq_new(session->js, JABBER_IQ_SET); | 117 iq = jabber_iq_new(session->js, JABBER_IQ_SET); |
118 sess = google_session_create_xmlnode(session, "candidates"); | 118 sess = google_session_create_xmlnode(session, "candidates"); |
166 g_free(username); | 166 g_free(username); |
167 g_free(password); | 167 g_free(password); |
168 | 168 |
169 jabber_iq_send(iq); | 169 jabber_iq_send(iq); |
170 } | 170 } |
171 purple_media_candidate_list_free(candidates); | |
171 } | 172 } |
172 | 173 |
173 static void | 174 static void |
174 google_session_ready(GoogleSession *session) | 175 google_session_ready(GoogleSession *session) |
175 { | 176 { |