| 1165 msim_lookup_user(session, userid, msim_status_cb, status_str); |
1165 msim_lookup_user(session, userid, msim_status_cb, status_str); |
| 1166 |
1166 |
| 1167 return TRUE; |
1167 return TRUE; |
| 1168 } |
1168 } |
| 1169 |
1169 |
| |
1170 /** Allow user to add a buddy to their buddy list. TODO: make work. Should receive statuses from added buddy. */ |
| |
1171 void msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
| |
1172 { |
| |
1173 MsimSession *session; |
| |
1174 |
| |
1175 session = (MsimSession *)gc->proto_data; |
| |
1176 purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n", buddy->name, |
| |
1177 group ? group->name : "(no group)"); |
| |
1178 |
| |
1179 if (!msim_send(session, |
| |
1180 "addbuddy", MSIM_TYPE_BOOLEAN, TRUE, |
| |
1181 "sesskey", MSIM_TYPE_STRING, g_strdup(session->sesskey), |
| |
1182 /* Currently only allow numeric ID. TODO: Lookup screen name/email to uid. */ |
| |
1183 "newprofileid", MSIM_TYPE_STRING, g_strdup(buddy->name), |
| |
1184 "reason", MSIM_TYPE_STRING, g_strdup(""), |
| |
1185 NULL)) |
| |
1186 { |
| |
1187 purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("'addbuddy' command failed.")); |
| |
1188 } |
| |
1189 |
| |
1190 /* TODO: update blocklist */ |
| |
1191 |
| |
1192 if (!msim_send(session, |
| |
1193 "persist", MSIM_TYPE_INTEGER, 1, |
| |
1194 "sesskey", MSIM_TYPE_STRING, g_strdup(session->sesskey), |
| |
1195 "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_PUT, |
| |
1196 "dsn", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_DSN, |
| |
1197 "lid", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_LID, |
| |
1198 /* TODO: msim_send_persist, to handle all this rid business */ |
| |
1199 "rid", MSIM_TYPE_INTEGER, session->next_rid++, |
| |
1200 "body", MSIM_TYPE_STRING, |
| |
1201 g_strdup_printf("ContactID=%s\034" |
| |
1202 "GroupName=%s\034" |
| |
1203 "Position=1000\034" |
| |
1204 "Visibility=1\034" |
| |
1205 "NickName=\034" |
| |
1206 "NameSelect=0", |
| |
1207 buddy->name, group->name))) |
| |
1208 { |
| |
1209 purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("persist command failed")); |
| |
1210 } |
| |
1211 } |
| |
1212 |
| 1170 |
1213 |
| 1171 |
1214 |
| 1172 /** |
1215 /** |
| 1173 * Callback when input available. |
1216 * Callback when input available. |
| 1174 * |
1217 * |
| 1175 * @param gc_uncasted A PurpleConnection pointer. |
1218 * @param gc_uncasted A PurpleConnection pointer. |
| 1176 * @param source File descriptor. |
1219 * @param source File descriptor. |
| 1177 * @param cond PURPLE_INPUT_READ |
1220 * @param cond PURPLE_INPUT_READ |
| 1178 * |
1221 * |
| 1179 * Reads the input, and dispatches calls msim_process to handle it. |
1222 * Reads the input, and dispatches msim_process() to handle it. |
| 1180 */ |
1223 */ |
| 1181 void msim_input_cb(gpointer gc_uncasted, gint source, PurpleInputCondition cond) |
1224 void msim_input_cb(gpointer gc_uncasted, gint source, PurpleInputCondition cond) |
| 1182 { |
1225 { |
| 1183 PurpleConnection *gc; |
1226 PurpleConnection *gc; |
| 1184 PurpleAccount *account; |
1227 PurpleAccount *account; |
| 1601 msim_send_typing, /* send_typing */ |
1646 msim_send_typing, /* send_typing */ |
| 1602 NULL, /* get_info */ |
1647 NULL, /* get_info */ |
| 1603 NULL, /* set_away */ |
1648 NULL, /* set_away */ |
| 1604 NULL, /* set_idle */ |
1649 NULL, /* set_idle */ |
| 1605 NULL, /* change_passwd */ |
1650 NULL, /* change_passwd */ |
| 1606 NULL, /* add_buddy TODO */ |
1651 msim_add_buddy, /* add_buddy TODO */ |
| 1607 NULL, /* add_buddies */ |
1652 NULL, /* add_buddies */ |
| 1608 NULL, /* remove_buddy TODO */ |
1653 NULL, /* remove_buddy TODO */ |
| 1609 NULL, /* remove_buddies */ |
1654 NULL, /* remove_buddies */ |
| 1610 NULL, /* add_permit */ |
1655 NULL, /* add_permit */ |
| 1611 NULL, /* add_deny */ |
1656 NULL, /* add_deny */ |