comparison src/protocols/oscar/oscar.c @ 2773:a0fd8f91e294

[gaim-migrate @ 2786] SPAM!!! All recipients of the email generated by this commit each owe me $125 per email sent, plus a $75 handling fee for all messages combined. Or was that supposed to be the other way around. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 20 Nov 2001 01:01:22 +0000
parents 8a918df1a5ed
children e8a2f3b92348
comparison
equal deleted inserted replaced
2772:f9227268db25 2773:a0fd8f91e294
1556 char *prof_enc = NULL, *prof = NULL; 1556 char *prof_enc = NULL, *prof = NULL;
1557 fu16_t infotype; 1557 fu16_t infotype;
1558 char buf[BUF_LONG]; 1558 char buf[BUF_LONG];
1559 char legend[BUF_LONG]; 1559 char legend[BUF_LONG];
1560 struct gaim_connection *gc = sess->aux_data; 1560 struct gaim_connection *gc = sess->aux_data;
1561 gboolean away;
1561 va_list ap; 1562 va_list ap;
1562 char *asc; 1563 char *asc;
1563 1564
1564 va_start(ap, fr); 1565 va_start(ap, fr);
1565 info = va_arg(ap, aim_userinfo_t *); 1566 info = va_arg(ap, aim_userinfo_t *);
1566 prof_enc = va_arg(ap, char *); 1567 prof_enc = va_arg(ap, char *);
1567 prof = va_arg(ap, char *); 1568 prof = va_arg(ap, char *);
1568 infotype = (fu16_t)va_arg(ap, unsigned int); 1569 infotype = (fu16_t)va_arg(ap, unsigned int);
1569 va_end(ap); 1570 va_end(ap);
1571
1572 g_snprintf(legend, sizeof legend,
1573 _("<br><BODY BGCOLOR=WHITE><hr><I>Legend:</I><br><br>"
1574 "<IMG SRC=\"free_icon.gif\"> : Normal AIM User<br>"
1575 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>"
1576 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>"
1577 "<IMG SRC=\"admin_icon.gif\"> : Administrator"));
1578
1579 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 }
1570 1584
1571 if (info->membersince) 1585 if (info->membersince)
1572 asc = g_strdup_printf("Member Since : <B>%s</B><BR>\n", 1586 asc = g_strdup_printf("Member Since : <B>%s</B><BR>\n",
1573 asctime(localtime(&info->membersince))); 1587 asctime(localtime(&info->membersince)));
1574 else 1588 else
1575 asc = g_strdup(""); 1589 asc = g_strdup("");
1576
1577 g_snprintf(buf, sizeof buf, 1590 g_snprintf(buf, sizeof buf,
1578 _("Username : <B>%s</B> %s <BR>\n" 1591 _("Username : <B>%s</B> %s <BR>\n"
1579 "%s" 1592 "%s"
1580 "Warning Level : <B>%d %%</B><BR>\n" 1593 "Warning Level : <B>%d %%</B><BR>\n"
1581 "Online Since : <B>%s</B><BR>\n" 1594 "Online Since : <B>%s</B><BR>\n"
1583 info->sn, images(info->flags), 1596 info->sn, images(info->flags),
1584 asc, 1597 asc,
1585 info->warnlevel/10, 1598 info->warnlevel/10,
1586 asctime(localtime(&info->onlinesince)), 1599 asctime(localtime(&info->onlinesince)),
1587 info->idletime); 1600 info->idletime);
1588 g_snprintf(legend, sizeof legend, 1601 g_free(asc);
1589 _("<br><BODY BGCOLOR=WHITE><hr><I>Legend:</I><br><br>" 1602
1590 "<IMG SRC=\"free_icon.gif\"> : Normal AIM User<br>" 1603 g_show_info_text(gc, info->sn, away, away ? "<br><hr>" : buf,
1591 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>"
1592 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>"
1593 "<IMG SRC=\"admin_icon.gif\"> : Administrator"));
1594 g_show_info_text(buf,
1595 (prof && strlen(prof)) ? 1604 (prof && strlen(prof)) ?
1596 away_subs(prof, gc->username) 1605 away_subs(prof, gc->username)
1597 : 1606 :
1598 (infotype == AIM_GETINFO_GENERALINFO ? 1607 away ?
1599 _("<i>No Information Provided</i>") : 1608 _("<i>User has no away message</i>") :
1600 _("<i>User has no away message</i>")), 1609 _("<i>No Information Provided</i>"),
1601 legend, 1610 away ? legend : NULL,
1602 NULL); 1611 NULL);
1603
1604 g_free(asc);
1605 1612
1606 return 1; 1613 return 1;
1607 } 1614 }
1608 1615
1609 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { 1616 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) {
2045 return 1; 2052 return 1;
2046 } 2053 }
2047 2054
2048 static int gaim_simpleinfo(aim_session_t *sess, aim_frame_t *fr, ...) 2055 static int gaim_simpleinfo(aim_session_t *sess, aim_frame_t *fr, ...)
2049 { 2056 {
2057 struct gaim_connection *gc = sess->aux_data;
2050 va_list ap; 2058 va_list ap;
2051 struct aim_icq_simpleinfo *info; 2059 struct aim_icq_simpleinfo *info;
2052 char buf[16 * 1024]; 2060 char buf[16 * 1024];
2061 char who[16];
2053 2062
2054 va_start(ap, fr); 2063 va_start(ap, fr);
2055 info = va_arg(ap, struct aim_icq_simpleinfo *); 2064 info = va_arg(ap, struct aim_icq_simpleinfo *);
2056 va_end(ap); 2065 va_end(ap);
2057 2066
2067 g_snprintf(who, sizeof who, "%lu", info->uin);
2058 g_snprintf(buf, sizeof buf, 2068 g_snprintf(buf, sizeof buf,
2059 "<B>UIN:</B> %lu<BR>" 2069 "<B>UIN:</B> %lu<BR>"
2060 "<B>Nick:</B> %s<BR>" 2070 "<B>Nick:</B> %s<BR>"
2061 "<B>Name:</B> %s %s<BR>" 2071 "<B>Name:</B> %s %s<BR>"
2062 "<B>Email:</B> %s\n", 2072 "<B>Email:</B> %s\n",
2063 info->uin, 2073 info->uin,
2064 info->nick, 2074 info->nick,
2065 info->first, info->last, 2075 info->first, info->last,
2066 info->email); 2076 info->email);
2067 2077
2068 g_show_info_text(buf, NULL); 2078 g_show_info_text(gc, who, FALSE, buf, NULL);
2069 2079
2070 return 1; 2080 return 1;
2071 } 2081 }
2072 2082
2073 static int gaim_popup(aim_session_t *sess, aim_frame_t *fr, ...) 2083 static int gaim_popup(aim_session_t *sess, aim_frame_t *fr, ...)
2105 len = num * (MAXSNLEN + 1) + 1024; 2115 len = num * (MAXSNLEN + 1) + 1024;
2106 buf = g_malloc(len); 2116 buf = g_malloc(len);
2107 at += g_snprintf(buf + at, len - at, "<B>%s has the following screen names:</B><BR>", address); 2117 at += g_snprintf(buf + at, len - at, "<B>%s has the following screen names:</B><BR>", address);
2108 for (i = 0; i < num; i++) 2118 for (i = 0; i < num; i++)
2109 at += g_snprintf(buf + at, len - at, "%s<BR>", &SNs[i * (MAXSNLEN + 1)]); 2119 at += g_snprintf(buf + at, len - at, "%s<BR>", &SNs[i * (MAXSNLEN + 1)]);
2110 g_show_info_text(buf, NULL); 2120 g_show_info_text(NULL, NULL, FALSE, buf, NULL);
2111 g_free(buf); 2121 g_free(buf);
2112 2122
2113 return 1; 2123 return 1;
2114 } 2124 }
2115 2125
2259 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO); 2269 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO);
2260 } 2270 }
2261 2271
2262 static void oscar_get_away_msg(struct gaim_connection *g, char *name) { 2272 static void oscar_get_away_msg(struct gaim_connection *g, char *name) {
2263 struct oscar_data *odata = (struct oscar_data *)g->proto_data; 2273 struct oscar_data *odata = (struct oscar_data *)g->proto_data;
2264 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE); 2274 if (!odata->icq)
2275 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE);
2265 } 2276 }
2266 2277
2267 static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, 2278 static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last,
2268 char *maiden, char *city, char *state, char *country, int web) { 2279 char *maiden, char *city, char *state, char *country, int web) {
2269 /* FIXME : some of these things are wrong, but i'm lazy */ 2280 /* FIXME : some of these things are wrong, but i'm lazy */
2688 pbm->label = _("Get Info"); 2699 pbm->label = _("Get Info");
2689 pbm->callback = oscar_get_info; 2700 pbm->callback = oscar_get_info;
2690 pbm->gc = gc; 2701 pbm->gc = gc;
2691 m = g_list_append(m, pbm); 2702 m = g_list_append(m, pbm);
2692 2703
2693 pbm = g_new0(struct proto_buddy_menu, 1);
2694 pbm->label = _("Get Away Msg");
2695 pbm->callback = oscar_get_away_msg;
2696 pbm->gc = gc;
2697 m = g_list_append(m, pbm);
2698
2699 if (strcmp(n, normalize(who))) { 2704 if (strcmp(n, normalize(who))) {
2700 pbm = g_new0(struct proto_buddy_menu, 1); 2705 pbm = g_new0(struct proto_buddy_menu, 1);
2701 pbm->label = _("Direct IM"); 2706 pbm->label = _("Direct IM");
2702 pbm->callback = oscar_ask_direct_im; 2707 pbm->callback = oscar_ask_direct_im;
2703 pbm->gc = gc; 2708 pbm->gc = gc;
2906 ret->close = oscar_close; 2911 ret->close = oscar_close;
2907 ret->send_im = oscar_send_im; 2912 ret->send_im = oscar_send_im;
2908 ret->set_info = oscar_set_info; 2913 ret->set_info = oscar_set_info;
2909 ret->get_info = oscar_get_info; 2914 ret->get_info = oscar_get_info;
2910 ret->set_away = oscar_set_away; 2915 ret->set_away = oscar_set_away;
2916 ret->get_away = oscar_get_away_msg;
2911 ret->set_dir = oscar_set_dir; 2917 ret->set_dir = oscar_set_dir;
2912 ret->get_dir = NULL; /* Oscar really doesn't have this */ 2918 ret->get_dir = NULL; /* Oscar really doesn't have this */
2913 ret->dir_search = oscar_dir_search; 2919 ret->dir_search = oscar_dir_search;
2914 ret->set_idle = oscar_set_idle; 2920 ret->set_idle = oscar_set_idle;
2915 ret->change_passwd = oscar_change_passwd; 2921 ret->change_passwd = oscar_change_passwd;