-Event *Event::fromVariantMap(QVariantMap &map, Network *network) {
- int inttype = map.take("type").toInt();
- // sanity check if we have a valid enum value
- if(EventManager::enumName(inttype).isEmpty()) {
- qWarning() << "Received a serialized event with unknown type" << inttype;
- return 0;
- }
-
- EventManager::EventType type = static_cast<EventManager::EventType>(inttype);
- if(type == EventManager::Invalid || type == EventManager::GenericEvent)
- return 0;
-
- EventManager::EventType group = static_cast<EventManager::EventType>(type & EventManager::EventGroupMask);
-
- Event *e = 0;
-
- // we use static create() functions to keep group-specific special cases in the files they belong
- // e.g. IrcEventRawMessage
- switch(group) {
- case EventManager::NetworkEvent:
- e = NetworkEvent::create(type, map, network);
- break;
- case EventManager::IrcServerEvent:
- // not in use!
- break;
- case EventManager::IrcEvent:
- e = IrcEvent::create(type, map, network);
- break;
- case EventManager::MessageEvent:
- e = MessageEvent::create(type, map, network);
- break;
- case EventManager::CtcpEvent:
- e = CtcpEvent::create(type, map, network);
- break;
- default:
- break;
- }
-
- if(!e) {
- qWarning() << "Can't create event of type" << type;
- return 0;
- }
-
- if(!map.isEmpty()) {
- qWarning() << "Event creation from map did not consume all data:" << map;
- }
-
- return e;
+Event *Event::fromVariantMap(QVariantMap &map, Network *network)
+{
+ int inttype = map.take("type").toInt();
+ // sanity check if we have a valid enum value
+ if (EventManager::enumName(inttype).isEmpty()) {
+ qWarning() << "Received a serialized event with unknown type" << inttype;
+ return 0;
+ }
+
+ EventManager::EventType type = static_cast<EventManager::EventType>(inttype);
+ if (type == EventManager::Invalid || type == EventManager::GenericEvent)
+ return 0;
+
+ EventManager::EventType group = static_cast<EventManager::EventType>(type & EventManager::EventGroupMask);
+
+ Event *e = 0;
+
+ // we use static create() functions to keep group-specific special cases in the files they belong
+ // e.g. IrcEventRawMessage
+ switch (group) {
+ case EventManager::NetworkEvent:
+ e = NetworkEvent::create(type, map, network);
+ break;
+ case EventManager::IrcServerEvent:
+ // not in use!
+ break;
+ case EventManager::IrcEvent:
+ e = IrcEvent::create(type, map, network);
+ break;
+ case EventManager::MessageEvent:
+ e = MessageEvent::create(type, map, network);
+ break;
+ case EventManager::CtcpEvent:
+ e = CtcpEvent::create(type, map, network);
+ break;
+ default:
+ break;
+ }
+
+ if (!e) {
+ qWarning() << "Can't create event of type" << type;
+ return 0;
+ }
+
+ if (!map.isEmpty()) {
+ qWarning() << "Event creation from map did not consume all data:" << map;
+ }
+
+ return e;