Mercurial > wow > breuesk
comparison Comm.lua @ 105:c6c748a5823b tip
Collaborative list trimming 80% functional
Updates for the zone-in problem
author | John@Yosemite-PC |
---|---|
date | Sun, 06 May 2012 08:33:34 -0400 |
parents | 21567b74fcc7 |
children |
comparison
equal
deleted
inserted
replaced
104:9aa2dcbbdc87 | 105:c6c748a5823b |
---|---|
109 -- this as a rebase opportunity? print an error? just reply that we | 109 -- this as a rebase opportunity? print an error? just reply that we |
110 -- don't have anything new to share with them? only send them | 110 -- don't have anything new to share with them? only send them |
111 | 111 |
112 local success, o = CreateChangeDiff(remoteBase,t) | 112 local success, o = CreateChangeDiff(remoteBase,t) |
113 if success and getn(o) > 0 then | 113 if success and getn(o) > 0 then |
114 Send("CU",o) | 114 Send("CU",{remoteBase,o}) |
115 end | 115 end |
116 if not success then -- push | 116 if not success then -- push |
117 print("Received request at differing timebase",remoteBase,db.profile.time," ... pushing") | 117 print("Received request at differing timebase",remoteBase,db.profile.time," ... pushing") |
118 self:Push() -- todo: send privately to requester | 118 self:Push() -- todo: send privately to requester |
119 end | 119 end |
120 end | 120 end |
121 end, | 121 end, |
122 | 122 |
123 ["CU"] = function(self,packet,sender,isloop) -- blindly trust an admin loot master | 123 ["CU"] = function(self,packet,sender,isloop) -- blindly trust an admin loot master |
124 if isloop then return end | 124 if isloop then return end |
125 IntegrateChangeDiff(packet) | 125 local base,changes = unpack(packet) |
126 if base and base > 0 and changes and getn(changes) > 0 then | |
127 IntegrateChangeDiff(base,changes) | |
128 end | |
126 end, | 129 end, |
127 | 130 |
128 ["RequestCatchup"] = function(self,from) -- todo: integrate from | 131 ["RequestCatchup"] = function(self,from) -- todo: integrate from |
129 if not admin then | 132 if not admin then |
130 --local string = _g.tostring(timestamp) | 133 --local string = _g.tostring(timestamp) |
151 | 154 |
152 ["SA"] = function(self,packet,sender,isloop) | 155 ["SA"] = function(self,packet,sender,isloop) |
153 print("SA") | 156 print("SA") |
154 if isloop then return end | 157 if isloop then return end |
155 if admin then | 158 if admin then |
156 SendAdmin("SR",onloadAdminStatus) -- SR ... prevent infinite loop please | 159 -- todo: only send back a diff. this is barbaric. |
160 SendAdmin("SR",{onloadAdminStatus,db.profile.time,db.profile.changes}) -- SR ... prevent infinite loop please | |
157 RemoteAdminUpdateReceived(sender,packet) | 161 RemoteAdminUpdateReceived(sender,packet) |
158 end | 162 end |
159 end, | 163 end, |
160 | 164 |
161 ["SendAdminStatusTable"] = function(self) | 165 ["SendAdminStatusTable"] = function(self) |
162 if admin then | 166 if admin then |
163 SendAdmin("SA",onloadAdminStatus) -- only send onload status, since that's the only data you're guaranteed to have safely safed | 167 SendAdmin("SA",{onloadAdminStatus,db.profile.time}) -- only send onload status, since that's the only data you're guaranteed to have safely saved |
168 -- todo: see whether the above comment is correct, or the code | |
164 end | 169 end |
165 end, | 170 end, |
166 } | 171 } |
167 | 172 |
168 local function OnCommReceived(prefix, message, distribution, sender) | 173 local function OnCommReceived(prefix, message, distribution, sender) |