Changeset 85341dd for protocols


Ignore:
Timestamp:
2012-01-27T23:25:13Z (12 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
e618d85
Parents:
7c2daf5f
Message:

skype: properly display multiple about lines

Previously we printed only the last one

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/skype/skype.c

    r7c2daf5f r85341dd  
    22 *  skype.c - Skype plugin for BitlBee
    33 *
    4  *  Copyright (c) 2007, 2008, 2009, 2010, 2011 by Miklos Vajna <vmiklos@frugalware.org>
     4 *  Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012 by Miklos Vajna <vmiklos@frugalware.org>
    55 *
    66 *  This program is free software; you can redistribute it and/or modify
     
    386386        else if (!strncmp(ptr, "LASTONLINETIMESTAMP ", 20))
    387387                sd->info_seen = g_strdup(ptr + 20);
    388         else if (!strncmp(ptr, "BIRTHDAY ", 9))
    389                 sd->info_birthday = g_strdup(ptr + 9);
    390388        else if (!strncmp(ptr, "SEX ", 4))
    391389                sd->info_sex = g_strdup(ptr + 4);
     
    401399                sd->info_homepage = g_strdup(ptr + 9);
    402400        else if (!strncmp(ptr, "ABOUT ", 6)) {
    403                 sd->info_about = g_strdup(ptr + 6);
     401                /* Support multiple about lines. */
     402                if (!sd->info_about)
     403                        sd->info_about = g_strdup(ptr + 6);
     404                else {
     405                        GString *st = g_string_new(sd->info_about);
     406                        g_string_append_printf(st, "\n%s", ptr + 6);
     407                        g_free(sd->info_about);
     408                        sd->info_about = g_strdup(st->str);
     409                        g_string_free(st, TRUE);
     410                }
     411        }
     412        else if (!strncmp(ptr, "BIRTHDAY ", 9)) {
     413                sd->info_birthday = g_strdup(ptr + 9);
    404414
    405415                GString *st = g_string_new("Contact Information\n");
     
    14611471        skype_printf(ic, "GET USER %s TIMEZONE\n", nick);
    14621472        skype_printf(ic, "GET USER %s LASTONLINETIMESTAMP\n", nick);
    1463         skype_printf(ic, "GET USER %s BIRTHDAY\n", nick);
    14641473        skype_printf(ic, "GET USER %s SEX\n", nick);
    14651474        skype_printf(ic, "GET USER %s LANGUAGE\n", nick);
     
    14691478        skype_printf(ic, "GET USER %s HOMEPAGE\n", nick);
    14701479        skype_printf(ic, "GET USER %s ABOUT\n", nick);
     1480        /*
     1481         * Hack: we query the bithday property which is always a single line,
     1482         * so we can send the collected properties to the user when we have
     1483         * this one.
     1484         */
     1485        skype_printf(ic, "GET USER %s BIRTHDAY\n", nick);
    14711486}
    14721487
Note: See TracChangeset for help on using the changeset viewer.