diff options
author | ulim <a.sporto+bee@gmail.com> | 2008-02-15 18:38:57 +0100 |
---|---|---|
committer | ulim <a.sporto+bee@gmail.com> | 2008-02-15 18:38:57 +0100 |
commit | 1ba7e8f1d28c4876ea0b787f1e4ebb5607f48895 (patch) | |
tree | 5ba8bed0e1ba83c56a855059e88e3d2a205fe88c /protocols/oscar/oscar.c | |
parent | 0fbd3a6d26d8fe747bd5e061748e75f397801064 (diff) | |
parent | eeb85a8a880fefe655eb31b6322136b61ee969e2 (diff) |
Merged with upstream r328
Wilmer van der Gaast 2008-02-11 Got rid of some noise at startup: complaining when the default configuration
Wilmer van der Gaast 2008-02-10 Added support for password-protected Jabber chatrooms.
Wilmer van der Gaast 2008-02-10 Making AI_ADDRCONFIG optional, it doesn't exist on at least NetBSD and
Wilmer van der Gaast 2008-02-09 Restored "add -tmp". A bit hackish, but it will do for now.
Wilmer van der Gaast 2008-02-07 Fixed getnameinfo() calls, this fixes Solaris stability issues. Thanks to
Wilmer van der Gaast 2008-02-04 Added bogus G_GNUC_MALLOC to restore GLib 2.4 compatibility (hopefully).
Wilmer van der Gaast 2008-02-03 Messages from the user are also included in backlogs when joining a Jabber
Wilmer van der Gaast 2008-02-03 Disabling "Unknown command" warnings since they're very noisy and pretty
Wilmer van der Gaast 2008-02-03 Implemented XEP-0115. This adds some info to the <presence/> tags so
Wilmer van der Gaast 2008-02-03 Saner garbage collection of cached packets in the Jabber module. Now
Wilmer van der Gaast 2008-02-02 Added help_free() and cleaned up some very stale help-related stuff I
Wilmer van der Gaast 2008-01-30 Fixed handling of OSCAR multi-part messages... They're not arrays, they're
Wilmer van der Gaast 2008-01-24 Keeping track of valid Jabber connections so _connected() events will be
Wilmer van der Gaast 2008-01-24 Fixed two valgrind warnings (partially uninitialized "struct tm" vars.)
Wilmer van der Gaast 2008-01-20 The Jabber module now uses imcb_chat_log() instead of imcb_log() where
Wilmer van der Gaast 2008-01-20 Added imcb_chat_log() for chatroom system messages, so they can be
Wilmer van der Gaast 2008-01-20 GET_BUDDY_FIRST wasn't actually implemented, even though it was in use
Wilmer van der Gaast 2008-01-19 Using test -f instead of test -e. This breaks if the include files are
Wilmer van der Gaast 2008-01-19 Added byte swapping code to the new MD5 checksumming code to make it work
Wilmer van der Gaast 2008-01-18 Moving imcb_chat_new() to a saner location (no code changes) and fixing
Wilmer van der Gaast 2008-01-17 Apparently ext_yahoo_got_im can be called with msg=NULL, so it should be
Wilmer van der Gaast 2008-01-17 Fixing some Solaris compiler warnings (u_int->uint, adding some typecasts
Wilmer van der Gaast 2008-01-13 Fixed handing of failed groupchat joins.
Wilmer van der Gaast 2008-01-13 Fixed "Conditional jump or move depends on uninitialised value(s)" at
Wilmer van der Gaast 2008-01-13 Fixed quickstart2. (Bug #349.)
Wilmer van der Gaast 2008-01-13 Different handling of charset mismatches before login time. Ignoring a
Wilmer van der Gaast 2008-01-12 When a switchboard connection dies (at the TCP level) and there are still
Wilmer van der Gaast 2008-01-12 Killed info_string_append() and now showing the IP address of ICQ users
Wilmer van der Gaast 2008-01-11 Fixing bug #344, now away states should always be correct, even when people
Wilmer van der Gaast 2008-01-11 Adding own handle to protocol name in blist output for people with multiple
Wilmer van der Gaast 2008-01-10 Now setting odata->icq properly again, this got lost some time ago, which
Wilmer van der Gaast 2008-01-06 More consistency in error/warning errors. Until now "WARNING:" was usually
Wilmer van der Gaast 2008-01-06 Changed warning message about unsent MSN messages. It should show the actual
Wilmer van der Gaast 2008-01-05 Added "mail_notifications" setting. Who needs those notifications anyway?
Wilmer van der Gaast 2008-01-05 Build fix from vmiklos.
Wilmer van der Gaast 2008-01-05 Added handling of MSN switchboard NAK messages. Untested, but hey, it
Wilmer van der Gaast 2008-01-05 Removed closure->result. I was planning to add some more stuff, but will
Miklos Vajna 2007-12-31 encode: md5.c is no longer in protocols/, it's in lib/
Wilmer van der Gaast 2007-12-28 Fixed return value check in proxy_connect(), since on some systems
Wilmer van der Gaast 2007-12-28 Added missing return in jabber_login().
Wilmer van der Gaast 2007-12-16 Implemented XEP-0199 (patch from misc@mandriva.org).
Wilmer van der Gaast 2007-12-12 Checking conn->xcred before trying to clean it up since GnuTLS doesn't
Wilmer van der Gaast 2007-12-12 Killed the <server> parameter to "account add" and changed the default
Wilmer van der Gaast 2007-12-12 Fixed sockerr_again() usage in Jabber module to (hopefully) fix a 100% CPU
Wilmer van der Gaast 2007-12-10 Don't allow nicks that start with a number.
Wilmer van der Gaast 2007-12-10 Fixed "set xxx" syntax (it showed all settings instead of just xxx).
Wilmer van der Gaast 2007-12-09 If I keep forgetting to credit people in commit msgs I should probably add
Wilmer van der Gaast 2007-12-09 Added /invite support for Jabber chatrooms (and fixed the argument order
Diffstat (limited to 'protocols/oscar/oscar.c')
-rw-r--r-- | protocols/oscar/oscar.c | 200 |
1 files changed, 112 insertions, 88 deletions
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index c4683046..9e5de70a 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -90,6 +90,8 @@ struct oscar_data { gboolean killme; gboolean icq; GSList *evilhack; + + GHashTable *ips; struct { guint maxbuddies; /* max users you can watch */ @@ -355,9 +357,10 @@ static void oscar_login(account_t *acc) { struct im_connection *ic = imcb_new(acc); struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1); - if (!isdigit(acc->user[0])) { + if (isdigit(acc->user[0])) + odata->icq = TRUE; + else ic->flags |= OPT_DOES_HTML; - } sess = g_new0(aim_session_t, 1); @@ -410,6 +413,8 @@ static void oscar_logout(struct im_connection *ic) { odata->create_rooms = g_slist_remove(odata->create_rooms, cr); g_free(cr); } + if (odata->ips) + g_hash_table_destroy(odata->ips); if (odata->email) g_free(odata->email); if (odata->newp) @@ -986,6 +991,16 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) signon = time(NULL) - info->sessionlen; + if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR) { + uint32_t *uin = g_new0(uint32_t, 1); + + if (od->ips == NULL) + od->ips = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, NULL); + + if (sscanf(info->sn, "%d", uin) == 1) + g_hash_table_insert(od->ips, uin, (gpointer) (long) info->icqinfo.ipaddr); + } + tmp = g_strdup(normalize(ic->acc->user)); if (!strcmp(tmp, normalize(info->sn))) g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn); @@ -1050,12 +1065,14 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ } else if (args->mpmsg.numparts == 0) { g_snprintf(tmp, BUF_LONG, "%s", args->msg); } else { - int i; + aim_mpmsg_section_t *part; *tmp = 0; - for (i = 0; i < args->mpmsg.numparts; i ++) { - g_strlcat(tmp, (char*) args->mpmsg.parts[i].data, BUF_LONG); - g_strlcat(tmp, "\n", BUF_LONG); + for (part = args->mpmsg.parts; part; part = part->next) { + if (part->data) { + g_strlcat(tmp, (char*) part->data, BUF_LONG); + g_strlcat(tmp, "\n", BUF_LONG); + } } } @@ -2218,87 +2235,94 @@ static GList *oscar_away_states(struct im_connection *ic) static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) { - struct im_connection *ic = sess->aux_data; - gchar who[16]; - GString *str; - va_list ap; - struct aim_icq_info *info; - - va_start(ap, fr); - info = va_arg(ap, struct aim_icq_info *); - va_end(ap); - - if (!info->uin) - return 0; - - str = g_string_sized_new(100); - g_snprintf(who, sizeof(who), "%u", info->uin); - - g_string_sprintfa(str, "%s: %s - %s: %s", _("UIN"), who, _("Nick"), - info->nick ? info->nick : "-"); - info_string_append(str, "\n", _("First Name"), info->first); - info_string_append(str, "\n", _("Last Name"), info->last); - info_string_append(str, "\n", _("Email Address"), info->email); - if (info->numaddresses && info->email2) { - int i; - for (i = 0; i < info->numaddresses; i++) { - info_string_append(str, "\n", _("Email Address"), info->email2[i]); - } - } - info_string_append(str, "\n", _("Mobile Phone"), info->mobile); - if (info->gender != 0) - info_string_append(str, "\n", _("Gender"), info->gender==1 ? _("Female") : _("Male")); - if (info->birthyear || info->birthmonth || info->birthday) { - char date[30]; - struct tm tm; - tm.tm_mday = (int)info->birthday; - tm.tm_mon = (int)info->birthmonth-1; - tm.tm_year = (int)info->birthyear%100; - strftime(date, sizeof(date), "%Y-%m-%d", &tm); - info_string_append(str, "\n", _("Birthday"), date); - } - if (info->age) { - char age[5]; - g_snprintf(age, sizeof(age), "%hhd", info->age); - info_string_append(str, "\n", _("Age"), age); - } - info_string_append(str, "\n", _("Personal Web Page"), info->personalwebpage); - if (info->info && info->info[0]) { - g_string_sprintfa(str, "\n%s:\n%s\n%s", _("Additional Information"), - info->info, _("End of Additional Information")); - } - g_string_sprintfa(str, "\n"); - if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { - g_string_sprintfa(str, "%s:", _("Home Address")); - info_string_append(str, "\n", _("Address"), info->homeaddr); - info_string_append(str, "\n", _("City"), info->homecity); - info_string_append(str, "\n", _("State"), info->homestate); - info_string_append(str, "\n", _("Zip Code"), info->homezip); - g_string_sprintfa(str, "\n"); - } - if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { - g_string_sprintfa(str, "%s:", _("Work Address")); - info_string_append(str, "\n", _("Address"), info->workaddr); - info_string_append(str, "\n", _("City"), info->workcity); - info_string_append(str, "\n", _("State"), info->workstate); - info_string_append(str, "\n", _("Zip Code"), info->workzip); - g_string_sprintfa(str, "\n"); - } - if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { - g_string_sprintfa(str, "%s:", _("Work Information")); - info_string_append(str, "\n", _("Company"), info->workcompany); - info_string_append(str, "\n", _("Division"), info->workdivision); - info_string_append(str, "\n", _("Position"), info->workposition); - if (info->workwebpage && info->workwebpage[0]) { - info_string_append(str, "\n", _("Web Page"), info->workwebpage); - } - g_string_sprintfa(str, "\n"); - } - - imcb_log(ic, "%s\n%s", _("User Info"), str->str); - g_string_free(str, TRUE); - - return 1; + struct im_connection *ic = sess->aux_data; + struct oscar_data *od = ic->proto_data; + gchar who[16]; + GString *str; + va_list ap; + struct aim_icq_info *info; + uint32_t ip; + + va_start(ap, fr); + info = va_arg(ap, struct aim_icq_info *); + va_end(ap); + + if (!info->uin) + return 0; + + str = g_string_sized_new(512); + g_snprintf(who, sizeof(who), "%u", info->uin); + + g_string_printf(str, "%s: %s - %s: %s", _("UIN"), who, _("Nick"), + info->nick ? info->nick : "-"); + g_string_append_printf(str, "\n%s: %s", _("First Name"), info->first); + g_string_append_printf(str, "\n%s: %s", _("Last Name"), info->last); + g_string_append_printf(str, "\n%s: %s", _("Email Address"), info->email); + if (info->numaddresses && info->email2) { + int i; + for (i = 0; i < info->numaddresses; i++) { + g_string_append_printf(str, "\n%s: %s", _("Email Address"), info->email2[i]); + } + } + if ((ip = (long) g_hash_table_lookup(od->ips, &info->uin)) != 0) { + g_string_append_printf(str, "\n%s: %d.%d.%d.%d", _("Last used IP address"), + (ip >> 24), (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff); + } + g_string_append_printf(str, "\n%s: %s", _("Mobile Phone"), info->mobile); + if (info->gender != 0) + g_string_append_printf(str, "\n%s: %s", _("Gender"), info->gender==1 ? _("Female") : _("Male")); + if (info->birthyear || info->birthmonth || info->birthday) { + char date[30]; + struct tm tm; + memset(&tm, 0, sizeof(struct tm)); + tm.tm_mday = (int)info->birthday; + tm.tm_mon = (int)info->birthmonth-1; + tm.tm_year = (int)info->birthyear%100; + strftime(date, sizeof(date), "%Y-%m-%d", &tm); + g_string_append_printf(str, "\n%s: %s", _("Birthday"), date); + } + if (info->age) { + char age[5]; + g_snprintf(age, sizeof(age), "%hhd", info->age); + g_string_append_printf(str, "\n%s: %s", _("Age"), age); + } + g_string_append_printf(str, "\n%s: %s", _("Personal Web Page"), info->personalwebpage); + if (info->info && info->info[0]) { + g_string_sprintfa(str, "\n%s:\n%s\n%s", _("Additional Information"), + info->info, _("End of Additional Information")); + } + g_string_append_c(str, '\n'); + if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { + g_string_append_printf(str, "%s:", _("Home Address")); + g_string_append_printf(str, "\n%s: %s", _("Address"), info->homeaddr); + g_string_append_printf(str, "\n%s: %s", _("City"), info->homecity); + g_string_append_printf(str, "\n%s: %s", _("State"), info->homestate); + g_string_append_printf(str, "\n%s: %s", _("Zip Code"), info->homezip); + g_string_append_c(str, '\n'); + } + if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { + g_string_append_printf(str, "%s:", _("Work Address")); + g_string_append_printf(str, "\n%s: %s", _("Address"), info->workaddr); + g_string_append_printf(str, "\n%s: %s", _("City"), info->workcity); + g_string_append_printf(str, "\n%s: %s", _("State"), info->workstate); + g_string_append_printf(str, "\n%s: %s", _("Zip Code"), info->workzip); + g_string_append_c(str, '\n'); + } + if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { + g_string_append_printf(str, "%s:", _("Work Information")); + g_string_append_printf(str, "\n%s: %s", _("Company"), info->workcompany); + g_string_append_printf(str, "\n%s: %s", _("Division"), info->workdivision); + g_string_append_printf(str, "\n%s: %s", _("Position"), info->workposition); + if (info->workwebpage && info->workwebpage[0]) { + g_string_append_printf(str, "\n%s: %s", _("Web Page"), info->workwebpage); + } + g_string_append_c(str, '\n'); + } + + imcb_log(ic, "%s\n%s", _("User Info"), str->str); + g_string_free(str, TRUE); + + return 1; } @@ -2432,7 +2456,7 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...) else { /* User has stopped typing */ imcb_buddy_typing(ic, sn, 0); - } + } return 1; } |