libpurple/protocols/jabber/google/google_session.c

changeset 30756
4f357819d93b
parent 30749
00eda6a032b5
child 30757
ca36f52b5f77
child 30773
530a74a5b97e
equal deleted inserted replaced
30755:10446db8b003 30756:4f357819d93b
541 const gchar *cname = xmlnode_get_attrib(cand, "name"); 541 const gchar *cname = xmlnode_get_attrib(cand, "name");
542 const gchar *type = xmlnode_get_attrib(cand, "type"); 542 const gchar *type = xmlnode_get_attrib(cand, "type");
543 const gchar *protocol = xmlnode_get_attrib(cand, "protocol"); 543 const gchar *protocol = xmlnode_get_attrib(cand, "protocol");
544 const gchar *address = xmlnode_get_attrib(cand, "address"); 544 const gchar *address = xmlnode_get_attrib(cand, "address");
545 const gchar *port = xmlnode_get_attrib(cand, "port"); 545 const gchar *port = xmlnode_get_attrib(cand, "port");
546 const gchar *priority = xmlnode_get_attrib(cand, "priority");
546 guint component_id; 547 guint component_id;
547 548
548 if (cname && type && address && port) { 549 if (cname && type && address && port) {
549 PurpleMediaCandidateType candidate_type; 550 PurpleMediaCandidateType candidate_type;
550 551 guint prio = priority ? atof(priority) * 1000 : 0;
552
551 g_snprintf(n, sizeof(n), "S%d", name++); 553 g_snprintf(n, sizeof(n), "S%d", name++);
552 554
553 if (g_str_equal(type, "local")) 555 if (g_str_equal(type, "local"))
554 candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_HOST; 556 candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_HOST;
555 else if (g_str_equal(type, "stun")) 557 else if (g_str_equal(type, "stun"))
556 candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX; 558 candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX;
557 else if (g_str_equal(type, "relay")) 559 else if (g_str_equal(type, "relay"))
571 PURPLE_MEDIA_NETWORK_PROTOCOL_UDP : 573 PURPLE_MEDIA_NETWORK_PROTOCOL_UDP :
572 PURPLE_MEDIA_NETWORK_PROTOCOL_TCP, 574 PURPLE_MEDIA_NETWORK_PROTOCOL_TCP,
573 address, 575 address,
574 atoi(port)); 576 atoi(port));
575 g_object_set(info, "username", xmlnode_get_attrib(cand, "username"), 577 g_object_set(info, "username", xmlnode_get_attrib(cand, "username"),
576 "password", xmlnode_get_attrib(cand, "password"), NULL); 578 "password", xmlnode_get_attrib(cand, "password"),
579 "priority", prio, NULL);
577 if (!strncmp(cname, "video_", 6)) 580 if (!strncmp(cname, "video_", 6))
578 video_list = g_list_append(video_list, info); 581 video_list = g_list_append(video_list, info);
579 else 582 else
580 list = g_list_append(list, info); 583 list = g_list_append(list, info);
581 } 584 }

mercurial