'Process the session_start event.
Typical actions for the session_start event are
requesting the roster and broadcasting an initial
presence stanza.
Arguments:
event -- An empty dictionary. The session_start
event does not provide any additional
data.'

def start(self, event):

    self.send_presence()
    self.get_roster()
    avatar_file = None
    try:
        avatar_file = open(os.path.expanduser(self.filepath), 'rb')
    except IOError:
        print ('Could    not    find    file:    %s' % self.filepath)
        return self.disconnect()
    avatar = avatar_file.read()
    avatar_type = ('image/%s' % imghdr.what('', avatar))
    avatar_id = self['xep_0084'].generate_id(avatar)
    avatar_bytes = len(avatar)
    avatar_file.close()
    used_xep84 = False
    try:
        print 'Publish    XEP-0084    avatar    data'
        self['xep_0084'].publish_avatar(avatar)
        used_xep84 = True
    except XMPPError:
        print 'Could    not    publish    XEP-0084    avatar'
    try:
        print 'Update    vCard    with    avatar'
        self['xep_0153'].set_avatar(avatar=avatar, mtype=avatar_type)
    except XMPPError:
        print 'Could    not    set    vCard    avatar'
    if used_xep84:
        try:
            print 'Advertise    XEP-0084    avatar    metadata'
            self['xep_0084'].publish_avatar_metadata([{'id': avatar_id, 'type': avatar_type, 'bytes': avatar_bytes}])
        except XMPPError:
            print 'Could    not    publish    XEP-0084    metadata'
    print 'Wait    for    presence    updates    to    propagate...'
    self.schedule('end', 5, self.disconnect, kwargs={'wait': True})
