Mercurial > pidgin
comparison src/protocols/oscar/oscar.c @ 2791:8f6365332a05
[gaim-migrate @ 2804]
i hate this shit. i should just stop hacking gaim.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 26 Nov 2001 20:39:54 +0000 |
parents | e8a2f3b92348 |
children | ccb5b2f05d16 |
comparison
equal
deleted
inserted
replaced
2790:0148422dff4d | 2791:8f6365332a05 |
---|---|
97 GSList *direct_ims; | 97 GSList *direct_ims; |
98 GSList *hasicons; | 98 GSList *hasicons; |
99 | 99 |
100 gboolean killme; | 100 gboolean killme; |
101 gboolean icq; | 101 gboolean icq; |
102 GSList *evilhack; | |
102 }; | 103 }; |
103 | 104 |
104 struct chat_connection { | 105 struct chat_connection { |
105 char *name; | 106 char *name; |
106 char *show; /* AOL did something funny to us */ | 107 char *show; /* AOL did something funny to us */ |
518 struct icon_req *n = odata->hasicons->data; | 519 struct icon_req *n = odata->hasicons->data; |
519 g_free(n->user); | 520 g_free(n->user); |
520 odata->hasicons = g_slist_remove(odata->hasicons, n); | 521 odata->hasicons = g_slist_remove(odata->hasicons, n); |
521 g_free(n); | 522 g_free(n); |
522 } | 523 } |
524 while (odata->evilhack) { | |
525 g_free(odata->evilhack->data); | |
526 odata->evilhack = g_slist_remove(odata->evilhack, odata->evilhack->data); | |
527 } | |
523 if (odata->create_name) | 528 if (odata->create_name) |
524 g_free(odata->create_name); | 529 g_free(odata->create_name); |
525 if (odata->email) | 530 if (odata->email) |
526 g_free(odata->email); | 531 g_free(odata->email); |
527 if (odata->newp) | 532 if (odata->newp) |
1553 | 1558 |
1554 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { | 1559 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
1555 aim_userinfo_t *info; | 1560 aim_userinfo_t *info; |
1556 char *prof_enc = NULL, *prof = NULL; | 1561 char *prof_enc = NULL, *prof = NULL; |
1557 fu16_t infotype; | 1562 fu16_t infotype; |
1558 char buf[BUF_LONG]; | 1563 char header[BUF_LONG]; |
1559 char legend[BUF_LONG]; | 1564 char legend[BUF_LONG]; |
1560 struct gaim_connection *gc = sess->aux_data; | 1565 struct gaim_connection *gc = sess->aux_data; |
1566 struct oscar_data *od = gc->proto_data; | |
1567 GSList *l = od->evilhack; | |
1568 gboolean evilhack = FALSE; | |
1561 gboolean away; | 1569 gboolean away; |
1562 va_list ap; | 1570 va_list ap; |
1563 char *asc; | 1571 char *asc; |
1564 | 1572 |
1565 va_start(ap, fr); | 1573 va_start(ap, fr); |
1575 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>" | 1583 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>" |
1576 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>" | 1584 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>" |
1577 "<IMG SRC=\"admin_icon.gif\"> : Administrator")); | 1585 "<IMG SRC=\"admin_icon.gif\"> : Administrator")); |
1578 | 1586 |
1579 away = infotype != AIM_GETINFO_GENERALINFO; | 1587 away = infotype != AIM_GETINFO_GENERALINFO; |
1580 if (away && (!prof || !*prof)) { | |
1581 g_show_info_text(gc, info->sn, away, legend, NULL); | |
1582 return 1; | |
1583 } | |
1584 | 1588 |
1585 if (info->membersince) | 1589 if (info->membersince) |
1586 asc = g_strdup_printf("Member Since : <B>%s</B><BR>\n", | 1590 asc = g_strdup_printf("Member Since : <B>%s</B><BR>\n", |
1587 asctime(localtime(&info->membersince))); | 1591 asctime(localtime(&info->membersince))); |
1588 else | 1592 else |
1589 asc = g_strdup(""); | 1593 asc = g_strdup(""); |
1590 g_snprintf(buf, sizeof buf, | 1594 g_snprintf(header, sizeof header, |
1591 _("Username : <B>%s</B> %s <BR>\n" | 1595 _("Username : <B>%s</B> %s <BR>\n" |
1592 "%s" | 1596 "%s" |
1593 "Warning Level : <B>%d %%</B><BR>\n" | 1597 "Warning Level : <B>%d %%</B><BR>\n" |
1594 "Online Since : <B>%s</B><BR>\n" | 1598 "Online Since : <B>%s</B><BR>\n" |
1595 "Idle Minutes : <B>%d</B>\n<BR>\n<HR><BR>\n"), | 1599 "Idle Minutes : <B>%d</B>\n<BR>\n<HR><BR>\n"), |
1598 info->warnlevel/10, | 1602 info->warnlevel/10, |
1599 asctime(localtime(&info->onlinesince)), | 1603 asctime(localtime(&info->onlinesince)), |
1600 info->idletime); | 1604 info->idletime); |
1601 g_free(asc); | 1605 g_free(asc); |
1602 | 1606 |
1603 g_show_info_text(gc, info->sn, away, away ? "<br><hr>" : buf, | 1607 while (l) { |
1604 (prof && strlen(prof)) ? | 1608 char *x = l->data; |
1605 away_subs(prof, gc->username) | 1609 if (!strcmp(x, normalize(info->sn))) { |
1606 : | 1610 evilhack = TRUE; |
1607 away ? | 1611 g_free(x); |
1608 _("<i>User has no away message</i>") : | 1612 od->evilhack = g_slist_remove(od->evilhack, x); |
1609 _("<i>No Information Provided</i>"), | 1613 break; |
1610 legend, | 1614 } |
1611 NULL); | 1615 l = l->next; |
1616 } | |
1617 | |
1618 if (away) { | |
1619 if (evilhack) { | |
1620 g_show_info_text(gc, info->sn, 2, | |
1621 header, | |
1622 (prof && *prof) ? prof : | |
1623 _("<i>User has no away message</i>"), | |
1624 legend, NULL); | |
1625 } else { | |
1626 g_show_info_text(gc, info->sn, 0, | |
1627 header, | |
1628 (prof && *prof) ? prof : NULL, | |
1629 NULL); | |
1630 } | |
1631 } else { | |
1632 g_show_info_text(gc, info->sn, 1, | |
1633 "<BR><HR><BR>", | |
1634 (prof && *prof) ? prof : _("<i>No Information Provided</i>"), | |
1635 legend, | |
1636 NULL); | |
1637 } | |
1612 | 1638 |
1613 return 1; | 1639 return 1; |
1614 } | 1640 } |
1615 | 1641 |
1616 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { | 1642 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { |
2264 static void oscar_get_info(struct gaim_connection *g, char *name) { | 2290 static void oscar_get_info(struct gaim_connection *g, char *name) { |
2265 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | 2291 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
2266 if (odata->icq) | 2292 if (odata->icq) |
2267 aim_icq_getsimpleinfo(odata->sess, name); | 2293 aim_icq_getsimpleinfo(odata->sess, name); |
2268 else | 2294 else |
2269 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO); | 2295 /* people want the away message on the top, so we get the away message |
2270 } | 2296 * first and then get the regular info, since it's too difficult to |
2271 | 2297 * insert in the middle. i hate people. */ |
2272 /* | 2298 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE); |
2273 static void oscar_get_away_msg(struct gaim_connection *g, char *name) { | 2299 } |
2300 | |
2301 static void oscar_get_away(struct gaim_connection *g, char *name) { | |
2274 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | 2302 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
2275 if (!odata->icq) | 2303 if (!odata->icq) |
2276 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE); | 2304 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO); |
2277 } | 2305 } |
2278 */ | |
2279 | 2306 |
2280 static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, | 2307 static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, |
2281 char *maiden, char *city, char *state, char *country, int web) { | 2308 char *maiden, char *city, char *state, char *country, int web) { |
2282 /* FIXME : some of these things are wrong, but i'm lazy */ | 2309 /* FIXME : some of these things are wrong, but i'm lazy */ |
2283 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | 2310 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
2690 " Doing this will let them see your IP address, and may be" | 2717 " Doing this will let them see your IP address, and may be" |
2691 " a security risk. Do you wish to continue?"), who); | 2718 " a security risk. Do you wish to continue?"), who); |
2692 do_ask_dialog(buf, data, oscar_direct_im, oscar_cancel_direct_im); | 2719 do_ask_dialog(buf, data, oscar_direct_im, oscar_cancel_direct_im); |
2693 } | 2720 } |
2694 | 2721 |
2722 static void oscar_get_away_msg(struct gaim_connection *gc, char *who) { | |
2723 struct oscar_data *od = gc->proto_data; | |
2724 od->evilhack = g_slist_append(od->evilhack, g_strdup(normalize(who))); | |
2725 oscar_get_info(gc, who); | |
2726 } | |
2727 | |
2695 static GList *oscar_buddy_menu(struct gaim_connection *gc, char *who) { | 2728 static GList *oscar_buddy_menu(struct gaim_connection *gc, char *who) { |
2696 GList *m = NULL; | 2729 GList *m = NULL; |
2697 struct proto_buddy_menu *pbm; | 2730 struct proto_buddy_menu *pbm; |
2698 char *n = g_strdup(normalize(gc->username)); | 2731 char *n = g_strdup(normalize(gc->username)); |
2699 | 2732 |
2700 pbm = g_new0(struct proto_buddy_menu, 1); | 2733 pbm = g_new0(struct proto_buddy_menu, 1); |
2701 pbm->label = _("Get Info"); | 2734 pbm->label = _("Get Info"); |
2702 pbm->callback = oscar_get_info; | 2735 pbm->callback = oscar_get_info; |
2736 pbm->gc = gc; | |
2737 m = g_list_append(m, pbm); | |
2738 | |
2739 pbm = g_new0(struct proto_buddy_menu, 1); | |
2740 pbm->label = _("Get Away Msg"); | |
2741 pbm->callback = oscar_get_away_msg; | |
2703 pbm->gc = gc; | 2742 pbm->gc = gc; |
2704 m = g_list_append(m, pbm); | 2743 m = g_list_append(m, pbm); |
2705 | 2744 |
2706 if (strcmp(n, normalize(who))) { | 2745 if (strcmp(n, normalize(who))) { |
2707 pbm = g_new0(struct proto_buddy_menu, 1); | 2746 pbm = g_new0(struct proto_buddy_menu, 1); |
2913 ret->close = oscar_close; | 2952 ret->close = oscar_close; |
2914 ret->send_im = oscar_send_im; | 2953 ret->send_im = oscar_send_im; |
2915 ret->set_info = oscar_set_info; | 2954 ret->set_info = oscar_set_info; |
2916 ret->get_info = oscar_get_info; | 2955 ret->get_info = oscar_get_info; |
2917 ret->set_away = oscar_set_away; | 2956 ret->set_away = oscar_set_away; |
2918 ret->get_away = NULL; | 2957 ret->get_away = oscar_get_away; |
2919 ret->set_dir = oscar_set_dir; | 2958 ret->set_dir = oscar_set_dir; |
2920 ret->get_dir = NULL; /* Oscar really doesn't have this */ | 2959 ret->get_dir = NULL; /* Oscar really doesn't have this */ |
2921 ret->dir_search = oscar_dir_search; | 2960 ret->dir_search = oscar_dir_search; |
2922 ret->set_idle = oscar_set_idle; | 2961 ret->set_idle = oscar_set_idle; |
2923 ret->change_passwd = oscar_change_passwd; | 2962 ret->change_passwd = oscar_change_passwd; |