Magellan Linux

Annotation of /trunk/kdenetwork/patches/kdenetwork-3.5.4-oscar-contacts.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 144 - (hide annotations) (download)
Tue May 8 20:06:05 2007 UTC (17 years, 1 month ago) by niro
File size: 3522 byte(s)
-import

1 niro 144 http://bugs.gentoo.org/show_bug.cgi?id=141675
2     http://bugs.kde.org/show_bug.cgi?id=104243
3    
4     Index: kopete/protocols/oscar/liboscar/ssimanager.cpp
5     ===================================================================
6     --- kopete/protocols/oscar/liboscar/ssimanager.cpp (revision 565951)
7     +++ kopete/protocols/oscar/liboscar/ssimanager.cpp (working copy)
8     @@ -71,18 +71,65 @@
9     while ( it != d->SSIList.end() && d->SSIList.count() > 0 )
10     it = d->SSIList.remove( it );
11     };
12     +
13     + d->nextContactId = 0;
14     + d->nextGroupId = 0;
15     }
16    
17     WORD SSIManager::nextContactId()
18     {
19     - d->nextContactId++;
20     - return d->nextContactId;
21     + if ( d->nextContactId == 0 )
22     + d->nextContactId++;
23     +
24     + QValueList<Oscar::SSI>::const_iterator it, listEnd;
25     +
26     + for ( ; d->nextContactId < 0x8000; d->nextContactId++ )
27     + {
28     + bool freeId = true;
29     + listEnd = d->SSIList.end();
30     + for ( it = d->SSIList.begin(); it != listEnd; ++it )
31     + {
32     + if ( ( *it ).bid() == d->nextContactId )
33     + {
34     + freeId = false;
35     + break;
36     + }
37     + }
38     +
39     + if ( freeId )
40     + return d->nextContactId;
41     + }
42     +
43     + kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "No free id!" << endl;
44     + return 0xFFFF;
45     }
46    
47     WORD SSIManager::nextGroupId()
48     {
49     - d->nextGroupId++;
50     - return d->nextGroupId;
51     + if ( d->nextGroupId == 0 )
52     + d->nextGroupId++;
53     +
54     + QValueList<Oscar::SSI>::const_iterator it, listEnd;
55     +
56     + for ( ; d->nextGroupId < 0x8000; d->nextGroupId++ )
57     + {
58     + bool freeId = true;
59     + listEnd = d->SSIList.end();
60     + for ( it = d->SSIList.begin(); it != listEnd; ++it )
61     + {
62     + if ( ( *it ).type() == ROSTER_GROUP && ( *it ).gid() == d->nextGroupId )
63     + {
64     + freeId = false;
65     + break;
66     + }
67     + }
68     +
69     + if ( freeId )
70     + return d->nextGroupId;
71     + }
72     +
73     + kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "No free group id!" << endl;
74     + return 0xFFFF;
75     }
76    
77     WORD SSIManager::numberOfItems() const
78     @@ -379,8 +426,6 @@
79     if ( !group.name().isEmpty() ) //avoid the group with gid 0 and bid 0
80     { // the group is really new
81     kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Adding group '" << group.name() << "' to SSI list" << endl;
82     - if ( group.gid() > d->nextGroupId )
83     - d->nextGroupId = group.gid();
84    
85     d->SSIList.append( group );
86     emit groupAdded( group );
87     @@ -394,6 +439,10 @@
88     QString groupName = group.name();
89     kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Removing group " << group.name() << endl;
90     int remcount = d->SSIList.remove( group );
91     +
92     + if ( d->nextGroupId > group.gid() )
93     + d->nextGroupId = group.gid();
94     +
95     if ( remcount == 0 )
96     {
97     kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "No groups removed" << endl;
98     @@ -420,13 +469,6 @@
99    
100     bool SSIManager::newContact( const Oscar::SSI& contact )
101     {
102     - //what to validate?
103     - if ( contact.bid() > d->nextContactId )
104     - {
105     - kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Setting next contact ID to " << contact.bid() << endl;
106     - d->nextContactId = contact.bid();
107     - }
108     -
109     if ( d->SSIList.findIndex( contact ) == -1 )
110     {
111     kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Adding contact '" << contact.name() << "' to SSI list" << endl;
112     @@ -443,6 +485,9 @@
113     QString contactName = contact.name();
114     int remcount = d->SSIList.remove( contact );
115    
116     + if ( d->nextContactId > contact.bid() )
117     + d->nextContactId = contact.bid();
118     +
119     if ( remcount == 0 )
120     {
121     kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "No contacts were removed." << endl;
122     @@ -476,6 +521,10 @@
123     bool SSIManager::removeItem( const Oscar::SSI& item )
124     {
125     d->SSIList.remove( item );
126     +
127     + if ( d->nextContactId > item.bid() )
128     + d->nextContactId = item.bid();
129     +
130     return true;
131     }
132