1 """Current user profile.
2 """
3 __docformat__ = 'restructuredtext en'
4
5
6 import weakref
7
8 from utils import *
9
10
12 """Represents the profile of currently logged in user. Access using
13 `skype.Skype.CurrentUserProfile`.
14 """
15
17 """__init__.
18
19 :Parameters:
20 Skype : `Skype`
21 Skype object.
22 """
23 self._SkypeRef = weakref.ref(Skype)
24
26 return self._Skype._Property('PROFILE', '', PropName, Set)
27
29 skype = self._SkypeRef()
30 if skype:
31 return skype
32 raise Exception()
33
34 _Skype = property(_Get_Skype)
35
37 return self._Property('ABOUT')
38
40 self._Property('ABOUT', Value)
41
42 About = property(_GetAbout, _SetAbout,
43 doc=""""About" field of the profile.
44
45 :type: unicode
46 """)
47
49 return int(self._Property('PSTN_BALANCE'))
50
51 Balance = property(_GetBalance,
52 doc="""Skype credit balance. Note that the precision of profile balance value is currently
53 fixed at 2 decimal places, regardless of currency or any other settings. Use `BalanceValue`
54 to get the balance expressed in currency.
55
56 :type: int
57
58 :see: `BalanceCurrency`, `BalanceToText`, `BalanceValue`
59 """)
60
62 return self._Property('PSTN_BALANCE_CURRENCY')
63
64 BalanceCurrency = property(_GetBalanceCurrency,
65 doc="""Skype credit balance currency.
66
67 :type: unicode
68
69 :see: `Balance`, `BalanceToText`, `BalanceValue`
70 """)
71
73 return (u'%s %.2f' % (self.BalanceCurrency, self.BalanceValue)).strip()
74
75 BalanceToText = property(_GetBalanceToText,
76 doc="""Skype credit balance as properly formatted text with currency.
77
78 :type: unicode
79
80 :see: `Balance`, `BalanceCurrency`, `BalanceValue`
81 """)
82
84 return float(self._Property('PSTN_BALANCE')) / 100
85
86 BalanceValue = property(_GetBalanceValue,
87 doc="""Skype credit balance expressed in currency.
88
89 :type: float
90
91 :see: `Balance`, `BalanceCurrency`, `BalanceToText`
92 """)
93
95 value = self._Property('BIRTHDAY')
96 if len(value) == 8:
97 from datetime import date
98 from time import strptime
99 return date(*strptime(value, '%Y%m%d')[:3])
100
102 if Value:
103 self._Property('BIRTHDAY', Value.strftime('%Y%m%d'))
104 else:
105 self._Property('BIRTHDAY', 0)
106
107 Birthday = property(_GetBirthday, _SetBirthday,
108 doc=""""Birthday" field of the profile.
109
110 :type: datetime.date
111 """)
112
114 return (self._Property('CALL_APPLY_CF') == 'TRUE')
115
117 self._Property('CALL_APPLY_CF', cndexp(Value, 'TRUE', 'FALSE'))
118
119 CallApplyCF = property(_GetCallApplyCF, _SetCallApplyCF,
120 doc="""Tells if call forwarding is enabled in the profile.
121
122 :type: bool
123 """)
124
126 return str(self._Property('CALL_FORWARD_RULES'))
127
129 self._Property('CALL_FORWARD_RULES', Value)
130
131 CallForwardRules = property(_GetCallForwardRules, _SetCallForwardRules,
132 doc="""Call forwarding rules of the profile.
133
134 :type: str
135 """)
136
138 return int(self._Property('CALL_NOANSWER_TIMEOUT'))
139
141 self._Property('CALL_NOANSWER_TIMEOUT', Value)
142
143 CallNoAnswerTimeout = property(_GetCallNoAnswerTimeout, _SetCallNoAnswerTimeout,
144 doc="""Number of seconds a call will ring without being answered before it
145 stops ringing.
146
147 :type: int
148 """)
149
151 return (self._Property('CALL_SEND_TO_VM') == 'TRUE')
152
154 self._Property('CALL_SEND_TO_VM', cndexp(Value, 'TRUE', 'FALSE'))
155
156 CallSendToVM = property(_GetCallSendToVM, _SetCallSendToVM,
157 doc="""Tells whether calls will be sent to the voicemail.
158
159 :type: bool
160 """)
161
163 return self._Property('CITY')
164
166 self._Property('CITY', Value)
167
168 City = property(_GetCity, _SetCity,
169 doc=""""City" field of the profile.
170
171 :type: unicode
172 """)
173
175 return chop(self._Property('COUNTRY'))[0]
176
178 self._Property('COUNTRY', Value)
179
180 Country = property(_GetCountry, _SetCountry,
181 doc=""""Country" field of the profile.
182
183 :type: unicode
184 """)
185
187 return self._Property('FULLNAME')
188
190 self._Property('FULLNAME', Value)
191
192 FullName = property(_GetFullName, _SetFullName,
193 doc=""""Full name" field of the profile.
194
195 :type: unicode
196 """)
197
198 - def _GetHomepage(self):
199 return self._Property('HOMEPAGE')
200
201 - def _SetHomepage(self, Value):
202 self._Property('HOMEPAGE', Value)
203
204 Homepage = property(_GetHomepage, _SetHomepage,
205 doc=""""Homepage" field of the profile.
206
207 :type: unicode
208 """)
209
211 return str(self._Property('IPCOUNTRY'))
212
213 IPCountry = property(_GetIPCountry,
214 doc="""ISO country code queried by IP address.
215
216 :type: str
217 """)
218
220 return [str(x) for x in split(self._Property('LANGUAGES'))]
221
223 self._Property('LANGUAGES', ' '.join(Value))
224
225 Languages = property(_GetLanguages, _SetLanguages,
226 doc=""""ISO language codes of the profile.
227
228 :type: list of str
229 """)
230
231 - def _GetMoodText(self):
232 return self._Property('MOOD_TEXT')
233
234 - def _SetMoodText(self, Value):
235 self._Property('MOOD_TEXT', Value)
236
237 MoodText = property(_GetMoodText, _SetMoodText,
238 doc=""""Mood text" field of the profile.
239
240 :type: unicode
241 """)
242
244 return self._Property('PHONE_HOME')
245
247 self._Property('PHONE_HOME', Value)
248
249 PhoneHome = property(_GetPhoneHome, _SetPhoneHome,
250 doc=""""Phone home" field of the profile.
251
252 :type: unicode
253 """)
254
256 return self._Property('PHONE_MOBILE')
257
259 self._Property('PHONE_MOBILE', Value)
260
261 PhoneMobile = property(_GetPhoneMobile, _SetPhoneMobile,
262 doc=""""Phone mobile" field of the profile.
263
264 :type: unicode
265 """)
266
268 return self._Property('PHONE_OFFICE')
269
271 self._Property('PHONE_OFFICE', Value)
272
273 PhoneOffice = property(_GetPhoneOffice, _SetPhoneOffice,
274 doc=""""Phone office" field of the profile.
275
276 :type: unicode
277 """)
278
280 return self._Property('PROVINCE')
281
283 self._Property('PROVINCE', Value)
284
285 Province = property(_GetProvince, _SetProvince,
286 doc=""""Province" field of the profile.
287
288 :type: unicode
289 """)
290
292 return self._Property('RICH_MOOD_TEXT')
293
294 - def _SetRichMoodText(self, Value):
295 self._Property('RICH_MOOD_TEXT', Value)
296
297 RichMoodText = property(_GetRichMoodText, _SetRichMoodText,
298 doc="""Rich mood text of the profile.
299
300 :type: unicode
301
302 :see: https://developer.skype.com/Docs/ApiDoc/SET_PROFILE_RICH_MOOD_TEXT
303 """)
304
306 return str(self._Property('SEX'))
307
309 self._Property('SEX', Value)
310
311 Sex = property(_GetSex, _SetSex,
312 doc=""""Sex" field of the profile.
313
314 :type: `enums`.usex*
315 """)
316
318 return int(self._Property('TIMEZONE'))
319
321 self._Property('TIMEZONE', Value)
322
323 Timezone = property(_GetTimezone, _SetTimezone,
324 doc="""Timezone of the current profile in minutes from GMT.
325
326 :type: int
327 """)
328
330 return [str(x) for x in split(self._Property('SMS_VALIDATED_NUMBERS'), ', ')]
331
332 ValidatedSmsNumbers = property(_GetValidatedSmsNumbers,
333 doc="""List of phone numbers the user has registered for usage in reply-to
334 field of SMS messages.
335
336 :type: list of str
337 """)
338