9 LmMessageNode *child = NULL; |
9 LmMessageNode *child = NULL; |
10 |
10 |
11 if (!strcmp(ij->name, "jingle")) |
11 if (!strcmp(ij->name, "jingle")) |
12 return PARSE_ERROR_NAME; |
12 return PARSE_ERROR_NAME; |
13 |
13 |
14 ij->action = attrcpy(lm_message_node_get_attribute(node, "action")); |
14 ij->action = g_strdup(lm_message_node_get_attribute(node, "action")); |
15 ij->initiator = attrcpy(lm_message_node_get_attribute(node, "initiator")); |
15 ij->initiator = g_strdup(lm_message_node_get_attribute(node, "initiator")); |
16 ij->responder = attrcpy(lm_message_node_get_attribute(node, "responder")); |
16 ij->responder = g_strdup(lm_message_node_get_attribute(node, "responder")); |
17 ij->sid = attrcpy(lm_message_node_get_attribute(node, "sid")); |
17 ij->sid = g_strdup(lm_message_node_get_attribute(node, "sid")); |
18 |
18 |
19 // check required |
19 // check required |
20 if (ij->action == NULL || ij->sid == NULL) |
20 if (ij->action == NULL || ij->sid == NULL) |
21 return PARSE_ERROR_REQUIRED; |
21 return PARSE_ERROR_REQUIRED; |
22 |
22 |
41 } |
41 } |
42 |
42 |
43 |
43 |
44 void free_jingle(struct info_jingle *ij) |
44 void free_jingle(struct info_jingle *ij) |
45 { |
45 { |
46 free(ij->action); |
46 g_free(ij->action); |
47 free(ij->initiator); |
47 g_free(ij->initiator); |
48 free(ij->responder); |
48 g_free(ij->responder); |
49 free(ij->sid); |
49 g_free(ij->sid); |
50 } |
50 } |
51 |
51 |
52 |
52 |
53 int parse_content(LmMessageNode* node, struct info_content* ic) |
53 int parse_content(LmMessageNode* node, struct info_content* ic) |
54 { |
54 { |
55 if (!strcmp(ic->name, "content")) |
55 if (!strcmp(ic->name, "content")) |
56 return PARSE_ERROR_NAME; |
56 return PARSE_ERROR_NAME; |
57 |
57 |
58 ic->creator = attrcpy(lm_message_node_get_attribute(node, "creator")); |
58 ic->creator = g_strdup(lm_message_node_get_attribute(node, "creator")); |
59 ic->disposition = attrcpy(lm_message_node_get_attribute(node, "disposition")); |
59 ic->disposition = g_strdup(lm_message_node_get_attribute(node, "disposition")); |
60 ic->name = attrcpy(lm_message_node_get_attribute(node, "name")); |
60 ic->name = g_strdup(lm_message_node_get_attribute(node, "name")); |
61 ic->senders = attrcpy(lm_message_node_get_attribute(node, "senders")); |
61 ic->senders = g_strdup(lm_message_node_get_attribute(node, "senders")); |
62 |
62 |
63 // Put default if none |
63 // Put default if none |
64 if (ic->disposition == NULL) |
64 if (ic->disposition == NULL) |
65 ic->disposition = attrcpy("session"); |
65 ic->disposition = g_strdup("session"); |
66 |
66 |
67 // check required |
67 // check required |
68 if (ic->creator == NULL || ic->name == NULL) |
68 if (ic->creator == NULL || ic->name == NULL) |
69 return PARSE_ERROR_REQUIRED; |
69 return PARSE_ERROR_REQUIRED; |
70 |
70 |