paul@49 | 1 | #!/usr/bin/env python |
paul@49 | 2 | |
paul@146 | 3 | """ |
paul@146 | 4 | A processing framework for iMIP content. |
paul@146 | 5 | |
paul@1212 | 6 | Copyright (C) 2014, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> |
paul@146 | 7 | |
paul@146 | 8 | This program is free software; you can redistribute it and/or modify it under |
paul@146 | 9 | the terms of the GNU General Public License as published by the Free Software |
paul@146 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paul@146 | 11 | version. |
paul@146 | 12 | |
paul@146 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@146 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@146 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@146 | 16 | details. |
paul@146 | 17 | |
paul@146 | 18 | You should have received a copy of the GNU General Public License along with |
paul@146 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@146 | 20 | """ |
paul@146 | 21 | |
paul@49 | 22 | from email import message_from_file |
paul@1212 | 23 | from imiptools.config import settings |
paul@604 | 24 | from imiptools.client import Client |
paul@213 | 25 | from imiptools.content import handle_itip_part |
paul@604 | 26 | from imiptools.data import get_address, get_addresses, get_uri |
paul@83 | 27 | from imiptools.mail import Messenger |
paul@1088 | 28 | from imiptools.stores import get_store, get_publisher, get_journal |
paul@991 | 29 | import sys, os |
paul@49 | 30 | |
paul@49 | 31 | # Postfix exit codes. |
paul@49 | 32 | |
paul@49 | 33 | EX_TEMPFAIL = 75 |
paul@49 | 34 | |
paul@49 | 35 | # Permitted iTIP content types. |
paul@49 | 36 | |
paul@49 | 37 | itip_content_types = [ |
paul@49 | 38 | "text/calendar", # from RFC 6047 |
paul@49 | 39 | "text/x-vcalendar", "application/ics", # other possibilities |
paul@49 | 40 | ] |
paul@49 | 41 | |
paul@49 | 42 | # Processing of incoming messages. |
paul@49 | 43 | |
paul@49 | 44 | def get_all_values(msg, key): |
paul@49 | 45 | l = [] |
paul@49 | 46 | for v in msg.get_all(key) or []: |
paul@49 | 47 | l += [s.strip() for s in v.split(",")] |
paul@49 | 48 | return l |
paul@49 | 49 | |
paul@49 | 50 | class Processor: |
paul@49 | 51 | |
paul@49 | 52 | "The processing framework." |
paul@49 | 53 | |
paul@822 | 54 | def __init__(self, handlers, outgoing_only=False): |
paul@49 | 55 | self.handlers = handlers |
paul@822 | 56 | self.outgoing_only = outgoing_only |
paul@607 | 57 | self.messenger = None |
paul@60 | 58 | self.lmtp_socket = None |
paul@1088 | 59 | self.store_type = None |
paul@563 | 60 | self.store_dir = None |
paul@563 | 61 | self.publishing_dir = None |
paul@1039 | 62 | self.journal_dir = None |
paul@639 | 63 | self.preferences_dir = None |
paul@563 | 64 | self.debug = False |
paul@49 | 65 | |
paul@569 | 66 | def get_store(self): |
paul@1088 | 67 | return get_store(self.store_type, self.store_dir) |
paul@569 | 68 | |
paul@569 | 69 | def get_publisher(self): |
paul@1285 | 70 | return get_publisher(self.publishing_dir) |
paul@569 | 71 | |
paul@1039 | 72 | def get_journal(self): |
paul@1088 | 73 | return get_journal(self.store_type, self.journal_dir) |
paul@1039 | 74 | |
paul@822 | 75 | def process(self, f, original_recipients): |
paul@49 | 76 | |
paul@49 | 77 | """ |
paul@49 | 78 | Process content from the stream 'f' accompanied by the given |
paul@515 | 79 | 'original_recipients'. |
paul@49 | 80 | """ |
paul@49 | 81 | |
paul@49 | 82 | msg = message_from_file(f) |
paul@49 | 83 | |
paul@604 | 84 | messenger = self.messenger |
paul@604 | 85 | store = self.get_store() |
paul@604 | 86 | publisher = self.get_publisher() |
paul@1039 | 87 | journal = self.get_journal() |
paul@639 | 88 | preferences_dir = self.preferences_dir |
paul@604 | 89 | |
paul@49 | 90 | # Handle messages with iTIP parts. |
paul@438 | 91 | # Typically, the details of recipients are of interest in handling |
paul@438 | 92 | # messages. |
paul@49 | 93 | |
paul@822 | 94 | if not self.outgoing_only: |
paul@1282 | 95 | senders = get_addresses(get_all_values(msg, "Reply-To") or get_all_values(msg, "From") or []) |
paul@438 | 96 | original_recipients = original_recipients or get_addresses(get_all_values(msg, "To") or []) |
paul@1282 | 97 | users = [] |
paul@1282 | 98 | |
paul@438 | 99 | for recipient in original_recipients: |
paul@1282 | 100 | users.append(get_uri(recipient)) |
paul@438 | 101 | |
paul@438 | 102 | # However, outgoing messages do not usually presume anything about the |
paul@832 | 103 | # eventual recipients and focus on the sender instead. If possible, the |
paul@832 | 104 | # sender is identified, but since this may be the calendar system (and |
paul@832 | 105 | # the actual sender is defined in the object), and since the recipient |
paul@832 | 106 | # may be in a Bcc header that is not available here, it may be left as |
paul@832 | 107 | # None and deduced from the object content later. |
paul@438 | 108 | |
paul@438 | 109 | else: |
paul@1282 | 110 | senders = [] |
paul@1282 | 111 | |
paul@1282 | 112 | for sender in get_addresses(get_all_values(msg, "From") or []): |
paul@1282 | 113 | if sender != settings["MESSAGE_SENDER"]: |
paul@1282 | 114 | senders.append(sender) |
paul@1282 | 115 | |
paul@1282 | 116 | users = [senders and get_uri(senders[0]) or None] |
paul@1282 | 117 | |
paul@1282 | 118 | # Process the message for each recipient. |
paul@1282 | 119 | |
paul@1285 | 120 | if self.debug: |
paul@1285 | 121 | print >>sys.stderr, "Recipients..." |
paul@1285 | 122 | print >>sys.stderr, ", ".join(users) |
paul@1285 | 123 | |
paul@1282 | 124 | for user in users: |
paul@1282 | 125 | Recipient(user, messenger, store, publisher, journal, |
paul@1282 | 126 | preferences_dir, self.handlers, self.outgoing_only, |
paul@1282 | 127 | self.debug).process(msg, senders) |
paul@229 | 128 | |
paul@49 | 129 | def process_args(self, args, stream): |
paul@49 | 130 | |
paul@49 | 131 | """ |
paul@49 | 132 | Interpret the given program arguments 'args' and process input from the |
paul@49 | 133 | given 'stream'. |
paul@49 | 134 | """ |
paul@49 | 135 | |
paul@49 | 136 | # Obtain the different kinds of recipients plus sender address. |
paul@49 | 137 | |
paul@49 | 138 | original_recipients = [] |
paul@49 | 139 | recipients = [] |
paul@49 | 140 | senders = [] |
paul@60 | 141 | lmtp = [] |
paul@1088 | 142 | store_type = [] |
paul@563 | 143 | store_dir = [] |
paul@563 | 144 | publishing_dir = [] |
paul@639 | 145 | preferences_dir = [] |
paul@1039 | 146 | journal_dir = [] |
paul@666 | 147 | local_smtp = False |
paul@49 | 148 | |
paul@49 | 149 | l = [] |
paul@49 | 150 | |
paul@49 | 151 | for arg in args: |
paul@49 | 152 | |
paul@49 | 153 | # Switch to collecting recipients. |
paul@49 | 154 | |
paul@822 | 155 | if arg == "-o": |
paul@49 | 156 | l = original_recipients |
paul@49 | 157 | |
paul@49 | 158 | # Switch to collecting senders. |
paul@49 | 159 | |
paul@49 | 160 | elif arg == "-s": |
paul@49 | 161 | l = senders |
paul@49 | 162 | |
paul@60 | 163 | # Switch to getting the LMTP socket. |
paul@60 | 164 | |
paul@60 | 165 | elif arg == "-l": |
paul@60 | 166 | l = lmtp |
paul@60 | 167 | |
paul@666 | 168 | # Detect sending to local users via SMTP. |
paul@666 | 169 | |
paul@666 | 170 | elif arg == "-L": |
paul@666 | 171 | local_smtp = True |
paul@666 | 172 | |
paul@1088 | 173 | # Switch to getting the store type. |
paul@1088 | 174 | |
paul@1088 | 175 | elif arg == "-T": |
paul@1088 | 176 | l = store_type |
paul@1088 | 177 | |
paul@563 | 178 | # Switch to getting the store directory. |
paul@563 | 179 | |
paul@563 | 180 | elif arg == "-S": |
paul@563 | 181 | l = store_dir |
paul@563 | 182 | |
paul@563 | 183 | # Switch to getting the publishing directory. |
paul@563 | 184 | |
paul@563 | 185 | elif arg == "-P": |
paul@563 | 186 | l = publishing_dir |
paul@563 | 187 | |
paul@639 | 188 | # Switch to getting the preferences directory. |
paul@639 | 189 | |
paul@639 | 190 | elif arg == "-p": |
paul@639 | 191 | l = preferences_dir |
paul@639 | 192 | |
paul@1039 | 193 | # Switch to getting the journal directory. |
paul@1039 | 194 | |
paul@1039 | 195 | elif arg == "-j": |
paul@1039 | 196 | l = journal_dir |
paul@1039 | 197 | |
paul@49 | 198 | # Ignore debugging options. |
paul@49 | 199 | |
paul@49 | 200 | elif arg == "-d": |
paul@563 | 201 | self.debug = True |
paul@49 | 202 | else: |
paul@49 | 203 | l.append(arg) |
paul@49 | 204 | |
paul@1088 | 205 | getvalue = lambda value, default=None: value and value[0] or default |
paul@1088 | 206 | |
paul@1088 | 207 | self.messenger = Messenger(lmtp_socket=getvalue(lmtp), local_smtp=local_smtp, sender=getvalue(senders)) |
paul@1285 | 208 | |
paul@1285 | 209 | # Obtain arguments or configured defaults. |
paul@1285 | 210 | |
paul@1212 | 211 | self.store_type = getvalue(store_type, settings["STORE_TYPE"]) |
paul@1285 | 212 | self.store_dir = getvalue(store_dir, settings["STORE_DIR"]) |
paul@1285 | 213 | self.journal_dir = getvalue(journal_dir, settings["JOURNAL_DIR"]) |
paul@1285 | 214 | self.preferences_dir = getvalue(preferences_dir, settings["PREFERENCES_DIR"]) |
paul@1285 | 215 | self.publishing_dir = getvalue(publishing_dir, settings["PUBLISH_DIR"]) |
paul@1285 | 216 | |
paul@1285 | 217 | # Show configuration and exit if requested. |
paul@1285 | 218 | |
paul@1285 | 219 | if "--show-config" in args: |
paul@1285 | 220 | print """\ |
paul@1285 | 221 | Store type: %s |
paul@1285 | 222 | Store directory: %s |
paul@1285 | 223 | Journal directory: %s |
paul@1285 | 224 | Preferences directory: %s |
paul@1285 | 225 | Publishing directory: %s""" % ( |
paul@1285 | 226 | self.store_type, self.store_dir, self.journal_dir, |
paul@1285 | 227 | self.preferences_dir, self.publishing_dir) |
paul@1285 | 228 | return |
paul@1174 | 229 | |
paul@1174 | 230 | # If debug mode is set, extend the line length for convenience. |
paul@1174 | 231 | |
paul@1174 | 232 | if self.debug: |
paul@1212 | 233 | settings["CALENDAR_LINE_LENGTH"] = 1000 |
paul@1285 | 234 | print >>sys.stderr, "Store type", self.store_type, "at", self.store_dir |
paul@1174 | 235 | |
paul@1174 | 236 | # Process the input. |
paul@1174 | 237 | |
paul@822 | 238 | self.process(stream, original_recipients) |
paul@49 | 239 | |
paul@49 | 240 | def __call__(self): |
paul@49 | 241 | |
paul@49 | 242 | """ |
paul@49 | 243 | Obtain arguments from the command line to initialise the processor |
paul@49 | 244 | before invoking it. |
paul@49 | 245 | """ |
paul@49 | 246 | |
paul@49 | 247 | args = sys.argv[1:] |
paul@49 | 248 | |
paul@991 | 249 | if "--help" in args: |
paul@991 | 250 | print >>sys.stderr, """\ |
paul@991 | 251 | Usage: %s [ -o <recipient> ... ] [-s <sender> ... ] [ -l <socket> | -L ] \\ |
paul@1088 | 252 | [ -T <store type ] \\ |
paul@991 | 253 | [ -S <store directory> ] [ -P <publishing directory> ] \\ |
paul@1285 | 254 | [ -p <preferences directory> ] [ -j <journal directory> ] \\ |
paul@1285 | 255 | [ -d ] [ --show-config ] |
paul@991 | 256 | |
paul@991 | 257 | Address options: |
paul@991 | 258 | |
paul@991 | 259 | -o Indicate the original recipients of the message, overriding any found in |
paul@991 | 260 | the message headers |
paul@991 | 261 | -s Indicate the senders of the message, overriding any found in the message |
paul@991 | 262 | headers |
paul@991 | 263 | |
paul@991 | 264 | Delivery options: |
paul@991 | 265 | |
paul@991 | 266 | -l The socket filename for LMTP communication with a mailbox solution, |
paul@991 | 267 | selecting the LMTP delivery method |
paul@991 | 268 | -L Selects the local SMTP delivery method, requiring a suitable mail system |
paul@991 | 269 | configuration |
paul@991 | 270 | |
paul@991 | 271 | (Where a program needs to deliver messages, one of the above options must be |
paul@991 | 272 | specified.) |
paul@991 | 273 | |
paul@1285 | 274 | Configuration options (overriding configured defaults): |
paul@991 | 275 | |
paul@1039 | 276 | -j Indicates the location of quota-related journal information |
paul@1039 | 277 | -P Indicates the location of published free/busy resources |
paul@1039 | 278 | -p Indicates the location of user preference directories |
paul@991 | 279 | -S Indicates the location of the calendar data store containing user storage |
paul@991 | 280 | directories |
paul@1088 | 281 | -T Indicates the store and journal type (the configured value if omitted) |
paul@991 | 282 | |
paul@991 | 283 | Output options: |
paul@991 | 284 | |
paul@991 | 285 | -d Run in debug mode, producing informative output describing the behaviour |
paul@1285 | 286 | of the program, displaying responses on standard output instead of sending |
paul@1285 | 287 | messages |
paul@1285 | 288 | |
paul@1285 | 289 | Diagnostic options: |
paul@1285 | 290 | |
paul@1285 | 291 | --show-config Show the configuration with the specified options and exit |
paul@1285 | 292 | without performing any actions |
paul@991 | 293 | """ % os.path.split(sys.argv[0])[-1] |
paul@1285 | 294 | |
paul@991 | 295 | elif "-d" in args: |
paul@49 | 296 | self.process_args(args, sys.stdin) |
paul@49 | 297 | else: |
paul@49 | 298 | try: |
paul@49 | 299 | self.process_args(args, sys.stdin) |
paul@49 | 300 | except SystemExit, value: |
paul@49 | 301 | sys.exit(value) |
paul@49 | 302 | except Exception, exc: |
paul@60 | 303 | if "-v" in args: |
paul@60 | 304 | raise |
paul@1285 | 305 | |
paul@1285 | 306 | # Obtain the exception origin. |
paul@1285 | 307 | |
paul@49 | 308 | type, value, tb = sys.exc_info() |
paul@310 | 309 | while tb.tb_next: |
paul@310 | 310 | tb = tb.tb_next |
paul@310 | 311 | f = tb.tb_frame |
paul@310 | 312 | co = f and f.f_code |
paul@310 | 313 | filename = co and co.co_filename |
paul@1285 | 314 | |
paul@310 | 315 | print >>sys.stderr, "Exception %s at %d in %s" % (exc, tb.tb_lineno, filename) |
paul@1285 | 316 | |
paul@82 | 317 | #import traceback |
paul@82 | 318 | #traceback.print_exc(file=open("/tmp/mail.log", "a")) |
paul@1285 | 319 | |
paul@49 | 320 | sys.exit(EX_TEMPFAIL) |
paul@1285 | 321 | |
paul@49 | 322 | sys.exit(0) |
paul@49 | 323 | |
paul@604 | 324 | class Recipient(Client): |
paul@604 | 325 | |
paul@604 | 326 | "A processor acting as a client on behalf of a recipient." |
paul@604 | 327 | |
paul@1039 | 328 | def __init__(self, user, messenger, store, publisher, journal, preferences_dir, |
paul@1039 | 329 | handlers, outgoing_only, debug): |
paul@604 | 330 | |
paul@604 | 331 | """ |
paul@604 | 332 | Initialise the recipient with the given 'user' identity, 'messenger', |
paul@1039 | 333 | 'store', 'publisher', 'journal', 'preferences_dir', 'handlers', |
paul@1039 | 334 | 'outgoing_only' and 'debug' status. |
paul@604 | 335 | """ |
paul@604 | 336 | |
paul@1039 | 337 | Client.__init__(self, user, messenger, store, publisher, journal, preferences_dir) |
paul@607 | 338 | self.handlers = handlers |
paul@822 | 339 | self.outgoing_only = outgoing_only |
paul@607 | 340 | self.debug = debug |
paul@604 | 341 | |
paul@822 | 342 | def process(self, msg, senders): |
paul@604 | 343 | |
paul@604 | 344 | """ |
paul@604 | 345 | Process the given 'msg' for a single recipient, having the given |
paul@822 | 346 | 'senders'. |
paul@604 | 347 | |
paul@604 | 348 | Processing individually means that contributions to resulting messages |
paul@604 | 349 | may be constructed according to individual preferences. |
paul@604 | 350 | """ |
paul@604 | 351 | |
paul@1285 | 352 | handlers = {} |
paul@1285 | 353 | |
paul@1285 | 354 | # Instantiate handlers for the supported methods. |
paul@1285 | 355 | |
paul@1285 | 356 | for name, cls in self.handlers: |
paul@1285 | 357 | handlers[name] = cls(senders, self.user and get_address(self.user), |
paul@1285 | 358 | self.messenger, self.store, self.publisher, |
paul@1285 | 359 | self.journal, self.preferences_dir) |
paul@1285 | 360 | |
paul@604 | 361 | handled = False |
paul@604 | 362 | |
paul@667 | 363 | # Check for participating recipients. Non-participating recipients will |
paul@667 | 364 | # have their messages left as being unhandled. |
paul@667 | 365 | |
paul@822 | 366 | if self.outgoing_only or self.is_participating(): |
paul@667 | 367 | |
paul@667 | 368 | # Check for returned messages. |
paul@665 | 369 | |
paul@665 | 370 | for part in msg.walk(): |
paul@667 | 371 | if part.get_content_type() == "message/delivery-status": |
paul@667 | 372 | break |
paul@667 | 373 | else: |
paul@667 | 374 | for part in msg.walk(): |
paul@667 | 375 | if part.get_content_type() in itip_content_types and \ |
paul@667 | 376 | part.get_param("method"): |
paul@604 | 377 | |
paul@1285 | 378 | if self.debug: |
paul@1285 | 379 | print >>sys.stderr, "Handle method %s..." % part.get_param("method") |
paul@1285 | 380 | |
paul@667 | 381 | handle_itip_part(part, handlers) |
paul@667 | 382 | handled = True |
paul@604 | 383 | |
paul@604 | 384 | # When processing outgoing messages, no replies or deliveries are |
paul@604 | 385 | # performed. |
paul@604 | 386 | |
paul@822 | 387 | if self.outgoing_only: |
paul@604 | 388 | return |
paul@604 | 389 | |
paul@604 | 390 | # Get responses from the handlers. |
paul@604 | 391 | |
paul@604 | 392 | all_responses = [] |
paul@604 | 393 | for handler in handlers.values(): |
paul@604 | 394 | all_responses += handler.get_results() |
paul@604 | 395 | |
paul@604 | 396 | # Pack any returned parts into messages. |
paul@604 | 397 | |
paul@604 | 398 | if all_responses: |
paul@604 | 399 | outgoing_parts = {} |
paul@604 | 400 | forwarded_parts = [] |
paul@604 | 401 | |
paul@604 | 402 | for outgoing_recipients, part in all_responses: |
paul@604 | 403 | if outgoing_recipients: |
paul@604 | 404 | for outgoing_recipient in outgoing_recipients: |
paul@604 | 405 | if not outgoing_parts.has_key(outgoing_recipient): |
paul@604 | 406 | outgoing_parts[outgoing_recipient] = [] |
paul@604 | 407 | outgoing_parts[outgoing_recipient].append(part) |
paul@604 | 408 | else: |
paul@604 | 409 | forwarded_parts.append(part) |
paul@604 | 410 | |
paul@604 | 411 | # Reply using any outgoing parts in a new message. |
paul@604 | 412 | |
paul@604 | 413 | if outgoing_parts: |
paul@604 | 414 | |
paul@604 | 415 | # Obtain free/busy details, if configured to do so. |
paul@604 | 416 | |
paul@604 | 417 | fb = self.can_provide_freebusy(handlers) and self.get_freebusy_part() |
paul@604 | 418 | |
paul@604 | 419 | for outgoing_recipient, parts in outgoing_parts.items(): |
paul@604 | 420 | |
paul@604 | 421 | # Bundle free/busy messages, if configured to do so. |
paul@604 | 422 | |
paul@604 | 423 | if fb: parts.append(fb) |
paul@604 | 424 | message = self.messenger.make_outgoing_message(parts, [outgoing_recipient]) |
paul@604 | 425 | |
paul@607 | 426 | if self.debug: |
paul@604 | 427 | print >>sys.stderr, "Outgoing parts for %s..." % outgoing_recipient |
paul@604 | 428 | print message |
paul@604 | 429 | else: |
paul@604 | 430 | self.messenger.sendmail([outgoing_recipient], message.as_string()) |
paul@604 | 431 | |
paul@604 | 432 | # Forward messages to their recipients either wrapping the existing |
paul@604 | 433 | # message, accompanying it or replacing it. |
paul@604 | 434 | |
paul@604 | 435 | if forwarded_parts: |
paul@604 | 436 | |
paul@604 | 437 | # Determine whether to wrap, accompany or replace the message. |
paul@604 | 438 | |
paul@604 | 439 | prefs = self.get_preferences() |
paul@1212 | 440 | incoming = prefs.get("incoming", settings["INCOMING_DEFAULT"]) |
paul@604 | 441 | |
paul@604 | 442 | if incoming == "message-only": |
paul@604 | 443 | messages = [msg] |
paul@604 | 444 | else: |
paul@604 | 445 | summary = self.messenger.make_summary_message(msg, forwarded_parts) |
paul@604 | 446 | if incoming == "summary-then-message": |
paul@604 | 447 | messages = [summary, msg] |
paul@604 | 448 | elif incoming == "message-then-summary": |
paul@604 | 449 | messages = [msg, summary] |
paul@604 | 450 | elif incoming == "summary-only": |
paul@604 | 451 | messages = [summary] |
paul@604 | 452 | else: # incoming == "summary-wraps-message": |
paul@604 | 453 | messages = [self.messenger.wrap_message(msg, forwarded_parts)] |
paul@604 | 454 | |
paul@604 | 455 | for message in messages: |
paul@607 | 456 | if self.debug: |
paul@604 | 457 | print >>sys.stderr, "Forwarded parts..." |
paul@604 | 458 | print message |
paul@607 | 459 | elif self.messenger.local_delivery(): |
paul@666 | 460 | self.messenger.sendmail([get_address(self.user)], message.as_string()) |
paul@604 | 461 | |
paul@604 | 462 | # Unhandled messages are delivered as they are. |
paul@604 | 463 | |
paul@604 | 464 | if not handled: |
paul@607 | 465 | if self.debug: |
paul@604 | 466 | print >>sys.stderr, "Unhandled parts..." |
paul@604 | 467 | print msg |
paul@607 | 468 | elif self.messenger.local_delivery(): |
paul@666 | 469 | self.messenger.sendmail([get_address(self.user)], msg.as_string()) |
paul@604 | 470 | |
paul@604 | 471 | def can_provide_freebusy(self, handlers): |
paul@604 | 472 | |
paul@604 | 473 | "Test for any free/busy information produced by 'handlers'." |
paul@604 | 474 | |
paul@604 | 475 | fbhandler = handlers.get("VFREEBUSY") |
paul@604 | 476 | if fbhandler: |
paul@604 | 477 | fbmethods = fbhandler.get_outgoing_methods() |
paul@604 | 478 | return not "REPLY" in fbmethods and not "PUBLISH" in fbmethods |
paul@604 | 479 | else: |
paul@604 | 480 | return False |
paul@604 | 481 | |
paul@49 | 482 | # vim: tabstop=4 expandtab shiftwidth=4 |