1
# -*- coding: utf-8 -*-
3
# Copyright (C) 2007 Johann Prieur <johann.prieur@gmail.com>
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
from pymsn.service.OfflineIM.constants import *
20
from pymsn.service.OfflineIM.scenario.base import BaseScenario
22
__all__ = ['SyncHeadersScenario']
24
class SyncHeadersScenario(BaseScenario):
25
def __init__(self, rsi, callback, errback):
26
"""Accepts an invitation.
28
@param rsi: the rsi service
29
@param callback: tuple(callable, *args)
30
@param errback: tuple(callable, *args)
32
BaseScenario.__init__(self, callback, errback)
36
self.__rsi.GetMetadata((self.__get_metadata_callback,),
37
(self.__get_metadata_errback,))
39
def __get_metadata_callback(self, metadata):
40
callback = self._callback
41
callback[0](metadata, *callback[1:])
43
def __get_metadata_errback(self, error_code):
44
errcode = OfflineMessagesBoxError.UNKNOWN
45
errback = self._errback[0]
46
args = self._errback[1:]
47
errback(errcode, *args)