------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=121507         
ogoffart kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From ogoffart kde org  2006-04-02 22:30 -------
SVN commit 525779 by ogoffart:

support of the new chatstate protocol (JEP-0085) 
BUG: 121507

 A             007_chatstates.patch  
 M  +1 -1      iris/include/im.h  
 M  +1 -0      iris/xmpp-core/protocol.h  
 M  +52 -4     iris/xmpp-im/types.cpp   [UTF-8 ENCODING PROBLEMS]


--- branches/kopete/0.12/kopete/protocols/jabber/libiris/iris/include/im.h 
#525778:525779
 @ -49,7 +49,7  @
        typedef QValueList<Url> UrlList;
        typedef QMap<QString, QString> StringMap;
        typedef enum { OfflineEvent, DeliveredEvent, DisplayedEvent,
-                       ComposingEvent, CancelEvent } MsgEvent;
+                       ComposingEvent, CancelEvent, InactiveEvent, GoneEvent } 
MsgEvent;
                                            
        class Message
        {
--- 
branches/kopete/0.12/kopete/protocols/jabber/libiris/iris/xmpp-core/protocol.h 
#525778:525779
 @ -37,6 +37,7  @
 #define NS_BIND     "urn:ietf:params:xml:ns:xmpp-bind"
 #define NS_XHTML_IM "http://jabber.org/protocol/xhtml-im";
 #define NS_XHTML "http://www.w3.org/1999/xhtml";
+#define NS_CHATSTATES "http://jabber.org/protocol/chatstates";
 
 namespace XMPP
 {
--- branches/kopete/0.12/kopete/protocols/jabber/libiris/iris/xmpp-im/types.cpp 
#525778:525779
 @ -544,28 +544,49  @
                        else
                                
x.appendChild(s.createTextElement("jabber:x:event","id",d->eventId));
                }
+               else
+                       s.appendChild(  s.createElement(NS_CHATSTATES , 
"active" ) );
 
+               bool need_x_event=false;
                for(QValueList<MsgEvent>::ConstIterator ev = 
d->eventList.begin(); ev != d->eventList.end(); ++ev) {
                        switch (*ev) {
                                case OfflineEvent:
                                        
x.appendChild(s.createElement("jabber:x:event", "offline"));
+                                       need_x_event=true;
                                        break;
                                case DeliveredEvent:
                                        
x.appendChild(s.createElement("jabber:x:event", "delivered"));
+                                       need_x_event=true;
                                        break;
                                case DisplayedEvent:
                                        
x.appendChild(s.createElement("jabber:x:event", "displayed"));
+                                       need_x_event=true;
                                        break;
                                case ComposingEvent: 
                                        
x.appendChild(s.createElement("jabber:x:event", "composing"));
+                                       need_x_event=true;
+                                       if (d->body.isEmpty())
+                                               s.appendChild(  
s.createElement(NS_CHATSTATES , "composing" ) ); 
                                        break;
                                case CancelEvent:
-                                       // Add nothing
+                                       need_x_event=true;
+                                       if (d->body.isEmpty())
+                                               s.appendChild(  
s.createElement(NS_CHATSTATES , "paused" ) ); 
                                        break;
+                               case InactiveEvent:
+                                       if (d->body.isEmpty())
+                                               s.appendChild(  
s.createElement(NS_CHATSTATES , "inactive" ) ); 
+                                       break;
+                               case GoneEvent:
+                                       if (d->body.isEmpty())
+                                               s.appendChild(  
s.createElement(NS_CHATSTATES , "gone" ) ); 
+                                       break;
                        }
                }
-               s.appendChild(x);
-       } 
+               if(need_x_event)  //we don't need to have the (empty) x:event 
element if this is only <gone> or <inactive>
+                       s.appendChild(x);
+       }
+               
 
        // xencrypted
        if(!d->xencrypted.isEmpty())
 @ -595,6 +616,7  @
        d->subject.clear();
        d->body.clear();
        d->thread = QString();
+       d->eventList.clear();
 
        QDomElement root = s.element();
 
 @ -631,6 +653,33  @
                                        }
                                }
                        }
+                       else if (e.namespaceURI() == NS_CHATSTATES)
+                       {
+                               if(e.tagName() == "active")
+                               {
+                                       //like in JEP-0022  we let the client 
know that we can receive ComposingEvent
+                                       // (we can do that according to  �4.6  
of the JEP-0085)
+                                       d->eventList += ComposingEvent;
+                                       d->eventList += InactiveEvent;
+                                       d->eventList += GoneEvent;
+                               }
+                               else if (e.tagName() == "composing")
+                               {
+                                       d->eventList += ComposingEvent;
+                               }
+                               else if (e.tagName() == "paused")
+                               {
+                                       d->eventList += CancelEvent;
+                               }
+                               else if (e.tagName() == "inactive")
+                               {
+                                       d->eventList += InactiveEvent;
+                               }
+                               else if (e.tagName() == "gone")
+                               {
+                                       d->eventList += GoneEvent;
+                               }
+                       }
                        else {
                                //printf("extension element: [%s]\n", 
e.tagName().latin1());
                        }
 @ -664,7 +713,6  @
        }
        
     // events
-       d->eventList.clear();
        nl = root.elementsByTagNameNS("jabber:x:event", "x");
        if (nl.count()) {
                nl = nl.item(0).childNodes();
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to