MCPcopy Create free account
hub / github.com/amule-project/amule / LoadList

Method LoadList

src/FriendList.cpp:102–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void CFriendList::LoadList()
103{
104 CPath metfile = CPath(thePrefs::GetConfigDir() + "emfriends.met");
105
106 if (!metfile.FileExists()) {
107 return;
108 }
109
110 CFile file;
111 try {
112 if ( file.Open(metfile) ) {
113 if ( file.ReadUInt8() /*header*/ == MET_HEADER ) {
114 uint32 nRecordsNumber = file.ReadUInt32();
115 for (uint32 i = 0; i < nRecordsNumber; i++) {
116 CFriend* Record = new CFriend();
117 Record->LoadFromFile(&file);
118 m_FriendList.push_back(Record);
119 Notify_ChatUpdateFriend(Record);
120 }
121 }
122 } else {
123 AddLogLineN(_("Failed to open friend list file 'emfriends.met' for reading!"));
124 }
125 } catch (const CInvalidPacket& e) {
126 AddDebugLogLineC(logGeneral, "Invalid entry in friend list, file may be corrupt: " + e.what());
127 } catch (const CSafeIOException& e) {
128 AddDebugLogLineC(logGeneral, "IO error while reading 'emfriends.met': " + e.what());
129 }
130
131}
132
133
134void CFriendList::SaveList()

Callers 1

OnInitMethod · 0.45

Calls 8

GetConfigDirFunction · 0.85
FileExistsMethod · 0.80
ReadUInt8Method · 0.80
ReadUInt32Method · 0.80
whatMethod · 0.80
CPathClass · 0.70
OpenMethod · 0.45
LoadFromFileMethod · 0.45

Tested by

no test coverage detected